repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
vkostyukov/la4j
src/main/java/org/la4j/vector/dense/BasicVector.java
BasicVector.fromMap
public static BasicVector fromMap(Map<Integer, ? extends Number> map, int length) { """ Creates new {@link BasicVector} from index-value map @param map index-value map @param length vector length @return created vector """ return Vector.fromMap(map, length).to(Vectors.BASIC); }
java
public static BasicVector fromMap(Map<Integer, ? extends Number> map, int length) { return Vector.fromMap(map, length).to(Vectors.BASIC); }
[ "public", "static", "BasicVector", "fromMap", "(", "Map", "<", "Integer", ",", "?", "extends", "Number", ">", "map", ",", "int", "length", ")", "{", "return", "Vector", ".", "fromMap", "(", "map", ",", "length", ")", ".", "to", "(", "Vectors", ".", "BASIC", ")", ";", "}" ]
Creates new {@link BasicVector} from index-value map @param map index-value map @param length vector length @return created vector
[ "Creates", "new", "{", "@link", "BasicVector", "}", "from", "index", "-", "value", "map" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/vector/dense/BasicVector.java#L189-L191
ltsopensource/light-task-scheduler
lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java
WebUtils.doGet
public static String doGet(String url, Map<String, String> params) throws IOException { """ 执行HTTP GET请求。 @param url 请求地址 @param params 请求参数 @return 响应字符串 """ return doGet(url, params, DEFAULT_CHARSET); }
java
public static String doGet(String url, Map<String, String> params) throws IOException { return doGet(url, params, DEFAULT_CHARSET); }
[ "public", "static", "String", "doGet", "(", "String", "url", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", "{", "return", "doGet", "(", "url", ",", "params", ",", "DEFAULT_CHARSET", ")", ";", "}" ]
执行HTTP GET请求。 @param url 请求地址 @param params 请求参数 @return 响应字符串
[ "执行HTTP", "GET请求。" ]
train
https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L120-L122
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java
ExportConfigurationsInner.createAsync
public Observable<List<ApplicationInsightsComponentExportConfigurationInner>> createAsync(String resourceGroupName, String resourceName, ApplicationInsightsComponentExportRequest exportProperties) { """ Create a Continuous Export configuration of an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param exportProperties Properties that need to be specified to create a Continuous Export configuration of a Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ApplicationInsightsComponentExportConfigurationInner&gt; object """ return createWithServiceResponseAsync(resourceGroupName, resourceName, exportProperties).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentExportConfigurationInner>>, List<ApplicationInsightsComponentExportConfigurationInner>>() { @Override public List<ApplicationInsightsComponentExportConfigurationInner> call(ServiceResponse<List<ApplicationInsightsComponentExportConfigurationInner>> response) { return response.body(); } }); }
java
public Observable<List<ApplicationInsightsComponentExportConfigurationInner>> createAsync(String resourceGroupName, String resourceName, ApplicationInsightsComponentExportRequest exportProperties) { return createWithServiceResponseAsync(resourceGroupName, resourceName, exportProperties).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentExportConfigurationInner>>, List<ApplicationInsightsComponentExportConfigurationInner>>() { @Override public List<ApplicationInsightsComponentExportConfigurationInner> call(ServiceResponse<List<ApplicationInsightsComponentExportConfigurationInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ApplicationInsightsComponentExportConfigurationInner", ">", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ApplicationInsightsComponentExportRequest", "exportProperties", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "exportProperties", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "ApplicationInsightsComponentExportConfigurationInner", ">", ">", ",", "List", "<", "ApplicationInsightsComponentExportConfigurationInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "ApplicationInsightsComponentExportConfigurationInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "ApplicationInsightsComponentExportConfigurationInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create a Continuous Export configuration of an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param exportProperties Properties that need to be specified to create a Continuous Export configuration of a Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ApplicationInsightsComponentExportConfigurationInner&gt; object
[ "Create", "a", "Continuous", "Export", "configuration", "of", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java#L207-L214
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.withPrintWriter
public static <T> T withPrintWriter(Writer writer, @ClosureParams(value=SimpleType.class, options="java.io.PrintWriter") Closure<T> closure) throws IOException { """ Create a new PrintWriter for this Writer. The writer is passed to the closure, and will be closed before this method returns. @param writer a writer @param closure the closure to invoke with the PrintWriter @return the value returned by the closure @throws IOException if an IOException occurs. @since 1.6.0 """ return withWriter(newPrintWriter(writer), closure); }
java
public static <T> T withPrintWriter(Writer writer, @ClosureParams(value=SimpleType.class, options="java.io.PrintWriter") Closure<T> closure) throws IOException { return withWriter(newPrintWriter(writer), closure); }
[ "public", "static", "<", "T", ">", "T", "withPrintWriter", "(", "Writer", "writer", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.PrintWriter\"", ")", "Closure", "<", "T", ">", "closure", ")", "throws", "IOException", "{", "return", "withWriter", "(", "newPrintWriter", "(", "writer", ")", ",", "closure", ")", ";", "}" ]
Create a new PrintWriter for this Writer. The writer is passed to the closure, and will be closed before this method returns. @param writer a writer @param closure the closure to invoke with the PrintWriter @return the value returned by the closure @throws IOException if an IOException occurs. @since 1.6.0
[ "Create", "a", "new", "PrintWriter", "for", "this", "Writer", ".", "The", "writer", "is", "passed", "to", "the", "closure", "and", "will", "be", "closed", "before", "this", "method", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1103-L1105
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.noWhitespace
public static Validator<CharSequence> noWhitespace(@NonNull final Context context, @StringRes final int resourceId) { """ Creates and returns a validator, which allows to validate texts to ensure, that they contain no whitespace. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator} """ return new NoWhitespaceValidator(context, resourceId); }
java
public static Validator<CharSequence> noWhitespace(@NonNull final Context context, @StringRes final int resourceId) { return new NoWhitespaceValidator(context, resourceId); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "noWhitespace", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "return", "new", "NoWhitespaceValidator", "(", "context", ",", "resourceId", ")", ";", "}" ]
Creates and returns a validator, which allows to validate texts to ensure, that they contain no whitespace. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "contain", "no", "whitespace", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L531-L534
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildFieldInfo
public void buildFieldInfo(XMLNode node, Content fieldsContentTree) { """ Build the field information. @param node the XML element that specifies which components to document @param fieldsContentTree content tree to which the documentation will be added """ if(configuration.nocomment){ return; } VariableElement field = (VariableElement)currentMember; TypeElement te = utils.getEnclosingTypeElement(currentMember); // Process default Serializable field. if ((utils.getSerialTrees(field).isEmpty()) /*&& ! field.isSynthetic()*/ && configuration.serialwarn) { messages.warning(field, "doclet.MissingSerialTag", utils.getFullyQualifiedName(te), utils.getSimpleName(field)); } fieldWriter.addMemberDescription(field, fieldsContentTree); fieldWriter.addMemberTags(field, fieldsContentTree); }
java
public void buildFieldInfo(XMLNode node, Content fieldsContentTree) { if(configuration.nocomment){ return; } VariableElement field = (VariableElement)currentMember; TypeElement te = utils.getEnclosingTypeElement(currentMember); // Process default Serializable field. if ((utils.getSerialTrees(field).isEmpty()) /*&& ! field.isSynthetic()*/ && configuration.serialwarn) { messages.warning(field, "doclet.MissingSerialTag", utils.getFullyQualifiedName(te), utils.getSimpleName(field)); } fieldWriter.addMemberDescription(field, fieldsContentTree); fieldWriter.addMemberTags(field, fieldsContentTree); }
[ "public", "void", "buildFieldInfo", "(", "XMLNode", "node", ",", "Content", "fieldsContentTree", ")", "{", "if", "(", "configuration", ".", "nocomment", ")", "{", "return", ";", "}", "VariableElement", "field", "=", "(", "VariableElement", ")", "currentMember", ";", "TypeElement", "te", "=", "utils", ".", "getEnclosingTypeElement", "(", "currentMember", ")", ";", "// Process default Serializable field.", "if", "(", "(", "utils", ".", "getSerialTrees", "(", "field", ")", ".", "isEmpty", "(", ")", ")", "/*&& ! field.isSynthetic()*/", "&&", "configuration", ".", "serialwarn", ")", "{", "messages", ".", "warning", "(", "field", ",", "\"doclet.MissingSerialTag\"", ",", "utils", ".", "getFullyQualifiedName", "(", "te", ")", ",", "utils", ".", "getSimpleName", "(", "field", ")", ")", ";", "}", "fieldWriter", ".", "addMemberDescription", "(", "field", ",", "fieldsContentTree", ")", ";", "fieldWriter", ".", "addMemberTags", "(", "field", ",", "fieldsContentTree", ")", ";", "}" ]
Build the field information. @param node the XML element that specifies which components to document @param fieldsContentTree content tree to which the documentation will be added
[ "Build", "the", "field", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L530-L545
google/j2objc
jre_emul/Classes/com/google/j2objc/util/NativeTimeZone.java
NativeTimeZone.getOffset
@Override public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { """ This implementation is adapted from libcore's ZoneInfo. The method always assumes Gregorian calendar, and uses a simple formula to first derive the instant of the local datetime arguments and then call {@link #getOffset(long)} to get the actual offset. The local datetime used here is always in the non-DST time zone, i.e. the time zone with the "raw" offset, as evidenced by actual JDK implementation and the code below. This means it's possible to call getOffset with a practically non-existent date time, such as 2:30 AM, March 13, 2016, which does not exist in US Pacific Time -- it falls in the DST gap of that day. When we compute the milliseconds for the year component, we need to take leap years into consideration. According to http://aa.usno.navy.mil/faq/docs/calendars.php: "The Gregorian leap year rule is: Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 are not leap years, but the year 2000 is." Hence the rules and constants used here. Since this method only supports Gregorian calendar, the return value of any date before October 4, 1582 is not reliable. In addition, the era and dayOfWeek arguments are not used in this method. """ long calc = (year / 400) * MILLISECONDS_PER_400_YEARS; year %= 400; calc += year * (365 * MILLISECONDS_PER_DAY); calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY; if (year > 0) { calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY; } boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0)); int[] mlen = isLeap ? LEAP : NORMAL; calc += mlen[month] * MILLISECONDS_PER_DAY; calc += (day - 1) * MILLISECONDS_PER_DAY; calc += millis; calc -= rawOffset; calc -= UNIX_OFFSET; return getOffset(calc); }
java
@Override public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { long calc = (year / 400) * MILLISECONDS_PER_400_YEARS; year %= 400; calc += year * (365 * MILLISECONDS_PER_DAY); calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY; if (year > 0) { calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY; } boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0)); int[] mlen = isLeap ? LEAP : NORMAL; calc += mlen[month] * MILLISECONDS_PER_DAY; calc += (day - 1) * MILLISECONDS_PER_DAY; calc += millis; calc -= rawOffset; calc -= UNIX_OFFSET; return getOffset(calc); }
[ "@", "Override", "public", "int", "getOffset", "(", "int", "era", ",", "int", "year", ",", "int", "month", ",", "int", "day", ",", "int", "dayOfWeek", ",", "int", "millis", ")", "{", "long", "calc", "=", "(", "year", "/", "400", ")", "*", "MILLISECONDS_PER_400_YEARS", ";", "year", "%=", "400", ";", "calc", "+=", "year", "*", "(", "365", "*", "MILLISECONDS_PER_DAY", ")", ";", "calc", "+=", "(", "(", "year", "+", "3", ")", "/", "4", ")", "*", "MILLISECONDS_PER_DAY", ";", "if", "(", "year", ">", "0", ")", "{", "calc", "-=", "(", "(", "year", "-", "1", ")", "/", "100", ")", "*", "MILLISECONDS_PER_DAY", ";", "}", "boolean", "isLeap", "=", "(", "year", "==", "0", "||", "(", "year", "%", "4", "==", "0", "&&", "year", "%", "100", "!=", "0", ")", ")", ";", "int", "[", "]", "mlen", "=", "isLeap", "?", "LEAP", ":", "NORMAL", ";", "calc", "+=", "mlen", "[", "month", "]", "*", "MILLISECONDS_PER_DAY", ";", "calc", "+=", "(", "day", "-", "1", ")", "*", "MILLISECONDS_PER_DAY", ";", "calc", "+=", "millis", ";", "calc", "-=", "rawOffset", ";", "calc", "-=", "UNIX_OFFSET", ";", "return", "getOffset", "(", "calc", ")", ";", "}" ]
This implementation is adapted from libcore's ZoneInfo. The method always assumes Gregorian calendar, and uses a simple formula to first derive the instant of the local datetime arguments and then call {@link #getOffset(long)} to get the actual offset. The local datetime used here is always in the non-DST time zone, i.e. the time zone with the "raw" offset, as evidenced by actual JDK implementation and the code below. This means it's possible to call getOffset with a practically non-existent date time, such as 2:30 AM, March 13, 2016, which does not exist in US Pacific Time -- it falls in the DST gap of that day. When we compute the milliseconds for the year component, we need to take leap years into consideration. According to http://aa.usno.navy.mil/faq/docs/calendars.php: "The Gregorian leap year rule is: Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 are not leap years, but the year 2000 is." Hence the rules and constants used here. Since this method only supports Gregorian calendar, the return value of any date before October 4, 1582 is not reliable. In addition, the era and dayOfWeek arguments are not used in this method.
[ "This", "implementation", "is", "adapted", "from", "libcore", "s", "ZoneInfo", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/util/NativeTimeZone.java#L217-L240
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/rest/RelationshipResource.java
RelationshipResource.addRelationship
@Path("/new") @POST public Response addRelationship( @PathParam(RestParam.PID) String pid, @QueryParam(RestParam.SUBJECT) String subject, @QueryParam(RestParam.PREDICATE) String predicate, @QueryParam(RestParam.OBJECT) String object, @QueryParam(RestParam.IS_LITERAL) boolean isLiteral, @QueryParam(RestParam.DATATYPE) String datatype, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { """ Add a relationship. <br> POST /objects/{pid}/relationships/new ? subject predicate object isLiteral datatype <br> Successful Response: Status: 200 OK """ Context context = getContext(); try { if (subject == null) { // assume the subject is the object as denoted by the pid subject = PID.toURI(pid); } boolean result = m_management.addRelationship(context, subject, predicate, object, isLiteral, datatype); return Response.ok(Boolean.toString(result)).build(); // needs an entity to not be overridden with a 204 } catch (ServerException e) { return handleException(e, flash); } }
java
@Path("/new") @POST public Response addRelationship( @PathParam(RestParam.PID) String pid, @QueryParam(RestParam.SUBJECT) String subject, @QueryParam(RestParam.PREDICATE) String predicate, @QueryParam(RestParam.OBJECT) String object, @QueryParam(RestParam.IS_LITERAL) boolean isLiteral, @QueryParam(RestParam.DATATYPE) String datatype, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { Context context = getContext(); try { if (subject == null) { // assume the subject is the object as denoted by the pid subject = PID.toURI(pid); } boolean result = m_management.addRelationship(context, subject, predicate, object, isLiteral, datatype); return Response.ok(Boolean.toString(result)).build(); // needs an entity to not be overridden with a 204 } catch (ServerException e) { return handleException(e, flash); } }
[ "@", "Path", "(", "\"/new\"", ")", "@", "POST", "public", "Response", "addRelationship", "(", "@", "PathParam", "(", "RestParam", ".", "PID", ")", "String", "pid", ",", "@", "QueryParam", "(", "RestParam", ".", "SUBJECT", ")", "String", "subject", ",", "@", "QueryParam", "(", "RestParam", ".", "PREDICATE", ")", "String", "predicate", ",", "@", "QueryParam", "(", "RestParam", ".", "OBJECT", ")", "String", "object", ",", "@", "QueryParam", "(", "RestParam", ".", "IS_LITERAL", ")", "boolean", "isLiteral", ",", "@", "QueryParam", "(", "RestParam", ".", "DATATYPE", ")", "String", "datatype", ",", "@", "QueryParam", "(", "RestParam", ".", "FLASH", ")", "@", "DefaultValue", "(", "\"false\"", ")", "boolean", "flash", ")", "{", "Context", "context", "=", "getContext", "(", ")", ";", "try", "{", "if", "(", "subject", "==", "null", ")", "{", "// assume the subject is the object as denoted by the pid", "subject", "=", "PID", ".", "toURI", "(", "pid", ")", ";", "}", "boolean", "result", "=", "m_management", ".", "addRelationship", "(", "context", ",", "subject", ",", "predicate", ",", "object", ",", "isLiteral", ",", "datatype", ")", ";", "return", "Response", ".", "ok", "(", "Boolean", ".", "toString", "(", "result", ")", ")", ".", "build", "(", ")", ";", "// needs an entity to not be overridden with a 204", "}", "catch", "(", "ServerException", "e", ")", "{", "return", "handleException", "(", "e", ",", "flash", ")", ";", "}", "}" ]
Add a relationship. <br> POST /objects/{pid}/relationships/new ? subject predicate object isLiteral datatype <br> Successful Response: Status: 200 OK
[ "Add", "a", "relationship", ".", "<br", ">", "POST", "/", "objects", "/", "{", "pid", "}", "/", "relationships", "/", "new", "?", "subject", "predicate", "object", "isLiteral", "datatype", "<br", ">", "Successful", "Response", ":", "Status", ":", "200", "OK" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/RelationshipResource.java#L121-L150
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.flatMapIterable
@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public final <U> Flowable<U> flatMapIterable(final Function<? super T, ? extends Iterable<? extends U>> mapper, int bufferSize) { """ Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector. <p> <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flatMapIterable.f.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator honors backpressure from downstream. The source {@code Publisher}s is expected to honor backpressure as well. If the source {@code Publisher} violates the rule, the operator will signal a {@code MissingBackpressureException}.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code flatMapIterable} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <U> the type of item emitted by the resulting Iterable @param mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Publisher @param bufferSize the number of elements to prefetch from the current Flowable @return a Flowable that emits the results of merging the items emitted by the source Publisher with the values in the Iterables corresponding to those items, as generated by {@code collectionSelector} @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a> """ ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new FlowableFlattenIterable<T, U>(this, mapper, bufferSize)); }
java
@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public final <U> Flowable<U> flatMapIterable(final Function<? super T, ? extends Iterable<? extends U>> mapper, int bufferSize) { ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); return RxJavaPlugins.onAssembly(new FlowableFlattenIterable<T, U>(this, mapper, bufferSize)); }
[ "@", "CheckReturnValue", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "FULL", ")", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "<", "U", ">", "Flowable", "<", "U", ">", "flatMapIterable", "(", "final", "Function", "<", "?", "super", "T", ",", "?", "extends", "Iterable", "<", "?", "extends", "U", ">", ">", "mapper", ",", "int", "bufferSize", ")", "{", "ObjectHelper", ".", "requireNonNull", "(", "mapper", ",", "\"mapper is null\"", ")", ";", "ObjectHelper", ".", "verifyPositive", "(", "bufferSize", ",", "\"bufferSize\"", ")", ";", "return", "RxJavaPlugins", ".", "onAssembly", "(", "new", "FlowableFlattenIterable", "<", "T", ",", "U", ">", "(", "this", ",", "mapper", ",", "bufferSize", ")", ")", ";", "}" ]
Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector. <p> <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flatMapIterable.f.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator honors backpressure from downstream. The source {@code Publisher}s is expected to honor backpressure as well. If the source {@code Publisher} violates the rule, the operator will signal a {@code MissingBackpressureException}.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code flatMapIterable} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <U> the type of item emitted by the resulting Iterable @param mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Publisher @param bufferSize the number of elements to prefetch from the current Flowable @return a Flowable that emits the results of merging the items emitted by the source Publisher with the values in the Iterables corresponding to those items, as generated by {@code collectionSelector} @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
[ "Returns", "a", "Flowable", "that", "merges", "each", "item", "emitted", "by", "the", "source", "Publisher", "with", "the", "values", "in", "an", "Iterable", "corresponding", "to", "that", "item", "that", "is", "generated", "by", "a", "selector", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "310", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", "/", "ReactiveX", "/", "RxJava", "/", "images", "/", "rx", "-", "operators", "/", "flatMapIterable", ".", "f", ".", "png", "alt", "=", ">", "<dl", ">", "<dt", ">", "<b", ">", "Backpressure", ":", "<", "/", "b", ">", "<", "/", "dt", ">", "<dd", ">", "The", "operator", "honors", "backpressure", "from", "downstream", ".", "The", "source", "{", "@code", "Publisher", "}", "s", "is", "expected", "to", "honor", "backpressure", "as", "well", ".", "If", "the", "source", "{", "@code", "Publisher", "}", "violates", "the", "rule", "the", "operator", "will", "signal", "a", "{", "@code", "MissingBackpressureException", "}", ".", "<", "/", "dd", ">", "<dt", ">", "<b", ">", "Scheduler", ":", "<", "/", "b", ">", "<", "/", "dt", ">", "<dd", ">", "{", "@code", "flatMapIterable", "}", "does", "not", "operate", "by", "default", "on", "a", "particular", "{", "@link", "Scheduler", "}", ".", "<", "/", "dd", ">", "<", "/", "dl", ">" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L9939-L9946
MenoData/Time4J
base/src/main/java/net/time4j/range/IntervalParser.java
IntervalParser.parsePattern
static <T, I extends ChronoInterval<T>> I parsePattern( CharSequence text, IntervalCreator<T, I> factory, ChronoParser<T> parser, String pattern ) throws ParseException { """ <p>Custom parsing using any kind of interval pattern (possibly with or-logic). </p> @param text text to be parsed @param factory interval factory @param parser parser used for parsing either start or end component @param pattern interval pattern containing the placeholders {0} or {1} @return parsed interval @throws ParseException if parsing fails @since 4.18 """ ParseLog plog = new ParseLog(); String[] components = pattern.split("\\|"); for (String component : components) { plog.reset(); I interval = IntervalParser.parseComponent(text, factory, parser, component, plog); if ((interval != null) && !plog.isError()) { return interval; } } if (plog.isError()) { throw new ParseException(plog.getErrorMessage(), plog.getErrorIndex()); } else { throw new ParseException("Parsing of interval failed: " + text, plog.getPosition()); } }
java
static <T, I extends ChronoInterval<T>> I parsePattern( CharSequence text, IntervalCreator<T, I> factory, ChronoParser<T> parser, String pattern ) throws ParseException { ParseLog plog = new ParseLog(); String[] components = pattern.split("\\|"); for (String component : components) { plog.reset(); I interval = IntervalParser.parseComponent(text, factory, parser, component, plog); if ((interval != null) && !plog.isError()) { return interval; } } if (plog.isError()) { throw new ParseException(plog.getErrorMessage(), plog.getErrorIndex()); } else { throw new ParseException("Parsing of interval failed: " + text, plog.getPosition()); } }
[ "static", "<", "T", ",", "I", "extends", "ChronoInterval", "<", "T", ">", ">", "I", "parsePattern", "(", "CharSequence", "text", ",", "IntervalCreator", "<", "T", ",", "I", ">", "factory", ",", "ChronoParser", "<", "T", ">", "parser", ",", "String", "pattern", ")", "throws", "ParseException", "{", "ParseLog", "plog", "=", "new", "ParseLog", "(", ")", ";", "String", "[", "]", "components", "=", "pattern", ".", "split", "(", "\"\\\\|\"", ")", ";", "for", "(", "String", "component", ":", "components", ")", "{", "plog", ".", "reset", "(", ")", ";", "I", "interval", "=", "IntervalParser", ".", "parseComponent", "(", "text", ",", "factory", ",", "parser", ",", "component", ",", "plog", ")", ";", "if", "(", "(", "interval", "!=", "null", ")", "&&", "!", "plog", ".", "isError", "(", ")", ")", "{", "return", "interval", ";", "}", "}", "if", "(", "plog", ".", "isError", "(", ")", ")", "{", "throw", "new", "ParseException", "(", "plog", ".", "getErrorMessage", "(", ")", ",", "plog", ".", "getErrorIndex", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "ParseException", "(", "\"Parsing of interval failed: \"", "+", "text", ",", "plog", ".", "getPosition", "(", ")", ")", ";", "}", "}" ]
<p>Custom parsing using any kind of interval pattern (possibly with or-logic). </p> @param text text to be parsed @param factory interval factory @param parser parser used for parsing either start or end component @param pattern interval pattern containing the placeholders {0} or {1} @return parsed interval @throws ParseException if parsing fails @since 4.18
[ "<p", ">", "Custom", "parsing", "using", "any", "kind", "of", "interval", "pattern", "(", "possibly", "with", "or", "-", "logic", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/IntervalParser.java#L483-L508
m-m-m/util
exception/src/main/java/net/sf/mmm/util/exception/api/NlsNullPointerException.java
NlsNullPointerException.checkNotNull
public static void checkNotNull(String objectName, Object object) throws NlsNullPointerException { """ This method checks if the given {@code object} is {@code null}. <br> Look at the following example: <pre> {@link NlsNullPointerException}.checkNotNull("someParameter", someParameter); </pre> This is equivalent to this code: <pre> if (someParameter == null) { throw new {@link NlsNullPointerException}("someParameter"); } </pre> @param objectName is the (argument-)name of the given {@code object}. @param object is the object that is checked and should NOT be {@code null}. @throws NlsNullPointerException if the given {@code object} is {@code null}. @since 2.0.0 """ if (object == null) { throw new NlsNullPointerException(objectName); } }
java
public static void checkNotNull(String objectName, Object object) throws NlsNullPointerException { if (object == null) { throw new NlsNullPointerException(objectName); } }
[ "public", "static", "void", "checkNotNull", "(", "String", "objectName", ",", "Object", "object", ")", "throws", "NlsNullPointerException", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NlsNullPointerException", "(", "objectName", ")", ";", "}", "}" ]
This method checks if the given {@code object} is {@code null}. <br> Look at the following example: <pre> {@link NlsNullPointerException}.checkNotNull("someParameter", someParameter); </pre> This is equivalent to this code: <pre> if (someParameter == null) { throw new {@link NlsNullPointerException}("someParameter"); } </pre> @param objectName is the (argument-)name of the given {@code object}. @param object is the object that is checked and should NOT be {@code null}. @throws NlsNullPointerException if the given {@code object} is {@code null}. @since 2.0.0
[ "This", "method", "checks", "if", "the", "given", "{", "@code", "object", "}", "is", "{", "@code", "null", "}", ".", "<br", ">", "Look", "at", "the", "following", "example", ":" ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/exception/src/main/java/net/sf/mmm/util/exception/api/NlsNullPointerException.java#L102-L107
b3log/latke
latke-core/src/main/java/org/b3log/latke/Keys.java
Keys.fillServer
public static void fillServer(final Map<String, Object> dataModel) { """ Fills the server info into the specified data model. <ul> <li>{@value org.b3log.latke.Keys.Server#SERVER_SCHEME}</li> <li>{@value org.b3log.latke.Keys.Server#SERVER_HOST}</li> <li>{@value org.b3log.latke.Keys.Server#SERVER_PORT}</li> <li>{@value org.b3log.latke.Keys.Server#SERVER}</li> <li>{@value org.b3log.latke.Keys.Server#CONTEXT_PATH}</li> <li>{@value org.b3log.latke.Keys.Server#SERVE_PATH}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_SCHEME}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_HOST}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_PORT}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_PATH}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVE_PATH}</li> </ul> @param dataModel the specified data model """ dataModel.put(Server.SERVER_SCHEME, Latkes.getServerScheme()); dataModel.put(Server.SERVER_HOST, Latkes.getServerHost()); dataModel.put(Server.SERVER_PORT, Latkes.getServerPort()); dataModel.put(Server.SERVER, Latkes.getServer()); dataModel.put(Server.CONTEXT_PATH, Latkes.getContextPath()); dataModel.put(Server.SERVE_PATH, Latkes.getServePath()); dataModel.put(Server.STATIC_SERVER_SCHEME, Latkes.getStaticServerScheme()); dataModel.put(Server.STATIC_SERVER_HOST, Latkes.getStaticServerHost()); dataModel.put(Server.STATIC_SERVER_PORT, Latkes.getStaticServerPort()); dataModel.put(Server.STATIC_SERVER, Latkes.getStaticServer()); dataModel.put(Server.STATIC_PATH, Latkes.getStaticPath()); dataModel.put(Server.STATIC_SERVE_PATH, Latkes.getStaticServePath()); }
java
public static void fillServer(final Map<String, Object> dataModel) { dataModel.put(Server.SERVER_SCHEME, Latkes.getServerScheme()); dataModel.put(Server.SERVER_HOST, Latkes.getServerHost()); dataModel.put(Server.SERVER_PORT, Latkes.getServerPort()); dataModel.put(Server.SERVER, Latkes.getServer()); dataModel.put(Server.CONTEXT_PATH, Latkes.getContextPath()); dataModel.put(Server.SERVE_PATH, Latkes.getServePath()); dataModel.put(Server.STATIC_SERVER_SCHEME, Latkes.getStaticServerScheme()); dataModel.put(Server.STATIC_SERVER_HOST, Latkes.getStaticServerHost()); dataModel.put(Server.STATIC_SERVER_PORT, Latkes.getStaticServerPort()); dataModel.put(Server.STATIC_SERVER, Latkes.getStaticServer()); dataModel.put(Server.STATIC_PATH, Latkes.getStaticPath()); dataModel.put(Server.STATIC_SERVE_PATH, Latkes.getStaticServePath()); }
[ "public", "static", "void", "fillServer", "(", "final", "Map", "<", "String", ",", "Object", ">", "dataModel", ")", "{", "dataModel", ".", "put", "(", "Server", ".", "SERVER_SCHEME", ",", "Latkes", ".", "getServerScheme", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "SERVER_HOST", ",", "Latkes", ".", "getServerHost", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "SERVER_PORT", ",", "Latkes", ".", "getServerPort", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "SERVER", ",", "Latkes", ".", "getServer", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "CONTEXT_PATH", ",", "Latkes", ".", "getContextPath", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "SERVE_PATH", ",", "Latkes", ".", "getServePath", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "STATIC_SERVER_SCHEME", ",", "Latkes", ".", "getStaticServerScheme", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "STATIC_SERVER_HOST", ",", "Latkes", ".", "getStaticServerHost", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "STATIC_SERVER_PORT", ",", "Latkes", ".", "getStaticServerPort", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "STATIC_SERVER", ",", "Latkes", ".", "getStaticServer", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "STATIC_PATH", ",", "Latkes", ".", "getStaticPath", "(", ")", ")", ";", "dataModel", ".", "put", "(", "Server", ".", "STATIC_SERVE_PATH", ",", "Latkes", ".", "getStaticServePath", "(", ")", ")", ";", "}" ]
Fills the server info into the specified data model. <ul> <li>{@value org.b3log.latke.Keys.Server#SERVER_SCHEME}</li> <li>{@value org.b3log.latke.Keys.Server#SERVER_HOST}</li> <li>{@value org.b3log.latke.Keys.Server#SERVER_PORT}</li> <li>{@value org.b3log.latke.Keys.Server#SERVER}</li> <li>{@value org.b3log.latke.Keys.Server#CONTEXT_PATH}</li> <li>{@value org.b3log.latke.Keys.Server#SERVE_PATH}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_SCHEME}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_HOST}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER_PORT}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVER}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_PATH}</li> <li>{@value org.b3log.latke.Keys.Server#STATIC_SERVE_PATH}</li> </ul> @param dataModel the specified data model
[ "Fills", "the", "server", "info", "into", "the", "specified", "data", "model", ".", "<ul", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#SERVER_SCHEME", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#SERVER_HOST", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#SERVER_PORT", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#SERVER", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#CONTEXT_PATH", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#SERVE_PATH", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#STATIC_SERVER_SCHEME", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#STATIC_SERVER_HOST", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#STATIC_SERVER_PORT", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#STATIC_SERVER", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#STATIC_PATH", "}", "<", "/", "li", ">", "<li", ">", "{", "@value", "org", ".", "b3log", ".", "latke", ".", "Keys", ".", "Server#STATIC_SERVE_PATH", "}", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Keys.java#L142-L156
playn/playn
android/src/playn/android/AndroidHttpClient.java
AndroidHttpClient.newInstance
public static AndroidHttpClient newInstance(String userAgent) { """ Create a new HttpClient with reasonable defaults (which you can update). @param userAgent to report in your HTTP requests. @return AndroidHttpClient for you to use for all your requests. """ HttpParams params = new BasicHttpParams(); // Turn off stale checking. Our connections break all the time anyway, // and it's not worth it to pay the penalty of checking every time. HttpConnectionParams.setStaleCheckingEnabled(params, false); // Default connection and socket timeout of 20 seconds. Tweak to taste. HttpConnectionParams.setConnectionTimeout(params, 20 * 1000); HttpConnectionParams.setSoTimeout(params, 20 * 1000); HttpConnectionParams.setSocketBufferSize(params, 8192); // Don't handle redirects -- return them to the caller. Our code // often wants to re-POST after a redirect, which we must do ourselves. HttpClientParams.setRedirecting(params, false); // Set the specified user agent and register standard protocols. HttpProtocolParams.setUserAgent(params, userAgent); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); ClientConnectionManager manager = new ThreadSafeClientConnManager(params, schemeRegistry); // We use a factory method to modify superclass initialization // parameters without the funny call-a-static-method dance. return new AndroidHttpClient(manager, params); }
java
public static AndroidHttpClient newInstance(String userAgent) { HttpParams params = new BasicHttpParams(); // Turn off stale checking. Our connections break all the time anyway, // and it's not worth it to pay the penalty of checking every time. HttpConnectionParams.setStaleCheckingEnabled(params, false); // Default connection and socket timeout of 20 seconds. Tweak to taste. HttpConnectionParams.setConnectionTimeout(params, 20 * 1000); HttpConnectionParams.setSoTimeout(params, 20 * 1000); HttpConnectionParams.setSocketBufferSize(params, 8192); // Don't handle redirects -- return them to the caller. Our code // often wants to re-POST after a redirect, which we must do ourselves. HttpClientParams.setRedirecting(params, false); // Set the specified user agent and register standard protocols. HttpProtocolParams.setUserAgent(params, userAgent); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); ClientConnectionManager manager = new ThreadSafeClientConnManager(params, schemeRegistry); // We use a factory method to modify superclass initialization // parameters without the funny call-a-static-method dance. return new AndroidHttpClient(manager, params); }
[ "public", "static", "AndroidHttpClient", "newInstance", "(", "String", "userAgent", ")", "{", "HttpParams", "params", "=", "new", "BasicHttpParams", "(", ")", ";", "// Turn off stale checking. Our connections break all the time anyway,", "// and it's not worth it to pay the penalty of checking every time.", "HttpConnectionParams", ".", "setStaleCheckingEnabled", "(", "params", ",", "false", ")", ";", "// Default connection and socket timeout of 20 seconds. Tweak to taste.", "HttpConnectionParams", ".", "setConnectionTimeout", "(", "params", ",", "20", "*", "1000", ")", ";", "HttpConnectionParams", ".", "setSoTimeout", "(", "params", ",", "20", "*", "1000", ")", ";", "HttpConnectionParams", ".", "setSocketBufferSize", "(", "params", ",", "8192", ")", ";", "// Don't handle redirects -- return them to the caller. Our code", "// often wants to re-POST after a redirect, which we must do ourselves.", "HttpClientParams", ".", "setRedirecting", "(", "params", ",", "false", ")", ";", "// Set the specified user agent and register standard protocols.", "HttpProtocolParams", ".", "setUserAgent", "(", "params", ",", "userAgent", ")", ";", "SchemeRegistry", "schemeRegistry", "=", "new", "SchemeRegistry", "(", ")", ";", "schemeRegistry", ".", "register", "(", "new", "Scheme", "(", "\"http\"", ",", "PlainSocketFactory", ".", "getSocketFactory", "(", ")", ",", "80", ")", ")", ";", "schemeRegistry", ".", "register", "(", "new", "Scheme", "(", "\"https\"", ",", "SSLSocketFactory", ".", "getSocketFactory", "(", ")", ",", "443", ")", ")", ";", "ClientConnectionManager", "manager", "=", "new", "ThreadSafeClientConnManager", "(", "params", ",", "schemeRegistry", ")", ";", "// We use a factory method to modify superclass initialization", "// parameters without the funny call-a-static-method dance.", "return", "new", "AndroidHttpClient", "(", "manager", ",", "params", ")", ";", "}" ]
Create a new HttpClient with reasonable defaults (which you can update). @param userAgent to report in your HTTP requests. @return AndroidHttpClient for you to use for all your requests.
[ "Create", "a", "new", "HttpClient", "with", "reasonable", "defaults", "(", "which", "you", "can", "update", ")", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/android/src/playn/android/AndroidHttpClient.java#L80-L106
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java
DBTransaction.addColumn
public void addColumn(String storeName, String rowKey, String columnName) { """ Add a column with empty value. The value will be empty byte array/empty string, not null @param storeName Name of store that owns row. @param rowKey Key of row that owns column. @param columnName Name of column. """ addColumn(storeName, rowKey, columnName, EMPTY); }
java
public void addColumn(String storeName, String rowKey, String columnName) { addColumn(storeName, rowKey, columnName, EMPTY); }
[ "public", "void", "addColumn", "(", "String", "storeName", ",", "String", "rowKey", ",", "String", "columnName", ")", "{", "addColumn", "(", "storeName", ",", "rowKey", ",", "columnName", ",", "EMPTY", ")", ";", "}" ]
Add a column with empty value. The value will be empty byte array/empty string, not null @param storeName Name of store that owns row. @param rowKey Key of row that owns column. @param columnName Name of column.
[ "Add", "a", "column", "with", "empty", "value", ".", "The", "value", "will", "be", "empty", "byte", "array", "/", "empty", "string", "not", "null" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java#L193-L195
EdwardRaff/JSAT
JSAT/src/jsat/io/CSV.java
CSV.readC
public static ClassificationDataSet readC(int classification_target, Reader reader, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException { """ Reads in a CSV dataset as a classification dataset. @param classification_target the column index (starting from zero) of the feature that will be the categorical target value @param reader the reader for the CSV content @param delimiter the delimiter to separate columns, usually a comma @param lines_to_skip the number of lines to skip when reading in the CSV (used to skip header information) @param comment the character used to indicate the start of a comment. Once this character is reached, anything at and after the character will be ignored. @param cat_cols a set of the indices to treat as categorical features. @return the classification dataset from the given CSV file @throws IOException """ return (ClassificationDataSet) readCSV(reader, lines_to_skip, delimiter, comment, cat_cols, -1, classification_target); }
java
public static ClassificationDataSet readC(int classification_target, Reader reader, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException { return (ClassificationDataSet) readCSV(reader, lines_to_skip, delimiter, comment, cat_cols, -1, classification_target); }
[ "public", "static", "ClassificationDataSet", "readC", "(", "int", "classification_target", ",", "Reader", "reader", ",", "char", "delimiter", ",", "int", "lines_to_skip", ",", "char", "comment", ",", "Set", "<", "Integer", ">", "cat_cols", ")", "throws", "IOException", "{", "return", "(", "ClassificationDataSet", ")", "readCSV", "(", "reader", ",", "lines_to_skip", ",", "delimiter", ",", "comment", ",", "cat_cols", ",", "-", "1", ",", "classification_target", ")", ";", "}" ]
Reads in a CSV dataset as a classification dataset. @param classification_target the column index (starting from zero) of the feature that will be the categorical target value @param reader the reader for the CSV content @param delimiter the delimiter to separate columns, usually a comma @param lines_to_skip the number of lines to skip when reading in the CSV (used to skip header information) @param comment the character used to indicate the start of a comment. Once this character is reached, anything at and after the character will be ignored. @param cat_cols a set of the indices to treat as categorical features. @return the classification dataset from the given CSV file @throws IOException
[ "Reads", "in", "a", "CSV", "dataset", "as", "a", "classification", "dataset", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/CSV.java#L193-L196
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/InetSocketAddressFactory.java
InetSocketAddressFactory.createWithResolveRetry
public static InetSocketAddress createWithResolveRetry( String hostname, int port, int delayMillis, int maxAttempt ) { """ Utility function to create an InetSocketAddress that has been resolved. Retries with a small sleep in between @param hostname - host @param port - port @param delayMillis - millis to sleep between attempts @param maxAttempt - max total attempts to retry @return InetSocketAddress, may be unresolved if all attempts fail """ InetSocketAddress socketAddress; int attempts = 0; do { socketAddress = new InetSocketAddress(hostname, port); // if dns failed, try one more time if (socketAddress.isUnresolved()) { attempts++; LOG.info(String.format( "failed to resolve host %s, attempt %d", hostname, attempts )); try { Thread.sleep(delayMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } else if (attempts > 0) { LOG.info( String.format("successful resolution on attempt %d", attempts) ); } } while (socketAddress.isUnresolved() && attempts < maxAttempt); return socketAddress; }
java
public static InetSocketAddress createWithResolveRetry( String hostname, int port, int delayMillis, int maxAttempt ) { InetSocketAddress socketAddress; int attempts = 0; do { socketAddress = new InetSocketAddress(hostname, port); // if dns failed, try one more time if (socketAddress.isUnresolved()) { attempts++; LOG.info(String.format( "failed to resolve host %s, attempt %d", hostname, attempts )); try { Thread.sleep(delayMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } else if (attempts > 0) { LOG.info( String.format("successful resolution on attempt %d", attempts) ); } } while (socketAddress.isUnresolved() && attempts < maxAttempt); return socketAddress; }
[ "public", "static", "InetSocketAddress", "createWithResolveRetry", "(", "String", "hostname", ",", "int", "port", ",", "int", "delayMillis", ",", "int", "maxAttempt", ")", "{", "InetSocketAddress", "socketAddress", ";", "int", "attempts", "=", "0", ";", "do", "{", "socketAddress", "=", "new", "InetSocketAddress", "(", "hostname", ",", "port", ")", ";", "// if dns failed, try one more time", "if", "(", "socketAddress", ".", "isUnresolved", "(", ")", ")", "{", "attempts", "++", ";", "LOG", ".", "info", "(", "String", ".", "format", "(", "\"failed to resolve host %s, attempt %d\"", ",", "hostname", ",", "attempts", ")", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "delayMillis", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "}", "}", "else", "if", "(", "attempts", ">", "0", ")", "{", "LOG", ".", "info", "(", "String", ".", "format", "(", "\"successful resolution on attempt %d\"", ",", "attempts", ")", ")", ";", "}", "}", "while", "(", "socketAddress", ".", "isUnresolved", "(", ")", "&&", "attempts", "<", "maxAttempt", ")", ";", "return", "socketAddress", ";", "}" ]
Utility function to create an InetSocketAddress that has been resolved. Retries with a small sleep in between @param hostname - host @param port - port @param delayMillis - millis to sleep between attempts @param maxAttempt - max total attempts to retry @return InetSocketAddress, may be unresolved if all attempts fail
[ "Utility", "function", "to", "create", "an", "InetSocketAddress", "that", "has", "been", "resolved", ".", "Retries", "with", "a", "small", "sleep", "in", "between" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/InetSocketAddressFactory.java#L43-L76
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java
SDNN.layerNorm
public SDVariable layerNorm(SDVariable input, SDVariable gain, int... dimensions) { """ Apply Layer Normalization without bias y = gain * standardize(x) @return Output variable """ return layerNorm((String)null, input, gain, dimensions); }
java
public SDVariable layerNorm(SDVariable input, SDVariable gain, int... dimensions) { return layerNorm((String)null, input, gain, dimensions); }
[ "public", "SDVariable", "layerNorm", "(", "SDVariable", "input", ",", "SDVariable", "gain", ",", "int", "...", "dimensions", ")", "{", "return", "layerNorm", "(", "(", "String", ")", "null", ",", "input", ",", "gain", ",", "dimensions", ")", ";", "}" ]
Apply Layer Normalization without bias y = gain * standardize(x) @return Output variable
[ "Apply", "Layer", "Normalization", "without", "bias" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L731-L733
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImagesInner.java
VirtualMachineImagesInner.listSkusAsync
public Observable<List<VirtualMachineImageResourceInner>> listSkusAsync(String location, String publisherName, String offer) { """ Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. @param location The name of a supported Azure region. @param publisherName A valid image publisher. @param offer A valid image publisher offer. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;VirtualMachineImageResourceInner&gt; object """ return listSkusWithServiceResponseAsync(location, publisherName, offer).map(new Func1<ServiceResponse<List<VirtualMachineImageResourceInner>>, List<VirtualMachineImageResourceInner>>() { @Override public List<VirtualMachineImageResourceInner> call(ServiceResponse<List<VirtualMachineImageResourceInner>> response) { return response.body(); } }); }
java
public Observable<List<VirtualMachineImageResourceInner>> listSkusAsync(String location, String publisherName, String offer) { return listSkusWithServiceResponseAsync(location, publisherName, offer).map(new Func1<ServiceResponse<List<VirtualMachineImageResourceInner>>, List<VirtualMachineImageResourceInner>>() { @Override public List<VirtualMachineImageResourceInner> call(ServiceResponse<List<VirtualMachineImageResourceInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "VirtualMachineImageResourceInner", ">", ">", "listSkusAsync", "(", "String", "location", ",", "String", "publisherName", ",", "String", "offer", ")", "{", "return", "listSkusWithServiceResponseAsync", "(", "location", ",", "publisherName", ",", "offer", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "VirtualMachineImageResourceInner", ">", ">", ",", "List", "<", "VirtualMachineImageResourceInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "VirtualMachineImageResourceInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "VirtualMachineImageResourceInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. @param location The name of a supported Azure region. @param publisherName A valid image publisher. @param offer A valid image publisher offer. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;VirtualMachineImageResourceInner&gt; object
[ "Gets", "a", "list", "of", "virtual", "machine", "image", "SKUs", "for", "the", "specified", "location", "publisher", "and", "offer", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImagesInner.java#L595-L602
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/cache/Cache.java
Cache.putInCacheNotLocked
@MustBeLocked (ELockType.WRITE) protected final void putInCacheNotLocked (@Nonnull final KEYTYPE aKey, @Nonnull final VALUETYPE aValue) { """ Put a new value into the cache. @param aKey The cache key. May not be <code>null</code>. @param aValue The cache value. May not be <code>null</code>. """ ValueEnforcer.notNull (aKey, "cacheKey"); ValueEnforcer.notNull (aValue, "cacheValue"); // try again in write lock if (m_aCache == null) { // Create a new map to cache the objects m_aCache = createCache (); if (m_aCache == null) throw new IllegalStateException ("No cache created!"); } m_aCache.put (aKey, aValue); }
java
@MustBeLocked (ELockType.WRITE) protected final void putInCacheNotLocked (@Nonnull final KEYTYPE aKey, @Nonnull final VALUETYPE aValue) { ValueEnforcer.notNull (aKey, "cacheKey"); ValueEnforcer.notNull (aValue, "cacheValue"); // try again in write lock if (m_aCache == null) { // Create a new map to cache the objects m_aCache = createCache (); if (m_aCache == null) throw new IllegalStateException ("No cache created!"); } m_aCache.put (aKey, aValue); }
[ "@", "MustBeLocked", "(", "ELockType", ".", "WRITE", ")", "protected", "final", "void", "putInCacheNotLocked", "(", "@", "Nonnull", "final", "KEYTYPE", "aKey", ",", "@", "Nonnull", "final", "VALUETYPE", "aValue", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aKey", ",", "\"cacheKey\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "aValue", ",", "\"cacheValue\"", ")", ";", "// try again in write lock", "if", "(", "m_aCache", "==", "null", ")", "{", "// Create a new map to cache the objects", "m_aCache", "=", "createCache", "(", ")", ";", "if", "(", "m_aCache", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "\"No cache created!\"", ")", ";", "}", "m_aCache", ".", "put", "(", "aKey", ",", "aValue", ")", ";", "}" ]
Put a new value into the cache. @param aKey The cache key. May not be <code>null</code>. @param aValue The cache value. May not be <code>null</code>.
[ "Put", "a", "new", "value", "into", "the", "cache", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/cache/Cache.java#L140-L155
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java
StringSupport.replaceAll
public static void replaceAll(StringBuffer haystack, String needle, String newNeedle) { """ replaces all occurrences of needle in haystack with newNeedle the input itself is not modified @param haystack input string @param needle string to replace @param newNeedle replacement """ /* if(needle == null || "".equals(needle)) { throw new IllegalArgumentException("string to replace may not be empty"); } int idx = haystack.indexOf(needle); int needleLength = needle.length(); int newNeedleLength = newNeedle.length(); while (idx != -1) { haystack.replace(idx, idx + needleLength, newNeedle); idx = haystack.indexOf(needle, idx + newNeedleLength); }*/ replaceAll(haystack, needle, newNeedle, 0); }
java
public static void replaceAll(StringBuffer haystack, String needle, String newNeedle) { /* if(needle == null || "".equals(needle)) { throw new IllegalArgumentException("string to replace may not be empty"); } int idx = haystack.indexOf(needle); int needleLength = needle.length(); int newNeedleLength = newNeedle.length(); while (idx != -1) { haystack.replace(idx, idx + needleLength, newNeedle); idx = haystack.indexOf(needle, idx + newNeedleLength); }*/ replaceAll(haystack, needle, newNeedle, 0); }
[ "public", "static", "void", "replaceAll", "(", "StringBuffer", "haystack", ",", "String", "needle", ",", "String", "newNeedle", ")", "{", "/*\t\tif(needle == null || \"\".equals(needle))\n\t\t{\n\t\t\tthrow new IllegalArgumentException(\"string to replace may not be empty\");\n\t\t}\n\t\tint idx = haystack.indexOf(needle);\n\t\tint needleLength = needle.length();\n\t\tint newNeedleLength = newNeedle.length();\n\t\twhile (idx != -1)\n\t\t{\n\t\t\thaystack.replace(idx, idx + needleLength, newNeedle);\n\t\t\tidx = haystack.indexOf(needle, idx + newNeedleLength);\n\t\t}*/", "replaceAll", "(", "haystack", ",", "needle", ",", "newNeedle", ",", "0", ")", ";", "}" ]
replaces all occurrences of needle in haystack with newNeedle the input itself is not modified @param haystack input string @param needle string to replace @param newNeedle replacement
[ "replaces", "all", "occurrences", "of", "needle", "in", "haystack", "with", "newNeedle", "the", "input", "itself", "is", "not", "modified" ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L141-L155
lucee/Lucee
core/src/main/java/lucee/runtime/converter/JSConverter.java
JSConverter._serializeQuery
private void _serializeQuery(String name, Query query, StringBuilder sb, Set<Object> done) throws ConverterException { """ serialize a Query @param query Query to serialize @param done @return serialized query @throws ConverterException """ if (useWDDX) _serializeWDDXQuery(name, query, sb, done); else _serializeASQuery(name, query, sb, done); }
java
private void _serializeQuery(String name, Query query, StringBuilder sb, Set<Object> done) throws ConverterException { if (useWDDX) _serializeWDDXQuery(name, query, sb, done); else _serializeASQuery(name, query, sb, done); }
[ "private", "void", "_serializeQuery", "(", "String", "name", ",", "Query", "query", ",", "StringBuilder", "sb", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "if", "(", "useWDDX", ")", "_serializeWDDXQuery", "(", "name", ",", "query", ",", "sb", ",", "done", ")", ";", "else", "_serializeASQuery", "(", "name", ",", "query", ",", "sb", ",", "done", ")", ";", "}" ]
serialize a Query @param query Query to serialize @param done @return serialized query @throws ConverterException
[ "serialize", "a", "Query" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/JSConverter.java#L267-L270
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java
URLConnectionTools.getInputStream
public static InputStream getInputStream(URL url, int timeout) throws IOException { """ Connect to server and return result as an InputStream. always asks for response to be in GZIP encoded <p> The caller is responsible to close the returned InputStream not to cause resource leaks. @param url the URL to connect to @param timeout the timeout for the connection @return an {@link InputStream} of response @throws IOException due to an error opening the URL """ return getInputStream(url,true, timeout); }
java
public static InputStream getInputStream(URL url, int timeout) throws IOException { return getInputStream(url,true, timeout); }
[ "public", "static", "InputStream", "getInputStream", "(", "URL", "url", ",", "int", "timeout", ")", "throws", "IOException", "{", "return", "getInputStream", "(", "url", ",", "true", ",", "timeout", ")", ";", "}" ]
Connect to server and return result as an InputStream. always asks for response to be in GZIP encoded <p> The caller is responsible to close the returned InputStream not to cause resource leaks. @param url the URL to connect to @param timeout the timeout for the connection @return an {@link InputStream} of response @throws IOException due to an error opening the URL
[ "Connect", "to", "server", "and", "return", "result", "as", "an", "InputStream", ".", "always", "asks", "for", "response", "to", "be", "in", "GZIP", "encoded", "<p", ">", "The", "caller", "is", "responsible", "to", "close", "the", "returned", "InputStream", "not", "to", "cause", "resource", "leaks", ".", "@param", "url", "the", "URL", "to", "connect", "to", "@param", "timeout", "the", "timeout", "for", "the", "connection", "@return", "an", "{", "@link", "InputStream", "}", "of", "response", "@throws", "IOException", "due", "to", "an", "error", "opening", "the", "URL" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java#L91-L94
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dictionary/CoreBiGramTableDictionary.java
CoreBiGramTableDictionary.binarySearch
private static int binarySearch(int[] a, int fromIndex, int length, int key) { """ 二分搜索,由于二元接续前一个词固定时,后一个词比较少,所以二分也能取得很高的性能 @param a 目标数组 @param fromIndex 开始下标 @param length 长度 @param key 词的id @return 共现频次 """ int low = fromIndex; int high = fromIndex + length - 1; while (low <= high) { int mid = (low + high) >>> 1; int midVal = a[mid << 1]; if (midVal < key) low = mid + 1; else if (midVal > key) high = mid - 1; else return mid; // key found } return -(low + 1); // key not found. }
java
private static int binarySearch(int[] a, int fromIndex, int length, int key) { int low = fromIndex; int high = fromIndex + length - 1; while (low <= high) { int mid = (low + high) >>> 1; int midVal = a[mid << 1]; if (midVal < key) low = mid + 1; else if (midVal > key) high = mid - 1; else return mid; // key found } return -(low + 1); // key not found. }
[ "private", "static", "int", "binarySearch", "(", "int", "[", "]", "a", ",", "int", "fromIndex", ",", "int", "length", ",", "int", "key", ")", "{", "int", "low", "=", "fromIndex", ";", "int", "high", "=", "fromIndex", "+", "length", "-", "1", ";", "while", "(", "low", "<=", "high", ")", "{", "int", "mid", "=", "(", "low", "+", "high", ")", ">>>", "1", ";", "int", "midVal", "=", "a", "[", "mid", "<<", "1", "]", ";", "if", "(", "midVal", "<", "key", ")", "low", "=", "mid", "+", "1", ";", "else", "if", "(", "midVal", ">", "key", ")", "high", "=", "mid", "-", "1", ";", "else", "return", "mid", ";", "// key found", "}", "return", "-", "(", "low", "+", "1", ")", ";", "// key not found.", "}" ]
二分搜索,由于二元接续前一个词固定时,后一个词比较少,所以二分也能取得很高的性能 @param a 目标数组 @param fromIndex 开始下标 @param length 长度 @param key 词的id @return 共现频次
[ "二分搜索,由于二元接续前一个词固定时,后一个词比较少,所以二分也能取得很高的性能" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CoreBiGramTableDictionary.java#L218-L236
threerings/nenya
core/src/main/java/com/threerings/openal/SoundGroup.java
SoundGroup.getSound
public Sound getSound (String path) { """ Obtains an "instance" of the specified sound which can be positioned, played, looped and otherwise used to make noise. """ ClipBuffer buffer = null; if (_manager.isInitialized()) { buffer = _manager.getClip(_provider, path); } return (buffer == null) ? new BlankSound() : new Sound(this, buffer); }
java
public Sound getSound (String path) { ClipBuffer buffer = null; if (_manager.isInitialized()) { buffer = _manager.getClip(_provider, path); } return (buffer == null) ? new BlankSound() : new Sound(this, buffer); }
[ "public", "Sound", "getSound", "(", "String", "path", ")", "{", "ClipBuffer", "buffer", "=", "null", ";", "if", "(", "_manager", ".", "isInitialized", "(", ")", ")", "{", "buffer", "=", "_manager", ".", "getClip", "(", "_provider", ",", "path", ")", ";", "}", "return", "(", "buffer", "==", "null", ")", "?", "new", "BlankSound", "(", ")", ":", "new", "Sound", "(", "this", ",", "buffer", ")", ";", "}" ]
Obtains an "instance" of the specified sound which can be positioned, played, looped and otherwise used to make noise.
[ "Obtains", "an", "instance", "of", "the", "specified", "sound", "which", "can", "be", "positioned", "played", "looped", "and", "otherwise", "used", "to", "make", "noise", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/SoundGroup.java#L69-L76
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java
CoreRemoteMongoCollectionImpl.findOneAndReplace
public DocumentT findOneAndReplace(final Bson filter, final Bson replacement) { """ Finds a document in the collection and replaces it with the given document @param filter the query filter @param replacement the document to replace the matched document with @return the resulting document """ return operations.findOneAndModify( "findOneAndReplace", filter, replacement, new RemoteFindOneAndModifyOptions(), documentClass).execute(service); }
java
public DocumentT findOneAndReplace(final Bson filter, final Bson replacement) { return operations.findOneAndModify( "findOneAndReplace", filter, replacement, new RemoteFindOneAndModifyOptions(), documentClass).execute(service); }
[ "public", "DocumentT", "findOneAndReplace", "(", "final", "Bson", "filter", ",", "final", "Bson", "replacement", ")", "{", "return", "operations", ".", "findOneAndModify", "(", "\"findOneAndReplace\"", ",", "filter", ",", "replacement", ",", "new", "RemoteFindOneAndModifyOptions", "(", ")", ",", "documentClass", ")", ".", "execute", "(", "service", ")", ";", "}" ]
Finds a document in the collection and replaces it with the given document @param filter the query filter @param replacement the document to replace the matched document with @return the resulting document
[ "Finds", "a", "document", "in", "the", "collection", "and", "replaces", "it", "with", "the", "given", "document" ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java#L542-L549
eBay/parallec
src/main/java/io/parallec/core/util/PcStringUtils.java
PcStringUtils.getAggregatedResultHuman
public static String getAggregatedResultHuman(Map<String, LinkedHashSet<String>> aggregateResultMap) { """ Get the aggregated result human readable string for easy display. @param aggregateResultMap the aggregate result map @return the aggregated result human """ StringBuilder res = new StringBuilder(); for (Entry<String, LinkedHashSet<String>> entry : aggregateResultMap .entrySet()) { LinkedHashSet<String> valueSet = entry.getValue(); res.append("[" + entry.getKey() + " COUNT: " +valueSet.size() + " ]:\n"); for(String str: valueSet){ res.append("\t" + str + "\n"); } res.append("###################################\n\n"); } return res.toString(); }
java
public static String getAggregatedResultHuman(Map<String, LinkedHashSet<String>> aggregateResultMap){ StringBuilder res = new StringBuilder(); for (Entry<String, LinkedHashSet<String>> entry : aggregateResultMap .entrySet()) { LinkedHashSet<String> valueSet = entry.getValue(); res.append("[" + entry.getKey() + " COUNT: " +valueSet.size() + " ]:\n"); for(String str: valueSet){ res.append("\t" + str + "\n"); } res.append("###################################\n\n"); } return res.toString(); }
[ "public", "static", "String", "getAggregatedResultHuman", "(", "Map", "<", "String", ",", "LinkedHashSet", "<", "String", ">", ">", "aggregateResultMap", ")", "{", "StringBuilder", "res", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "LinkedHashSet", "<", "String", ">", ">", "entry", ":", "aggregateResultMap", ".", "entrySet", "(", ")", ")", "{", "LinkedHashSet", "<", "String", ">", "valueSet", "=", "entry", ".", "getValue", "(", ")", ";", "res", ".", "append", "(", "\"[\"", "+", "entry", ".", "getKey", "(", ")", "+", "\" COUNT: \"", "+", "valueSet", ".", "size", "(", ")", "+", "\" ]:\\n\"", ")", ";", "for", "(", "String", "str", ":", "valueSet", ")", "{", "res", ".", "append", "(", "\"\\t\"", "+", "str", "+", "\"\\n\"", ")", ";", "}", "res", ".", "append", "(", "\"###################################\\n\\n\"", ")", ";", "}", "return", "res", ".", "toString", "(", ")", ";", "}" ]
Get the aggregated result human readable string for easy display. @param aggregateResultMap the aggregate result map @return the aggregated result human
[ "Get", "the", "aggregated", "result", "human", "readable", "string", "for", "easy", "display", "." ]
train
https://github.com/eBay/parallec/blob/1b4f1628f34fedfb06b24c33a5372d64d3df0952/src/main/java/io/parallec/core/util/PcStringUtils.java#L76-L92
phax/ph-commons
ph-matrix/src/main/java/com/helger/matrix/QRDecomposition.java
QRDecomposition.getH
@Nonnull @ReturnsMutableCopy public Matrix getH () { """ Return the Householder vectors @return Lower trapezoidal matrix whose columns define the reflections """ final Matrix aNewMatrix = new Matrix (m_nRows, m_nCols); final double [] [] aNewArray = aNewMatrix.internalGetArray (); for (int nRow = 0; nRow < m_nRows; nRow++) { final double [] aSrcRow = m_aQR[nRow]; final double [] aDstRow = aNewArray[nRow]; for (int nCol = 0; nCol < m_nCols; nCol++) { aDstRow[nCol] = (nRow >= nCol ? aSrcRow[nCol] : 0d); } } return aNewMatrix; }
java
@Nonnull @ReturnsMutableCopy public Matrix getH () { final Matrix aNewMatrix = new Matrix (m_nRows, m_nCols); final double [] [] aNewArray = aNewMatrix.internalGetArray (); for (int nRow = 0; nRow < m_nRows; nRow++) { final double [] aSrcRow = m_aQR[nRow]; final double [] aDstRow = aNewArray[nRow]; for (int nCol = 0; nCol < m_nCols; nCol++) { aDstRow[nCol] = (nRow >= nCol ? aSrcRow[nCol] : 0d); } } return aNewMatrix; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "Matrix", "getH", "(", ")", "{", "final", "Matrix", "aNewMatrix", "=", "new", "Matrix", "(", "m_nRows", ",", "m_nCols", ")", ";", "final", "double", "[", "]", "[", "]", "aNewArray", "=", "aNewMatrix", ".", "internalGetArray", "(", ")", ";", "for", "(", "int", "nRow", "=", "0", ";", "nRow", "<", "m_nRows", ";", "nRow", "++", ")", "{", "final", "double", "[", "]", "aSrcRow", "=", "m_aQR", "[", "nRow", "]", ";", "final", "double", "[", "]", "aDstRow", "=", "aNewArray", "[", "nRow", "]", ";", "for", "(", "int", "nCol", "=", "0", ";", "nCol", "<", "m_nCols", ";", "nCol", "++", ")", "{", "aDstRow", "[", "nCol", "]", "=", "(", "nRow", ">=", "nCol", "?", "aSrcRow", "[", "nCol", "]", ":", "0d", ")", ";", "}", "}", "return", "aNewMatrix", ";", "}" ]
Return the Householder vectors @return Lower trapezoidal matrix whose columns define the reflections
[ "Return", "the", "Householder", "vectors" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-matrix/src/main/java/com/helger/matrix/QRDecomposition.java#L142-L158
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml5Xml
public static void escapeHtml5Xml(final char[] text, final int offset, final int len, final Writer writer) throws IOException { """ <p> Perform an HTML5 level 1 (XML-style) <strong>escape</strong> operation on a <tt>char[]</tt> input. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. It is called <em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's <tt>&lt;c:out ... /&gt;</tt> tags. </p> <p> Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml4Xml(char[], int, int, java.io.Writer)} because it will escape the apostrophe as <tt>&amp;apos;</tt>, whereas in HTML 4 such NCR does not exist (the decimal numeric reference <tt>&amp;#39;</tt> is used instead). </p> <p> This method calls {@link #escapeHtml(char[], int, int, java.io.Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs """ escapeHtml(text, offset, len, writer, HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeHtml5Xml(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeHtml(text, offset, len, writer, HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeHtml5Xml", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeHtml", "(", "text", ",", "offset", ",", "len", ",", "writer", ",", "HtmlEscapeType", ".", "HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", ",", "HtmlEscapeLevel", ".", "LEVEL_1_ONLY_MARKUP_SIGNIFICANT", ")", ";", "}" ]
<p> Perform an HTML5 level 1 (XML-style) <strong>escape</strong> operation on a <tt>char[]</tt> input. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. It is called <em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's <tt>&lt;c:out ... /&gt;</tt> tags. </p> <p> Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml4Xml(char[], int, int, java.io.Writer)} because it will escape the apostrophe as <tt>&amp;apos;</tt>, whereas in HTML 4 such NCR does not exist (the decimal numeric reference <tt>&amp;#39;</tt> is used instead). </p> <p> This method calls {@link #escapeHtml(char[], int, int, java.io.Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "an", "HTML5", "level", "1", "(", "XML", "-", "style", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "1<", "/", "em", ">", "means", "this", "method", "will", "only", "escape", "the", "five", "markup", "-", "significant", "characters", ":", "<tt", ">", "&lt", ";", "<", "/", "tt", ">", "<tt", ">", "&gt", ";", "<", "/", "tt", ">", "<tt", ">", "&amp", ";", "<", "/", "tt", ">", "<tt", ">", "&quot", ";", "<", "/", "tt", ">", "and", "<tt", ">", "&#39", ";", "<", "/", "tt", ">", ".", "It", "is", "called", "<em", ">", "XML", "-", "style<", "/", "em", ">", "in", "order", "to", "link", "it", "with", "JSP", "s", "<tt", ">", "escapeXml<", "/", "tt", ">", "attribute", "in", "JSTL", "s", "<tt", ">", "&lt", ";", "c", ":", "out", "...", "/", "&gt", ";", "<", "/", "tt", ">", "tags", ".", "<", "/", "p", ">", "<p", ">", "Note", "this", "method", "may", "<strong", ">", "not<", "/", "strong", ">", "produce", "the", "same", "results", "as", "{", "@link", "#escapeHtml4Xml", "(", "char", "[]", "int", "int", "java", ".", "io", ".", "Writer", ")", "}", "because", "it", "will", "escape", "the", "apostrophe", "as", "<tt", ">", "&amp", ";", "apos", ";", "<", "/", "tt", ">", "whereas", "in", "HTML", "4", "such", "NCR", "does", "not", "exist", "(", "the", "decimal", "numeric", "reference", "<tt", ">", "&amp", ";", "#39", ";", "<", "/", "tt", ">", "is", "used", "instead", ")", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapeHtml", "(", "char", "[]", "int", "int", "java", ".", "io", ".", "Writer", "HtmlEscapeType", "HtmlEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "type<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "html", ".", "HtmlEscapeType#HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", "}", "<", "/", "li", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "html", ".", "HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L912-L916
autermann/yaml
src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java
YamlMappingNode.put
public T put(YamlNode key, Double value) { """ Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this} """ return put(key, getNodeFactory().doubleNode(value)); }
java
public T put(YamlNode key, Double value) { return put(key, getNodeFactory().doubleNode(value)); }
[ "public", "T", "put", "(", "YamlNode", "key", ",", "Double", "value", ")", "{", "return", "put", "(", "key", ",", "getNodeFactory", "(", ")", ".", "doubleNode", "(", "value", ")", ")", ";", "}" ]
Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this}
[ "Adds", "the", "specified", "{", "@code", "key", "}", "/", "{", "@code", "value", "}", "pair", "to", "this", "mapping", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L660-L662
aws/aws-sdk-java
aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/CreateQueueRequest.java
CreateQueueRequest.withTags
public CreateQueueRequest withTags(java.util.Map<String, String> tags) { """ The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @param tags The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateQueueRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateQueueRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @param tags The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @return Returns a reference to this object so that method calls can be chained together.
[ "The", "tags", "that", "you", "want", "to", "add", "to", "the", "resource", ".", "You", "can", "tag", "resources", "with", "a", "key", "-", "value", "pair", "or", "with", "only", "a", "key", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/CreateQueueRequest.java#L262-L265
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/dialogs/ListSelectDialog.java
ListSelectDialog.showDialog
public static <T> T showDialog(WindowBasedTextGUI textGUI, String title, String description, TerminalSize listBoxSize, T... items) { """ Shortcut for quickly creating a new dialog @param textGUI Text GUI to add the dialog to @param title Title of the dialog @param description Description of the dialog @param listBoxSize Maximum size of the list box, scrollbars will be used if the items cannot fit @param items Items in the dialog @param <T> Type of items in the dialog @return The selected item or {@code null} if cancelled """ ListSelectDialog<T> listSelectDialog = new ListSelectDialogBuilder<T>() .setTitle(title) .setDescription(description) .setListBoxSize(listBoxSize) .addListItems(items) .build(); return listSelectDialog.showDialog(textGUI); }
java
public static <T> T showDialog(WindowBasedTextGUI textGUI, String title, String description, TerminalSize listBoxSize, T... items) { ListSelectDialog<T> listSelectDialog = new ListSelectDialogBuilder<T>() .setTitle(title) .setDescription(description) .setListBoxSize(listBoxSize) .addListItems(items) .build(); return listSelectDialog.showDialog(textGUI); }
[ "public", "static", "<", "T", ">", "T", "showDialog", "(", "WindowBasedTextGUI", "textGUI", ",", "String", "title", ",", "String", "description", ",", "TerminalSize", "listBoxSize", ",", "T", "...", "items", ")", "{", "ListSelectDialog", "<", "T", ">", "listSelectDialog", "=", "new", "ListSelectDialogBuilder", "<", "T", ">", "(", ")", ".", "setTitle", "(", "title", ")", ".", "setDescription", "(", "description", ")", ".", "setListBoxSize", "(", "listBoxSize", ")", ".", "addListItems", "(", "items", ")", ".", "build", "(", ")", ";", "return", "listSelectDialog", ".", "showDialog", "(", "textGUI", ")", ";", "}" ]
Shortcut for quickly creating a new dialog @param textGUI Text GUI to add the dialog to @param title Title of the dialog @param description Description of the dialog @param listBoxSize Maximum size of the list box, scrollbars will be used if the items cannot fit @param items Items in the dialog @param <T> Type of items in the dialog @return The selected item or {@code null} if cancelled
[ "Shortcut", "for", "quickly", "creating", "a", "new", "dialog" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/ListSelectDialog.java#L161-L169
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java
TypeConverter.convertToByte
public static byte convertToByte (@Nullable final Object aSrcValue, final byte nDefault) { """ Convert the passed source value to byte @param aSrcValue The source value. May be <code>null</code>. @param nDefault The default value to be returned if an error occurs during type conversion. @return The converted value. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch """ final Byte aValue = convert (aSrcValue, Byte.class, null); return aValue == null ? nDefault : aValue.byteValue (); }
java
public static byte convertToByte (@Nullable final Object aSrcValue, final byte nDefault) { final Byte aValue = convert (aSrcValue, Byte.class, null); return aValue == null ? nDefault : aValue.byteValue (); }
[ "public", "static", "byte", "convertToByte", "(", "@", "Nullable", "final", "Object", "aSrcValue", ",", "final", "byte", "nDefault", ")", "{", "final", "Byte", "aValue", "=", "convert", "(", "aSrcValue", ",", "Byte", ".", "class", ",", "null", ")", ";", "return", "aValue", "==", "null", "?", "nDefault", ":", "aValue", ".", "byteValue", "(", ")", ";", "}" ]
Convert the passed source value to byte @param aSrcValue The source value. May be <code>null</code>. @param nDefault The default value to be returned if an error occurs during type conversion. @return The converted value. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch
[ "Convert", "the", "passed", "source", "value", "to", "byte" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L175-L179
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectRayAab
public static boolean intersectRayAab(Vector3fc origin, Vector3fc dir, Vector3fc min, Vector3fc max, Vector2f result) { """ Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the axis-aligned box specified as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection.. <p> This method returns <code>true</code> for a ray whose origin lies inside the axis-aligned box. <p> If many boxes need to be tested against the same ray, then the {@link RayAabIntersection} class is likely more efficient. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> @see #intersectRayAab(float, float, float, float, float, float, float, float, float, float, float, float, Vector2f) @see RayAabIntersection @param origin the ray's origin @param dir the ray's direction @param min the minimum corner of the axis-aligned box @param max the maximum corner of the axis-aligned box @param result a vector which will hold the resulting values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection iff the ray intersects the axis-aligned box @return <code>true</code> if the given ray intersects the axis-aligned box; <code>false</code> otherwise """ return intersectRayAab(origin.x(), origin.y(), origin.z(), dir.x(), dir.y(), dir.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result); }
java
public static boolean intersectRayAab(Vector3fc origin, Vector3fc dir, Vector3fc min, Vector3fc max, Vector2f result) { return intersectRayAab(origin.x(), origin.y(), origin.z(), dir.x(), dir.y(), dir.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result); }
[ "public", "static", "boolean", "intersectRayAab", "(", "Vector3fc", "origin", ",", "Vector3fc", "dir", ",", "Vector3fc", "min", ",", "Vector3fc", "max", ",", "Vector2f", "result", ")", "{", "return", "intersectRayAab", "(", "origin", ".", "x", "(", ")", ",", "origin", ".", "y", "(", ")", ",", "origin", ".", "z", "(", ")", ",", "dir", ".", "x", "(", ")", ",", "dir", ".", "y", "(", ")", ",", "dir", ".", "z", "(", ")", ",", "min", ".", "x", "(", ")", ",", "min", ".", "y", "(", ")", ",", "min", ".", "z", "(", ")", ",", "max", ".", "x", "(", ")", ",", "max", ".", "y", "(", ")", ",", "max", ".", "z", "(", ")", ",", "result", ")", ";", "}" ]
Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the axis-aligned box specified as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection.. <p> This method returns <code>true</code> for a ray whose origin lies inside the axis-aligned box. <p> If many boxes need to be tested against the same ray, then the {@link RayAabIntersection} class is likely more efficient. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> @see #intersectRayAab(float, float, float, float, float, float, float, float, float, float, float, float, Vector2f) @see RayAabIntersection @param origin the ray's origin @param dir the ray's direction @param min the minimum corner of the axis-aligned box @param max the maximum corner of the axis-aligned box @param result a vector which will hold the resulting values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection iff the ray intersects the axis-aligned box @return <code>true</code> if the given ray intersects the axis-aligned box; <code>false</code> otherwise
[ "Test", "whether", "the", "ray", "with", "the", "given", "<code", ">", "origin<", "/", "code", ">", "and", "direction", "<code", ">", "dir<", "/", "code", ">", "intersects", "the", "axis", "-", "aligned", "box", "specified", "as", "its", "minimum", "corner", "<code", ">", "min<", "/", "code", ">", "and", "maximum", "corner", "<code", ">", "max<", "/", "code", ">", "and", "return", "the", "values", "of", "the", "parameter", "<i", ">", "t<", "/", "i", ">", "in", "the", "ray", "equation", "<i", ">", "p", "(", "t", ")", "=", "origin", "+", "t", "*", "dir<", "/", "i", ">", "of", "the", "near", "and", "far", "point", "of", "intersection", "..", "<p", ">", "This", "method", "returns", "<code", ">", "true<", "/", "code", ">", "for", "a", "ray", "whose", "origin", "lies", "inside", "the", "axis", "-", "aligned", "box", ".", "<p", ">", "If", "many", "boxes", "need", "to", "be", "tested", "against", "the", "same", "ray", "then", "the", "{", "@link", "RayAabIntersection", "}", "class", "is", "likely", "more", "efficient", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "https", ":", "//", "dl", ".", "acm", ".", "org", "/", "citation", ".", "cfm?id", "=", "1198748", ">", "An", "Efficient", "and", "Robust", "Ray–Box", "Intersection<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L2411-L2413
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java
ContextItems.setItem
public void setItem(String itemName, String value) { """ Sets a context item value. @param itemName Item name @param value Item value """ itemName = lookupItemName(itemName, value != null); if (value == null) { items.remove(itemName); index.remove(itemName.toLowerCase()); } else { items.put(itemName, value); } }
java
public void setItem(String itemName, String value) { itemName = lookupItemName(itemName, value != null); if (value == null) { items.remove(itemName); index.remove(itemName.toLowerCase()); } else { items.put(itemName, value); } }
[ "public", "void", "setItem", "(", "String", "itemName", ",", "String", "value", ")", "{", "itemName", "=", "lookupItemName", "(", "itemName", ",", "value", "!=", "null", ")", ";", "if", "(", "value", "==", "null", ")", "{", "items", ".", "remove", "(", "itemName", ")", ";", "index", ".", "remove", "(", "itemName", ".", "toLowerCase", "(", ")", ")", ";", "}", "else", "{", "items", ".", "put", "(", "itemName", ",", "value", ")", ";", "}", "}" ]
Sets a context item value. @param itemName Item name @param value Item value
[ "Sets", "a", "context", "item", "value", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L232-L241
knightliao/disconf
disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java
StringUtil.toCamelCase
public static String toCamelCase(String str) { """ 将字符串转换成camel case。 <p> 如果字符串是<code>null</code>则返回<code>null</code>。 <p/> <p/> <pre> StringUtil.toCamelCase(null) = null StringUtil.toCamelCase("") = "" StringUtil.toCamelCase("aBc") = "aBc" StringUtil.toCamelCase("aBc def") = "aBcDef" StringUtil.toCamelCase("aBc def_ghi") = "aBcDefGhi" StringUtil.toCamelCase("aBc def_ghi 123") = "aBcDefGhi123" </pre> <p/> </p> <p> 此方法会保留除了下划线和空白以外的所有分隔符。 </p> @param str 要转换的字符串 @return camel case字符串,如果原字符串为<code>null</code>,则返回<code>null</code> """ return new WordTokenizer() { @Override protected void startSentence(StringBuilder buffer, char ch) { buffer.append(Character.toLowerCase(ch)); } @Override protected void startWord(StringBuilder buffer, char ch) { if (!isDelimiter(buffer.charAt(buffer.length() - 1))) { buffer.append(Character.toUpperCase(ch)); } else { buffer.append(Character.toLowerCase(ch)); } } @Override protected void inWord(StringBuilder buffer, char ch) { buffer.append(Character.toLowerCase(ch)); } @Override protected void startDigitSentence(StringBuilder buffer, char ch) { buffer.append(ch); } @Override protected void startDigitWord(StringBuilder buffer, char ch) { buffer.append(ch); } @Override protected void inDigitWord(StringBuilder buffer, char ch) { buffer.append(ch); } @Override protected void inDelimiter(StringBuilder buffer, char ch) { if (ch != UNDERSCORE) { buffer.append(ch); } } }.parse(str); }
java
public static String toCamelCase(String str) { return new WordTokenizer() { @Override protected void startSentence(StringBuilder buffer, char ch) { buffer.append(Character.toLowerCase(ch)); } @Override protected void startWord(StringBuilder buffer, char ch) { if (!isDelimiter(buffer.charAt(buffer.length() - 1))) { buffer.append(Character.toUpperCase(ch)); } else { buffer.append(Character.toLowerCase(ch)); } } @Override protected void inWord(StringBuilder buffer, char ch) { buffer.append(Character.toLowerCase(ch)); } @Override protected void startDigitSentence(StringBuilder buffer, char ch) { buffer.append(ch); } @Override protected void startDigitWord(StringBuilder buffer, char ch) { buffer.append(ch); } @Override protected void inDigitWord(StringBuilder buffer, char ch) { buffer.append(ch); } @Override protected void inDelimiter(StringBuilder buffer, char ch) { if (ch != UNDERSCORE) { buffer.append(ch); } } }.parse(str); }
[ "public", "static", "String", "toCamelCase", "(", "String", "str", ")", "{", "return", "new", "WordTokenizer", "(", ")", "{", "@", "Override", "protected", "void", "startSentence", "(", "StringBuilder", "buffer", ",", "char", "ch", ")", "{", "buffer", ".", "append", "(", "Character", ".", "toLowerCase", "(", "ch", ")", ")", ";", "}", "@", "Override", "protected", "void", "startWord", "(", "StringBuilder", "buffer", ",", "char", "ch", ")", "{", "if", "(", "!", "isDelimiter", "(", "buffer", ".", "charAt", "(", "buffer", ".", "length", "(", ")", "-", "1", ")", ")", ")", "{", "buffer", ".", "append", "(", "Character", ".", "toUpperCase", "(", "ch", ")", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "Character", ".", "toLowerCase", "(", "ch", ")", ")", ";", "}", "}", "@", "Override", "protected", "void", "inWord", "(", "StringBuilder", "buffer", ",", "char", "ch", ")", "{", "buffer", ".", "append", "(", "Character", ".", "toLowerCase", "(", "ch", ")", ")", ";", "}", "@", "Override", "protected", "void", "startDigitSentence", "(", "StringBuilder", "buffer", ",", "char", "ch", ")", "{", "buffer", ".", "append", "(", "ch", ")", ";", "}", "@", "Override", "protected", "void", "startDigitWord", "(", "StringBuilder", "buffer", ",", "char", "ch", ")", "{", "buffer", ".", "append", "(", "ch", ")", ";", "}", "@", "Override", "protected", "void", "inDigitWord", "(", "StringBuilder", "buffer", ",", "char", "ch", ")", "{", "buffer", ".", "append", "(", "ch", ")", ";", "}", "@", "Override", "protected", "void", "inDelimiter", "(", "StringBuilder", "buffer", ",", "char", "ch", ")", "{", "if", "(", "ch", "!=", "UNDERSCORE", ")", "{", "buffer", ".", "append", "(", "ch", ")", ";", "}", "}", "}", ".", "parse", "(", "str", ")", ";", "}" ]
将字符串转换成camel case。 <p> 如果字符串是<code>null</code>则返回<code>null</code>。 <p/> <p/> <pre> StringUtil.toCamelCase(null) = null StringUtil.toCamelCase("") = "" StringUtil.toCamelCase("aBc") = "aBc" StringUtil.toCamelCase("aBc def") = "aBcDef" StringUtil.toCamelCase("aBc def_ghi") = "aBcDefGhi" StringUtil.toCamelCase("aBc def_ghi 123") = "aBcDefGhi123" </pre> <p/> </p> <p> 此方法会保留除了下划线和空白以外的所有分隔符。 </p> @param str 要转换的字符串 @return camel case字符串,如果原字符串为<code>null</code>,则返回<code>null</code>
[ "将字符串转换成camel", "case。", "<p", ">", "如果字符串是<code", ">", "null<", "/", "code", ">", "则返回<code", ">", "null<", "/", "code", ">", "。", "<p", "/", ">", "<p", "/", ">", "<pre", ">", "StringUtil", ".", "toCamelCase", "(", "null", ")", "=", "null", "StringUtil", ".", "toCamelCase", "(", ")", "=", "StringUtil", ".", "toCamelCase", "(", "aBc", ")", "=", "aBc", "StringUtil", ".", "toCamelCase", "(", "aBc", "def", ")", "=", "aBcDef", "StringUtil", ".", "toCamelCase", "(", "aBc", "def_ghi", ")", "=", "aBcDefGhi", "StringUtil", ".", "toCamelCase", "(", "aBc", "def_ghi", "123", ")", "=", "aBcDefGhi123", "<", "/", "pre", ">", "<p", "/", ">", "<", "/", "p", ">", "<p", ">", "此方法会保留除了下划线和空白以外的所有分隔符。", "<", "/", "p", ">" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java#L167-L210
GistLabs/mechanize
src/main/java/com/gistlabs/mechanize/requestor/RequestBuilder.java
RequestBuilder.set
public RequestBuilder<Resource> set(final String name, final File file) { """ Adds a file to the request also making the request to become a multi-part post request or removes any file registered under the given name if the file value is null. """ return set(name, file != null ? new FileBody(file) : null); }
java
public RequestBuilder<Resource> set(final String name, final File file) { return set(name, file != null ? new FileBody(file) : null); }
[ "public", "RequestBuilder", "<", "Resource", ">", "set", "(", "final", "String", "name", ",", "final", "File", "file", ")", "{", "return", "set", "(", "name", ",", "file", "!=", "null", "?", "new", "FileBody", "(", "file", ")", ":", "null", ")", ";", "}" ]
Adds a file to the request also making the request to become a multi-part post request or removes any file registered under the given name if the file value is null.
[ "Adds", "a", "file", "to", "the", "request", "also", "making", "the", "request", "to", "become", "a", "multi", "-", "part", "post", "request", "or", "removes", "any", "file", "registered", "under", "the", "given", "name", "if", "the", "file", "value", "is", "null", "." ]
train
https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/requestor/RequestBuilder.java#L127-L129
astrapi69/jaulp-wicket
jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/confirm/YesNoPanel.java
YesNoPanel.newNoButton
protected AjaxButton newNoButton(final String id) { """ Factory method for creating a new no {@link AjaxButton}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a no {@link AjaxButton}. @param id the id @return the new {@link AjaxButton} """ final AjaxButton ajaxButton = new AjaxButton(id) { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { onNo(target, form, true); } @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { onNo(target, form, false); } }; final IModel<String> noLabelModel = ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key("global.no.label").defaultValue("No").build(), this); ajaxButton.add(newLabel("noLabel", noLabelModel)); return ajaxButton; }
java
protected AjaxButton newNoButton(final String id) { final AjaxButton ajaxButton = new AjaxButton(id) { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { onNo(target, form, true); } @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { onNo(target, form, false); } }; final IModel<String> noLabelModel = ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key("global.no.label").defaultValue("No").build(), this); ajaxButton.add(newLabel("noLabel", noLabelModel)); return ajaxButton; }
[ "protected", "AjaxButton", "newNoButton", "(", "final", "String", "id", ")", "{", "final", "AjaxButton", "ajaxButton", "=", "new", "AjaxButton", "(", "id", ")", "{", "/**\n\t\t\t * The serialVersionUID.\n\t\t\t */", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "@", "Override", "protected", "void", "onError", "(", "final", "AjaxRequestTarget", "target", ",", "final", "Form", "<", "?", ">", "form", ")", "{", "onNo", "(", "target", ",", "form", ",", "true", ")", ";", "}", "@", "Override", "protected", "void", "onSubmit", "(", "final", "AjaxRequestTarget", "target", ",", "final", "Form", "<", "?", ">", "form", ")", "{", "onNo", "(", "target", ",", "form", ",", "false", ")", ";", "}", "}", ";", "final", "IModel", "<", "String", ">", "noLabelModel", "=", "ResourceModelFactory", ".", "newResourceModel", "(", "ResourceBundleKey", ".", "builder", "(", ")", ".", "key", "(", "\"global.no.label\"", ")", ".", "defaultValue", "(", "\"No\"", ")", ".", "build", "(", ")", ",", "this", ")", ";", "ajaxButton", ".", "add", "(", "newLabel", "(", "\"noLabel\"", ",", "noLabelModel", ")", ")", ";", "return", "ajaxButton", ";", "}" ]
Factory method for creating a new no {@link AjaxButton}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a no {@link AjaxButton}. @param id the id @return the new {@link AjaxButton}
[ "Factory", "method", "for", "creating", "a", "new", "no", "{", "@link", "AjaxButton", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of", "a", "no", "{", "@link", "AjaxButton", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/confirm/YesNoPanel.java#L96-L121
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java
JAXRSClientConfigImpl.getURI
private String getURI(Map<String, Object> props) { """ find the uri parameter which we will key off of @param props @return value of uri param within props, or null if no uri param """ if (props == null) return null; if (props.keySet().contains(URI)) { return (props.get(URI).toString()); } else { return null; } }
java
private String getURI(Map<String, Object> props) { if (props == null) return null; if (props.keySet().contains(URI)) { return (props.get(URI).toString()); } else { return null; } }
[ "private", "String", "getURI", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "props", "==", "null", ")", "return", "null", ";", "if", "(", "props", ".", "keySet", "(", ")", ".", "contains", "(", "URI", ")", ")", "{", "return", "(", "props", ".", "get", "(", "URI", ")", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
find the uri parameter which we will key off of @param props @return value of uri param within props, or null if no uri param
[ "find", "the", "uri", "parameter", "which", "we", "will", "key", "off", "of" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/clientconfig/JAXRSClientConfigImpl.java#L151-L159
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java
InMemoryLockMapImpl.hasReadLock
public boolean hasReadLock(TransactionImpl tx, Object obj) { """ check if there is a reader lock entry for transaction tx on object obj in the persistent storage. """ checkTimedOutLocks(); Identity oid = new Identity(obj,getBroker()); String oidString = oid.toString(); String txGuid = tx.getGUID(); return hasReadLockInternal(oidString, txGuid); }
java
public boolean hasReadLock(TransactionImpl tx, Object obj) { checkTimedOutLocks(); Identity oid = new Identity(obj,getBroker()); String oidString = oid.toString(); String txGuid = tx.getGUID(); return hasReadLockInternal(oidString, txGuid); }
[ "public", "boolean", "hasReadLock", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "checkTimedOutLocks", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "getBroker", "(", ")", ")", ";", "String", "oidString", "=", "oid", ".", "toString", "(", ")", ";", "String", "txGuid", "=", "tx", ".", "getGUID", "(", ")", ";", "return", "hasReadLockInternal", "(", "oidString", ",", "txGuid", ")", ";", "}" ]
check if there is a reader lock entry for transaction tx on object obj in the persistent storage.
[ "check", "if", "there", "is", "a", "reader", "lock", "entry", "for", "transaction", "tx", "on", "object", "obj", "in", "the", "persistent", "storage", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java#L338-L346
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.geospatialConstraint
public GeospatialConstraintQuery geospatialConstraint(String constraintName, Region... regions) { """ Matches the container specified by the constraint whose geospatial point appears within one of the criteria regions. @param constraintName the constraint definition @param regions the possible regions containing the point @return the StructuredQueryDefinition for the geospatial constraint query """ checkRegions(regions); return new GeospatialConstraintQuery(constraintName, regions); }
java
public GeospatialConstraintQuery geospatialConstraint(String constraintName, Region... regions) { checkRegions(regions); return new GeospatialConstraintQuery(constraintName, regions); }
[ "public", "GeospatialConstraintQuery", "geospatialConstraint", "(", "String", "constraintName", ",", "Region", "...", "regions", ")", "{", "checkRegions", "(", "regions", ")", ";", "return", "new", "GeospatialConstraintQuery", "(", "constraintName", ",", "regions", ")", ";", "}" ]
Matches the container specified by the constraint whose geospatial point appears within one of the criteria regions. @param constraintName the constraint definition @param regions the possible regions containing the point @return the StructuredQueryDefinition for the geospatial constraint query
[ "Matches", "the", "container", "specified", "by", "the", "constraint", "whose", "geospatial", "point", "appears", "within", "one", "of", "the", "criteria", "regions", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L1091-L1094
filestack/filestack-android
filestack/src/main/java/com/filestack/android/internal/Util.java
Util.initializeClient
public static void initializeClient(Config config, String sessionToken) { """ Create the Java SDK client and set a session token. The token maintains cloud auth state. """ // Override returnUrl until introduction of FilestackUi class which will allow to set this // all up manually. Config overridenConfig = new Config(config.getApiKey(), "filestack://done", config.getPolicy(), config.getSignature()); client = new Client(overridenConfig); client.setSessionToken(sessionToken); }
java
public static void initializeClient(Config config, String sessionToken) { // Override returnUrl until introduction of FilestackUi class which will allow to set this // all up manually. Config overridenConfig = new Config(config.getApiKey(), "filestack://done", config.getPolicy(), config.getSignature()); client = new Client(overridenConfig); client.setSessionToken(sessionToken); }
[ "public", "static", "void", "initializeClient", "(", "Config", "config", ",", "String", "sessionToken", ")", "{", "// Override returnUrl until introduction of FilestackUi class which will allow to set this", "// all up manually.", "Config", "overridenConfig", "=", "new", "Config", "(", "config", ".", "getApiKey", "(", ")", ",", "\"filestack://done\"", ",", "config", ".", "getPolicy", "(", ")", ",", "config", ".", "getSignature", "(", ")", ")", ";", "client", "=", "new", "Client", "(", "overridenConfig", ")", ";", "client", ".", "setSessionToken", "(", "sessionToken", ")", ";", "}" ]
Create the Java SDK client and set a session token. The token maintains cloud auth state.
[ "Create", "the", "Java", "SDK", "client", "and", "set", "a", "session", "token", ".", "The", "token", "maintains", "cloud", "auth", "state", "." ]
train
https://github.com/filestack/filestack-android/blob/8dafa1cb5c77542c351d631be0742717b5a9d45d/filestack/src/main/java/com/filestack/android/internal/Util.java#L206-L214
spring-projects/spring-plugin
core/src/main/java/org/springframework/plugin/core/OrderAwarePluginRegistry.java
OrderAwarePluginRegistry.reverse
public OrderAwarePluginRegistry<T, S> reverse() { """ Returns a new {@link OrderAwarePluginRegistry} with the order of the plugins reverted. @return """ List<T> copy = new ArrayList<>(getPlugins()); return of(copy, comparator.reversed()); }
java
public OrderAwarePluginRegistry<T, S> reverse() { List<T> copy = new ArrayList<>(getPlugins()); return of(copy, comparator.reversed()); }
[ "public", "OrderAwarePluginRegistry", "<", "T", ",", "S", ">", "reverse", "(", ")", "{", "List", "<", "T", ">", "copy", "=", "new", "ArrayList", "<>", "(", "getPlugins", "(", ")", ")", ";", "return", "of", "(", "copy", ",", "comparator", ".", "reversed", "(", ")", ")", ";", "}" ]
Returns a new {@link OrderAwarePluginRegistry} with the order of the plugins reverted. @return
[ "Returns", "a", "new", "{", "@link", "OrderAwarePluginRegistry", "}", "with", "the", "order", "of", "the", "plugins", "reverted", "." ]
train
https://github.com/spring-projects/spring-plugin/blob/953d2ce12f05f26444fbb3bf21011f538f729868/core/src/main/java/org/springframework/plugin/core/OrderAwarePluginRegistry.java#L226-L230
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java
XsdAsmVisitor.addVisitorAttributeMethod
private static void addVisitorAttributeMethod(ClassWriter classWriter, XsdAttribute attribute) { """ Adds a specific method for a visitAttribute call. Example: void visitAttributeManifest(String manifestValue){ visitAttribute("manifest", manifestValue); } @param classWriter The ElementVisitor class {@link ClassWriter}. @param attribute The specific attribute. """ MethodVisitor mVisitor = classWriter.visitMethod(ACC_PUBLIC, VISIT_ATTRIBUTE_NAME + getCleanName(attribute.getName()), "(" + JAVA_STRING_DESC + ")V", null, null); mVisitor.visitLocalVariable(firstToLower(getCleanName(attribute.getName())), JAVA_STRING_DESC, null, new Label(), new Label(),1); mVisitor.visitCode(); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitLdcInsn(attribute.getRawName()); mVisitor.visitVarInsn(ALOAD, 1); mVisitor.visitMethodInsn(INVOKEVIRTUAL, elementVisitorType, VISIT_ATTRIBUTE_NAME, "(" + JAVA_STRING_DESC + JAVA_STRING_DESC + ")V", false); mVisitor.visitInsn(RETURN); mVisitor.visitMaxs(3, 2); mVisitor.visitEnd(); }
java
private static void addVisitorAttributeMethod(ClassWriter classWriter, XsdAttribute attribute) { MethodVisitor mVisitor = classWriter.visitMethod(ACC_PUBLIC, VISIT_ATTRIBUTE_NAME + getCleanName(attribute.getName()), "(" + JAVA_STRING_DESC + ")V", null, null); mVisitor.visitLocalVariable(firstToLower(getCleanName(attribute.getName())), JAVA_STRING_DESC, null, new Label(), new Label(),1); mVisitor.visitCode(); mVisitor.visitVarInsn(ALOAD, 0); mVisitor.visitLdcInsn(attribute.getRawName()); mVisitor.visitVarInsn(ALOAD, 1); mVisitor.visitMethodInsn(INVOKEVIRTUAL, elementVisitorType, VISIT_ATTRIBUTE_NAME, "(" + JAVA_STRING_DESC + JAVA_STRING_DESC + ")V", false); mVisitor.visitInsn(RETURN); mVisitor.visitMaxs(3, 2); mVisitor.visitEnd(); }
[ "private", "static", "void", "addVisitorAttributeMethod", "(", "ClassWriter", "classWriter", ",", "XsdAttribute", "attribute", ")", "{", "MethodVisitor", "mVisitor", "=", "classWriter", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "VISIT_ATTRIBUTE_NAME", "+", "getCleanName", "(", "attribute", ".", "getName", "(", ")", ")", ",", "\"(\"", "+", "JAVA_STRING_DESC", "+", "\")V\"", ",", "null", ",", "null", ")", ";", "mVisitor", ".", "visitLocalVariable", "(", "firstToLower", "(", "getCleanName", "(", "attribute", ".", "getName", "(", ")", ")", ")", ",", "JAVA_STRING_DESC", ",", "null", ",", "new", "Label", "(", ")", ",", "new", "Label", "(", ")", ",", "1", ")", ";", "mVisitor", ".", "visitCode", "(", ")", ";", "mVisitor", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mVisitor", ".", "visitLdcInsn", "(", "attribute", ".", "getRawName", "(", ")", ")", ";", "mVisitor", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mVisitor", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "elementVisitorType", ",", "VISIT_ATTRIBUTE_NAME", ",", "\"(\"", "+", "JAVA_STRING_DESC", "+", "JAVA_STRING_DESC", "+", "\")V\"", ",", "false", ")", ";", "mVisitor", ".", "visitInsn", "(", "RETURN", ")", ";", "mVisitor", ".", "visitMaxs", "(", "3", ",", "2", ")", ";", "mVisitor", ".", "visitEnd", "(", ")", ";", "}" ]
Adds a specific method for a visitAttribute call. Example: void visitAttributeManifest(String manifestValue){ visitAttribute("manifest", manifestValue); } @param classWriter The ElementVisitor class {@link ClassWriter}. @param attribute The specific attribute.
[ "Adds", "a", "specific", "method", "for", "a", "visitAttribute", "call", ".", "Example", ":", "void", "visitAttributeManifest", "(", "String", "manifestValue", ")", "{", "visitAttribute", "(", "manifest", "manifestValue", ")", ";", "}" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java#L107-L118
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUData.java
ICUData.getStream
static InputStream getStream(final ClassLoader loader, final String resourceName, boolean required) { """ Should be called only from ICUBinary.getData() or from convenience overloads here. """ InputStream i = null; if (System.getSecurityManager() != null) { i = AccessController.doPrivileged(new PrivilegedAction<InputStream>() { @Override public InputStream run() { return loader.getResourceAsStream(resourceName); } }); } else { i = loader.getResourceAsStream(resourceName); } if (i == null && required) { throw new MissingResourceException("could not locate data", loader.toString(), resourceName); } checkStreamForBinaryData(i, resourceName); return i; }
java
static InputStream getStream(final ClassLoader loader, final String resourceName, boolean required) { InputStream i = null; if (System.getSecurityManager() != null) { i = AccessController.doPrivileged(new PrivilegedAction<InputStream>() { @Override public InputStream run() { return loader.getResourceAsStream(resourceName); } }); } else { i = loader.getResourceAsStream(resourceName); } if (i == null && required) { throw new MissingResourceException("could not locate data", loader.toString(), resourceName); } checkStreamForBinaryData(i, resourceName); return i; }
[ "static", "InputStream", "getStream", "(", "final", "ClassLoader", "loader", ",", "final", "String", "resourceName", ",", "boolean", "required", ")", "{", "InputStream", "i", "=", "null", ";", "if", "(", "System", ".", "getSecurityManager", "(", ")", "!=", "null", ")", "{", "i", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "InputStream", ">", "(", ")", "{", "@", "Override", "public", "InputStream", "run", "(", ")", "{", "return", "loader", ".", "getResourceAsStream", "(", "resourceName", ")", ";", "}", "}", ")", ";", "}", "else", "{", "i", "=", "loader", ".", "getResourceAsStream", "(", "resourceName", ")", ";", "}", "if", "(", "i", "==", "null", "&&", "required", ")", "{", "throw", "new", "MissingResourceException", "(", "\"could not locate data\"", ",", "loader", ".", "toString", "(", ")", ",", "resourceName", ")", ";", "}", "checkStreamForBinaryData", "(", "i", ",", "resourceName", ")", ";", "return", "i", ";", "}" ]
Should be called only from ICUBinary.getData() or from convenience overloads here.
[ "Should", "be", "called", "only", "from", "ICUBinary", ".", "getData", "()", "or", "from", "convenience", "overloads", "here", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUData.java#L144-L161
google/closure-compiler
src/com/google/javascript/jscomp/NodeTraversal.java
NodeTraversal.traverseClass
private void traverseClass(Node n) { """ Traverses a class. Note that we traverse some of the child nodes slightly out of order to ensure children are visited in the correct scope. The following children are in the outer scope: (1) the 'extends' clause, (2) any computed method keys, (3) the class name for class declarations only (class expression names are traversed in the class scope). This requires that we visit the extends node (second child) and any computed member keys (grandchildren of the last, body, child) before visiting the name (first child) or body (last child). """ final Node className = n.getFirstChild(); final Node extendsClause = className.getNext(); final Node body = extendsClause.getNext(); boolean isClassExpression = NodeUtil.isClassExpression(n); traverseBranch(extendsClause, n); for (Node child = body.getFirstChild(); child != null;) { Node next = child.getNext(); // see traverseChildren if (child.isComputedProp()) { traverseBranch(child.getFirstChild(), child); } child = next; } if (!isClassExpression) { // Class declarations are in the scope containing the declaration. traverseBranch(className, n); } curNode = n; pushScope(n); if (isClassExpression) { // Class expression names are only accessible within the function // scope. traverseBranch(className, n); } // Body traverseBranch(body, n); popScope(); }
java
private void traverseClass(Node n) { final Node className = n.getFirstChild(); final Node extendsClause = className.getNext(); final Node body = extendsClause.getNext(); boolean isClassExpression = NodeUtil.isClassExpression(n); traverseBranch(extendsClause, n); for (Node child = body.getFirstChild(); child != null;) { Node next = child.getNext(); // see traverseChildren if (child.isComputedProp()) { traverseBranch(child.getFirstChild(), child); } child = next; } if (!isClassExpression) { // Class declarations are in the scope containing the declaration. traverseBranch(className, n); } curNode = n; pushScope(n); if (isClassExpression) { // Class expression names are only accessible within the function // scope. traverseBranch(className, n); } // Body traverseBranch(body, n); popScope(); }
[ "private", "void", "traverseClass", "(", "Node", "n", ")", "{", "final", "Node", "className", "=", "n", ".", "getFirstChild", "(", ")", ";", "final", "Node", "extendsClause", "=", "className", ".", "getNext", "(", ")", ";", "final", "Node", "body", "=", "extendsClause", ".", "getNext", "(", ")", ";", "boolean", "isClassExpression", "=", "NodeUtil", ".", "isClassExpression", "(", "n", ")", ";", "traverseBranch", "(", "extendsClause", ",", "n", ")", ";", "for", "(", "Node", "child", "=", "body", ".", "getFirstChild", "(", ")", ";", "child", "!=", "null", ";", ")", "{", "Node", "next", "=", "child", ".", "getNext", "(", ")", ";", "// see traverseChildren", "if", "(", "child", ".", "isComputedProp", "(", ")", ")", "{", "traverseBranch", "(", "child", ".", "getFirstChild", "(", ")", ",", "child", ")", ";", "}", "child", "=", "next", ";", "}", "if", "(", "!", "isClassExpression", ")", "{", "// Class declarations are in the scope containing the declaration.", "traverseBranch", "(", "className", ",", "n", ")", ";", "}", "curNode", "=", "n", ";", "pushScope", "(", "n", ")", ";", "if", "(", "isClassExpression", ")", "{", "// Class expression names are only accessible within the function", "// scope.", "traverseBranch", "(", "className", ",", "n", ")", ";", "}", "// Body", "traverseBranch", "(", "body", ",", "n", ")", ";", "popScope", "(", ")", ";", "}" ]
Traverses a class. Note that we traverse some of the child nodes slightly out of order to ensure children are visited in the correct scope. The following children are in the outer scope: (1) the 'extends' clause, (2) any computed method keys, (3) the class name for class declarations only (class expression names are traversed in the class scope). This requires that we visit the extends node (second child) and any computed member keys (grandchildren of the last, body, child) before visiting the name (first child) or body (last child).
[ "Traverses", "a", "class", ".", "Note", "that", "we", "traverse", "some", "of", "the", "child", "nodes", "slightly", "out", "of", "order", "to", "ensure", "children", "are", "visited", "in", "the", "correct", "scope", ".", "The", "following", "children", "are", "in", "the", "outer", "scope", ":", "(", "1", ")", "the", "extends", "clause", "(", "2", ")", "any", "computed", "method", "keys", "(", "3", ")", "the", "class", "name", "for", "class", "declarations", "only", "(", "class", "expression", "names", "are", "traversed", "in", "the", "class", "scope", ")", ".", "This", "requires", "that", "we", "visit", "the", "extends", "node", "(", "second", "child", ")", "and", "any", "computed", "member", "keys", "(", "grandchildren", "of", "the", "last", "body", "child", ")", "before", "visiting", "the", "name", "(", "first", "child", ")", "or", "body", "(", "last", "child", ")", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L919-L954
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getFloat
public float getFloat(String name, float defaultValue) { """ Returns the float value for the specified name. If the name does not exist or the value for the name can not be interpreted as a float, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue """ try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Float.parseFloat(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse float for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
java
public float getFloat(String name, float defaultValue) { try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Float.parseFloat(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse float for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
[ "public", "float", "getFloat", "(", "String", "name", ",", "float", "defaultValue", ")", "{", "try", "{", "String", "value", "=", "getString", "(", "name", ",", "null", ")", ";", "if", "(", "!", "StringUtils", ".", "isNullOrEmpty", "(", "value", ")", ")", "{", "return", "Float", ".", "parseFloat", "(", "value", ".", "trim", "(", ")", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "log", ".", "warn", "(", "\"Failed to parse float for \"", "+", "name", "+", "USING_DEFAULT_OF", "+", "defaultValue", ")", ";", "}", "return", "defaultValue", ";", "}" ]
Returns the float value for the specified name. If the name does not exist or the value for the name can not be interpreted as a float, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue
[ "Returns", "the", "float", "value", "for", "the", "specified", "name", ".", "If", "the", "name", "does", "not", "exist", "or", "the", "value", "for", "the", "name", "can", "not", "be", "interpreted", "as", "a", "float", "the", "defaultValue", "is", "returned", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L541-L553
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointRequest.java
EndpointRequest.setAttributes
public void setAttributes(java.util.Map<String, java.util.List<String>> attributes) { """ Custom attributes that describe the endpoint by associating a name with an array of values. For example, an attribute named "interests" might have the values ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create a segment of users to engage with a messaging campaign. The following characters are not recommended in attribute names: # : ? \ /. The Amazon Pinpoint console does not display attributes that include these characters in the name. This limitation does not apply to attribute values. @param attributes Custom attributes that describe the endpoint by associating a name with an array of values. For example, an attribute named "interests" might have the values ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create a segment of users to engage with a messaging campaign. The following characters are not recommended in attribute names: # : ? \ /. The Amazon Pinpoint console does not display attributes that include these characters in the name. This limitation does not apply to attribute values. """ this.attributes = attributes; }
java
public void setAttributes(java.util.Map<String, java.util.List<String>> attributes) { this.attributes = attributes; }
[ "public", "void", "setAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "attributes", ")", "{", "this", ".", "attributes", "=", "attributes", ";", "}" ]
Custom attributes that describe the endpoint by associating a name with an array of values. For example, an attribute named "interests" might have the values ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create a segment of users to engage with a messaging campaign. The following characters are not recommended in attribute names: # : ? \ /. The Amazon Pinpoint console does not display attributes that include these characters in the name. This limitation does not apply to attribute values. @param attributes Custom attributes that describe the endpoint by associating a name with an array of values. For example, an attribute named "interests" might have the values ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create a segment of users to engage with a messaging campaign. The following characters are not recommended in attribute names: # : ? \ /. The Amazon Pinpoint console does not display attributes that include these characters in the name. This limitation does not apply to attribute values.
[ "Custom", "attributes", "that", "describe", "the", "endpoint", "by", "associating", "a", "name", "with", "an", "array", "of", "values", ".", "For", "example", "an", "attribute", "named", "interests", "might", "have", "the", "values", "[", "science", "politics", "travel", "]", ".", "You", "can", "use", "these", "attributes", "as", "selection", "criteria", "when", "you", "create", "a", "segment", "of", "users", "to", "engage", "with", "a", "messaging", "campaign", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointRequest.java#L165-L167
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java
SchemaHelper.deserialiseObject
static public Object deserialiseObject(String xml, String xsdFile, Class<?> objclass) throws JAXBException, SAXException, XMLStreamException { """ Attempt to construct the specified object from this XML string @param xml the XML string to parse @param xsdFile the name of the XSD schema that defines the object @param objclass the class of the object requested @return if successful, an instance of class objclass that captures the data in the XML string """ Object obj = null; JAXBContext jaxbContext = getJAXBContext(objclass); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); final String schemaResourceFilename = new String(xsdFile); URL schemaURL = MalmoMod.class.getClassLoader().getResource(schemaResourceFilename); Schema schema = schemaFactory.newSchema(schemaURL); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); jaxbUnmarshaller.setSchema(schema); StringReader stringReader = new StringReader(xml); XMLInputFactory xif = XMLInputFactory.newFactory(); xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLStreamReader XMLreader = xif.createXMLStreamReader(stringReader); obj = jaxbUnmarshaller.unmarshal(XMLreader); return obj; }
java
static public Object deserialiseObject(String xml, String xsdFile, Class<?> objclass) throws JAXBException, SAXException, XMLStreamException { Object obj = null; JAXBContext jaxbContext = getJAXBContext(objclass); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); final String schemaResourceFilename = new String(xsdFile); URL schemaURL = MalmoMod.class.getClassLoader().getResource(schemaResourceFilename); Schema schema = schemaFactory.newSchema(schemaURL); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); jaxbUnmarshaller.setSchema(schema); StringReader stringReader = new StringReader(xml); XMLInputFactory xif = XMLInputFactory.newFactory(); xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLStreamReader XMLreader = xif.createXMLStreamReader(stringReader); obj = jaxbUnmarshaller.unmarshal(XMLreader); return obj; }
[ "static", "public", "Object", "deserialiseObject", "(", "String", "xml", ",", "String", "xsdFile", ",", "Class", "<", "?", ">", "objclass", ")", "throws", "JAXBException", ",", "SAXException", ",", "XMLStreamException", "{", "Object", "obj", "=", "null", ";", "JAXBContext", "jaxbContext", "=", "getJAXBContext", "(", "objclass", ")", ";", "SchemaFactory", "schemaFactory", "=", "SchemaFactory", ".", "newInstance", "(", "XMLConstants", ".", "W3C_XML_SCHEMA_NS_URI", ")", ";", "final", "String", "schemaResourceFilename", "=", "new", "String", "(", "xsdFile", ")", ";", "URL", "schemaURL", "=", "MalmoMod", ".", "class", ".", "getClassLoader", "(", ")", ".", "getResource", "(", "schemaResourceFilename", ")", ";", "Schema", "schema", "=", "schemaFactory", ".", "newSchema", "(", "schemaURL", ")", ";", "Unmarshaller", "jaxbUnmarshaller", "=", "jaxbContext", ".", "createUnmarshaller", "(", ")", ";", "jaxbUnmarshaller", ".", "setSchema", "(", "schema", ")", ";", "StringReader", "stringReader", "=", "new", "StringReader", "(", "xml", ")", ";", "XMLInputFactory", "xif", "=", "XMLInputFactory", ".", "newFactory", "(", ")", ";", "xif", ".", "setProperty", "(", "XMLInputFactory", ".", "IS_SUPPORTING_EXTERNAL_ENTITIES", ",", "false", ")", ";", "xif", ".", "setProperty", "(", "XMLInputFactory", ".", "SUPPORT_DTD", ",", "false", ")", ";", "XMLStreamReader", "XMLreader", "=", "xif", ".", "createXMLStreamReader", "(", "stringReader", ")", ";", "obj", "=", "jaxbUnmarshaller", ".", "unmarshal", "(", "XMLreader", ")", ";", "return", "obj", ";", "}" ]
Attempt to construct the specified object from this XML string @param xml the XML string to parse @param xsdFile the name of the XSD schema that defines the object @param objclass the class of the object requested @return if successful, an instance of class objclass that captures the data in the XML string
[ "Attempt", "to", "construct", "the", "specified", "object", "from", "this", "XML", "string" ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java#L98-L118
enioka/jqm
jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/ResourceManagerBase.java
ResourceManagerBase.getStringParameter
protected String getStringParameter(String key, JobInstance ji, boolean pop) { """ Apply precedence rules for parameter value resolution: JI parameter using RM key > JI parameter using generic RM name without key > JD > RM > defaults @param key the end of the parameter key. getParameterRoot()[.key] is automatically prefixed. @param ji the analysed job instance @param pop if true, parameter will be removed from the JI prm list @return """ // First try: parameter name with specific RM key. String res = ji.getPrms().get(getParameterRoot() + this.key + "." + key); if (res != null && pop) { ji.getPrms().remove(getParameterRoot() + this.key + "." + key); } // Second try: parameter name without specific key (used by all RM of this type) if (res == null) { res = ji.getPrms().get(getParameterRoot() + key); if (res != null && pop) { ji.getPrms().remove(getParameterRoot() + key); } } // Third try: just use value from RM configuration (which may be a hard-coded default). if (res == null) { res = this.currentProperties.get(getParameterRoot() + key); } // Go. Third try is by convention always supposed to succeed - all keys should have a default value. return res; }
java
protected String getStringParameter(String key, JobInstance ji, boolean pop) { // First try: parameter name with specific RM key. String res = ji.getPrms().get(getParameterRoot() + this.key + "." + key); if (res != null && pop) { ji.getPrms().remove(getParameterRoot() + this.key + "." + key); } // Second try: parameter name without specific key (used by all RM of this type) if (res == null) { res = ji.getPrms().get(getParameterRoot() + key); if (res != null && pop) { ji.getPrms().remove(getParameterRoot() + key); } } // Third try: just use value from RM configuration (which may be a hard-coded default). if (res == null) { res = this.currentProperties.get(getParameterRoot() + key); } // Go. Third try is by convention always supposed to succeed - all keys should have a default value. return res; }
[ "protected", "String", "getStringParameter", "(", "String", "key", ",", "JobInstance", "ji", ",", "boolean", "pop", ")", "{", "// First try: parameter name with specific RM key.", "String", "res", "=", "ji", ".", "getPrms", "(", ")", ".", "get", "(", "getParameterRoot", "(", ")", "+", "this", ".", "key", "+", "\".\"", "+", "key", ")", ";", "if", "(", "res", "!=", "null", "&&", "pop", ")", "{", "ji", ".", "getPrms", "(", ")", ".", "remove", "(", "getParameterRoot", "(", ")", "+", "this", ".", "key", "+", "\".\"", "+", "key", ")", ";", "}", "// Second try: parameter name without specific key (used by all RM of this type)", "if", "(", "res", "==", "null", ")", "{", "res", "=", "ji", ".", "getPrms", "(", ")", ".", "get", "(", "getParameterRoot", "(", ")", "+", "key", ")", ";", "if", "(", "res", "!=", "null", "&&", "pop", ")", "{", "ji", ".", "getPrms", "(", ")", ".", "remove", "(", "getParameterRoot", "(", ")", "+", "key", ")", ";", "}", "}", "// Third try: just use value from RM configuration (which may be a hard-coded default).", "if", "(", "res", "==", "null", ")", "{", "res", "=", "this", ".", "currentProperties", ".", "get", "(", "getParameterRoot", "(", ")", "+", "key", ")", ";", "}", "// Go. Third try is by convention always supposed to succeed - all keys should have a default value.", "return", "res", ";", "}" ]
Apply precedence rules for parameter value resolution: JI parameter using RM key > JI parameter using generic RM name without key > JD > RM > defaults @param key the end of the parameter key. getParameterRoot()[.key] is automatically prefixed. @param ji the analysed job instance @param pop if true, parameter will be removed from the JI prm list @return
[ "Apply", "precedence", "rules", "for", "parameter", "value", "resolution", ":", "JI", "parameter", "using", "RM", "key", ">", "JI", "parameter", "using", "generic", "RM", "name", "without", "key", ">", "JD", ">", "RM", ">", "defaults" ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/ResourceManagerBase.java#L118-L145
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java
AccumulatorCompiler.pushStackType
private static void pushStackType(Scope scope, BytecodeBlock block, Type sqlType, BytecodeBlock getBlockBytecode, Class<?> parameter, CallSiteBinder callSiteBinder) { """ Assumes that there is a variable named 'position' in the block, which is the current index """ Variable position = scope.getVariable("position"); if (parameter == long.class) { block.comment("%s.getLong(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getLong", long.class, Block.class, int.class); } else if (parameter == double.class) { block.comment("%s.getDouble(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getDouble", double.class, Block.class, int.class); } else if (parameter == boolean.class) { block.comment("%s.getBoolean(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getBoolean", boolean.class, Block.class, int.class); } else if (parameter == Slice.class) { block.comment("%s.getSlice(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getSlice", Slice.class, Block.class, int.class); } else { block.comment("%s.getObject(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getObject", Object.class, Block.class, int.class); } }
java
private static void pushStackType(Scope scope, BytecodeBlock block, Type sqlType, BytecodeBlock getBlockBytecode, Class<?> parameter, CallSiteBinder callSiteBinder) { Variable position = scope.getVariable("position"); if (parameter == long.class) { block.comment("%s.getLong(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getLong", long.class, Block.class, int.class); } else if (parameter == double.class) { block.comment("%s.getDouble(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getDouble", double.class, Block.class, int.class); } else if (parameter == boolean.class) { block.comment("%s.getBoolean(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getBoolean", boolean.class, Block.class, int.class); } else if (parameter == Slice.class) { block.comment("%s.getSlice(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getSlice", Slice.class, Block.class, int.class); } else { block.comment("%s.getObject(block, position)", sqlType.getTypeSignature()) .append(constantType(callSiteBinder, sqlType)) .append(getBlockBytecode) .append(position) .invokeInterface(Type.class, "getObject", Object.class, Block.class, int.class); } }
[ "private", "static", "void", "pushStackType", "(", "Scope", "scope", ",", "BytecodeBlock", "block", ",", "Type", "sqlType", ",", "BytecodeBlock", "getBlockBytecode", ",", "Class", "<", "?", ">", "parameter", ",", "CallSiteBinder", "callSiteBinder", ")", "{", "Variable", "position", "=", "scope", ".", "getVariable", "(", "\"position\"", ")", ";", "if", "(", "parameter", "==", "long", ".", "class", ")", "{", "block", ".", "comment", "(", "\"%s.getLong(block, position)\"", ",", "sqlType", ".", "getTypeSignature", "(", ")", ")", ".", "append", "(", "constantType", "(", "callSiteBinder", ",", "sqlType", ")", ")", ".", "append", "(", "getBlockBytecode", ")", ".", "append", "(", "position", ")", ".", "invokeInterface", "(", "Type", ".", "class", ",", "\"getLong\"", ",", "long", ".", "class", ",", "Block", ".", "class", ",", "int", ".", "class", ")", ";", "}", "else", "if", "(", "parameter", "==", "double", ".", "class", ")", "{", "block", ".", "comment", "(", "\"%s.getDouble(block, position)\"", ",", "sqlType", ".", "getTypeSignature", "(", ")", ")", ".", "append", "(", "constantType", "(", "callSiteBinder", ",", "sqlType", ")", ")", ".", "append", "(", "getBlockBytecode", ")", ".", "append", "(", "position", ")", ".", "invokeInterface", "(", "Type", ".", "class", ",", "\"getDouble\"", ",", "double", ".", "class", ",", "Block", ".", "class", ",", "int", ".", "class", ")", ";", "}", "else", "if", "(", "parameter", "==", "boolean", ".", "class", ")", "{", "block", ".", "comment", "(", "\"%s.getBoolean(block, position)\"", ",", "sqlType", ".", "getTypeSignature", "(", ")", ")", ".", "append", "(", "constantType", "(", "callSiteBinder", ",", "sqlType", ")", ")", ".", "append", "(", "getBlockBytecode", ")", ".", "append", "(", "position", ")", ".", "invokeInterface", "(", "Type", ".", "class", ",", "\"getBoolean\"", ",", "boolean", ".", "class", ",", "Block", ".", "class", ",", "int", ".", "class", ")", ";", "}", "else", "if", "(", "parameter", "==", "Slice", ".", "class", ")", "{", "block", ".", "comment", "(", "\"%s.getSlice(block, position)\"", ",", "sqlType", ".", "getTypeSignature", "(", ")", ")", ".", "append", "(", "constantType", "(", "callSiteBinder", ",", "sqlType", ")", ")", ".", "append", "(", "getBlockBytecode", ")", ".", "append", "(", "position", ")", ".", "invokeInterface", "(", "Type", ".", "class", ",", "\"getSlice\"", ",", "Slice", ".", "class", ",", "Block", ".", "class", ",", "int", ".", "class", ")", ";", "}", "else", "{", "block", ".", "comment", "(", "\"%s.getObject(block, position)\"", ",", "sqlType", ".", "getTypeSignature", "(", ")", ")", ".", "append", "(", "constantType", "(", "callSiteBinder", ",", "sqlType", ")", ")", ".", "append", "(", "getBlockBytecode", ")", ".", "append", "(", "position", ")", ".", "invokeInterface", "(", "Type", ".", "class", ",", "\"getObject\"", ",", "Object", ".", "class", ",", "Block", ".", "class", ",", "int", ".", "class", ")", ";", "}", "}" ]
Assumes that there is a variable named 'position' in the block, which is the current index
[ "Assumes", "that", "there", "is", "a", "variable", "named", "position", "in", "the", "block", "which", "is", "the", "current", "index" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java#L618-L656
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java
JacksonUtils.readJson
public static JsonNode readJson(String source, ClassLoader classLoader) { """ Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader. @param source @param classLoader @return """ return SerializationUtils.readJson(source, classLoader); }
java
public static JsonNode readJson(String source, ClassLoader classLoader) { return SerializationUtils.readJson(source, classLoader); }
[ "public", "static", "JsonNode", "readJson", "(", "String", "source", ",", "ClassLoader", "classLoader", ")", "{", "return", "SerializationUtils", ".", "readJson", "(", "source", ",", "classLoader", ")", ";", "}" ]
Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader. @param source @param classLoader @return
[ "Read", "a", "JSON", "string", "and", "parse", "to", "{", "@link", "JsonNode", "}", "instance", "with", "a", "custom", "class", "loader", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L117-L119
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java
MarkdownParser.handleTextBlock
private void handleTextBlock(TextCursor cursor, int blockEnd, ArrayList<MDSection> paragraphs) { """ Processing text blocks between code blocks @param cursor text cursor @param blockEnd text block end @param paragraphs current paragraphs """ MDText[] spans = handleSpans(cursor, blockEnd); paragraphs.add(new MDSection(spans)); cursor.currentOffset = blockEnd; }
java
private void handleTextBlock(TextCursor cursor, int blockEnd, ArrayList<MDSection> paragraphs) { MDText[] spans = handleSpans(cursor, blockEnd); paragraphs.add(new MDSection(spans)); cursor.currentOffset = blockEnd; }
[ "private", "void", "handleTextBlock", "(", "TextCursor", "cursor", ",", "int", "blockEnd", ",", "ArrayList", "<", "MDSection", ">", "paragraphs", ")", "{", "MDText", "[", "]", "spans", "=", "handleSpans", "(", "cursor", ",", "blockEnd", ")", ";", "paragraphs", ".", "add", "(", "new", "MDSection", "(", "spans", ")", ")", ";", "cursor", ".", "currentOffset", "=", "blockEnd", ";", "}" ]
Processing text blocks between code blocks @param cursor text cursor @param blockEnd text block end @param paragraphs current paragraphs
[ "Processing", "text", "blocks", "between", "code", "blocks" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java#L85-L89
upwork/java-upwork
src/com/Upwork/api/Routers/Reports/Time.java
Time.getByTeamLimited
public JSONObject getByTeamLimited(String company, String team, HashMap<String, String> params) throws JSONException { """ Generate Time Reports for a Specific Team (hide financial info) @param company Company ID @param team Team ID @param params Parameters @throws JSONException If error occurred @return {@link JSONObject} """ return _getByType(company, team, null, params, true); }
java
public JSONObject getByTeamLimited(String company, String team, HashMap<String, String> params) throws JSONException { return _getByType(company, team, null, params, true); }
[ "public", "JSONObject", "getByTeamLimited", "(", "String", "company", ",", "String", "team", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "_getByType", "(", "company", ",", "team", ",", "null", ",", "params", ",", "true", ")", ";", "}" ]
Generate Time Reports for a Specific Team (hide financial info) @param company Company ID @param team Team ID @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Generate", "Time", "Reports", "for", "a", "Specific", "Team", "(", "hide", "financial", "info", ")" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Time.java#L93-L95
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/DateUtility.java
DateUtility.convertDateToString
public static String convertDateToString(Date date, boolean millis) { """ Converts an instance of java.util.Date into an ISO 8601 String representation. Uses the date format yyyy-MM-ddTHH:mm:ss.SSSZ or yyyy-MM-ddTHH:mm:ssZ, depending on whether millisecond precision is desired. @param date Instance of java.util.Date. @param millis Whether or not the return value should include milliseconds. @return ISO 8601 String representation of the Date argument or null if the Date argument is null. """ if (date == null) { return null; } else { DateTimeFormatter df; if (millis) { // df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); df = FORMATTER_MILLISECONDS_T_Z; } else { // df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); df = FORMATTER_SECONDS_T_Z; } return df.print(date.getTime()); } }
java
public static String convertDateToString(Date date, boolean millis) { if (date == null) { return null; } else { DateTimeFormatter df; if (millis) { // df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); df = FORMATTER_MILLISECONDS_T_Z; } else { // df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); df = FORMATTER_SECONDS_T_Z; } return df.print(date.getTime()); } }
[ "public", "static", "String", "convertDateToString", "(", "Date", "date", ",", "boolean", "millis", ")", "{", "if", "(", "date", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "DateTimeFormatter", "df", ";", "if", "(", "millis", ")", "{", "// df = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\");", "df", "=", "FORMATTER_MILLISECONDS_T_Z", ";", "}", "else", "{", "// df = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss'Z'\");", "df", "=", "FORMATTER_SECONDS_T_Z", ";", "}", "return", "df", ".", "print", "(", "date", ".", "getTime", "(", ")", ")", ";", "}", "}" ]
Converts an instance of java.util.Date into an ISO 8601 String representation. Uses the date format yyyy-MM-ddTHH:mm:ss.SSSZ or yyyy-MM-ddTHH:mm:ssZ, depending on whether millisecond precision is desired. @param date Instance of java.util.Date. @param millis Whether or not the return value should include milliseconds. @return ISO 8601 String representation of the Date argument or null if the Date argument is null.
[ "Converts", "an", "instance", "of", "java", ".", "util", ".", "Date", "into", "an", "ISO", "8601", "String", "representation", ".", "Uses", "the", "date", "format", "yyyy", "-", "MM", "-", "ddTHH", ":", "mm", ":", "ss", ".", "SSSZ", "or", "yyyy", "-", "MM", "-", "ddTHH", ":", "mm", ":", "ssZ", "depending", "on", "whether", "millisecond", "precision", "is", "desired", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/DateUtility.java#L87-L102
james-hu/jabb-core
src/main/java/net/sf/jabb/util/text/StartWithMatcher.java
StartWithMatcher.getLastAcceptedState
protected int getLastAcceptedState(CharSequence text, int startIndex) { """ By utilizing the state machine (dk.brics.automaton.RunAutomaton), get the last accepted matching state. The matching test starts at specified position.<br> 利用状态机(dk.brics.automaton.RunAutomaton),取得最后一个匹配到的状态。从指定位置开始进行匹配检查。 @param text The text to be tested.<br>待进行匹配检查的文本。 @param startIndex The position to start matching test.<br>从文本的这个位置开始匹配。 @return The state number that matched, return -1 if no expression can match the text.<br> 匹配到的状态编号,返回-1表示没有与任何一个正则表达式相匹配。 """ int lastAcceptedState = -1; int p = runAutomaton.getInitialState(); int l = text.length(); for (int i = startIndex; i < l; i++) { p = runAutomaton.step(p, text.charAt(i)); if (p == -1) { if (lastAcceptedState == -1){ return -1; }else{ break; } } if (runAutomaton.isAccept(p)){ lastAcceptedState = p; } } return lastAcceptedState; }
java
protected int getLastAcceptedState(CharSequence text, int startIndex){ int lastAcceptedState = -1; int p = runAutomaton.getInitialState(); int l = text.length(); for (int i = startIndex; i < l; i++) { p = runAutomaton.step(p, text.charAt(i)); if (p == -1) { if (lastAcceptedState == -1){ return -1; }else{ break; } } if (runAutomaton.isAccept(p)){ lastAcceptedState = p; } } return lastAcceptedState; }
[ "protected", "int", "getLastAcceptedState", "(", "CharSequence", "text", ",", "int", "startIndex", ")", "{", "int", "lastAcceptedState", "=", "-", "1", ";", "int", "p", "=", "runAutomaton", ".", "getInitialState", "(", ")", ";", "int", "l", "=", "text", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "startIndex", ";", "i", "<", "l", ";", "i", "++", ")", "{", "p", "=", "runAutomaton", ".", "step", "(", "p", ",", "text", ".", "charAt", "(", "i", ")", ")", ";", "if", "(", "p", "==", "-", "1", ")", "{", "if", "(", "lastAcceptedState", "==", "-", "1", ")", "{", "return", "-", "1", ";", "}", "else", "{", "break", ";", "}", "}", "if", "(", "runAutomaton", ".", "isAccept", "(", "p", ")", ")", "{", "lastAcceptedState", "=", "p", ";", "}", "}", "return", "lastAcceptedState", ";", "}" ]
By utilizing the state machine (dk.brics.automaton.RunAutomaton), get the last accepted matching state. The matching test starts at specified position.<br> 利用状态机(dk.brics.automaton.RunAutomaton),取得最后一个匹配到的状态。从指定位置开始进行匹配检查。 @param text The text to be tested.<br>待进行匹配检查的文本。 @param startIndex The position to start matching test.<br>从文本的这个位置开始匹配。 @return The state number that matched, return -1 if no expression can match the text.<br> 匹配到的状态编号,返回-1表示没有与任何一个正则表达式相匹配。
[ "By", "utilizing", "the", "state", "machine", "(", "dk", ".", "brics", ".", "automaton", ".", "RunAutomaton", ")", "get", "the", "last", "accepted", "matching", "state", ".", "The", "matching", "test", "starts", "at", "specified", "position", ".", "<br", ">", "利用状态机(dk", ".", "brics", ".", "automaton", ".", "RunAutomaton),取得最后一个匹配到的状态。从指定位置开始进行匹配检查。" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/text/StartWithMatcher.java#L216-L235
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/provider/ChaiConfiguration.java
ChaiConfiguration.newConfiguration
public static ChaiConfiguration newConfiguration( final List<String> ldapURLs, final String bindDN, final String bindPassword ) { """ Construct a default {@code ChaiConfiguration}. @param bindDN ldap bind DN, in ldap fully qualified syntax. Also used as the DN of the returned ChaiUser. @param bindPassword password for the bind DN. @param ldapURLs ldap server and port in url format, example: <i>ldap://127.0.0.1:389</i> @return A new {@code ChaiConfiguration} instance. """ return new ChaiConfigurationBuilder( ldapURLs, bindDN, bindPassword ).build(); }
java
public static ChaiConfiguration newConfiguration( final List<String> ldapURLs, final String bindDN, final String bindPassword ) { return new ChaiConfigurationBuilder( ldapURLs, bindDN, bindPassword ).build(); }
[ "public", "static", "ChaiConfiguration", "newConfiguration", "(", "final", "List", "<", "String", ">", "ldapURLs", ",", "final", "String", "bindDN", ",", "final", "String", "bindPassword", ")", "{", "return", "new", "ChaiConfigurationBuilder", "(", "ldapURLs", ",", "bindDN", ",", "bindPassword", ")", ".", "build", "(", ")", ";", "}" ]
Construct a default {@code ChaiConfiguration}. @param bindDN ldap bind DN, in ldap fully qualified syntax. Also used as the DN of the returned ChaiUser. @param bindPassword password for the bind DN. @param ldapURLs ldap server and port in url format, example: <i>ldap://127.0.0.1:389</i> @return A new {@code ChaiConfiguration} instance.
[ "Construct", "a", "default", "{", "@code", "ChaiConfiguration", "}", "." ]
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/provider/ChaiConfiguration.java#L94-L101
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.inclusiveBetween
public long inclusiveBetween(long start, long end, long value, String message) { """ Validate that the specified primitive value falls between the two inclusive values specified; otherwise, throws an exception with the specified message. <pre>Validate.inclusiveBetween(0, 2, 1, "Not in range");</pre> @param start the inclusive start value @param end the inclusive end value @param value the value to validate @param message the exception message if invalid, not null @return the value @throws IllegalArgumentValidationException if the value falls outside the boundaries """ if (value < start || value > end) { fail(message); } return value; }
java
public long inclusiveBetween(long start, long end, long value, String message) { if (value < start || value > end) { fail(message); } return value; }
[ "public", "long", "inclusiveBetween", "(", "long", "start", ",", "long", "end", ",", "long", "value", ",", "String", "message", ")", "{", "if", "(", "value", "<", "start", "||", "value", ">", "end", ")", "{", "fail", "(", "message", ")", ";", "}", "return", "value", ";", "}" ]
Validate that the specified primitive value falls between the two inclusive values specified; otherwise, throws an exception with the specified message. <pre>Validate.inclusiveBetween(0, 2, 1, "Not in range");</pre> @param start the inclusive start value @param end the inclusive end value @param value the value to validate @param message the exception message if invalid, not null @return the value @throws IllegalArgumentValidationException if the value falls outside the boundaries
[ "Validate", "that", "the", "specified", "primitive", "value", "falls", "between", "the", "two", "inclusive", "values", "specified", ";", "otherwise", "throws", "an", "exception", "with", "the", "specified", "message", ".", "<pre", ">", "Validate", ".", "inclusiveBetween", "(", "0", "2", "1", "Not", "in", "range", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1308-L1313
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/RandomCompat.java
RandomCompat.doubles
@NotNull public DoubleStream doubles(final double randomNumberOrigin, final double randomNumberBound) { """ Returns an effectively unlimited stream of pseudorandom {@code double} values, each conforming to the given origin (inclusive) and bound (exclusive) @param randomNumberOrigin the origin (inclusive) of each random value @param randomNumberBound the bound (exclusive) of each random value @return a stream of pseudorandom {@code double} values, each with the given origin (inclusive) and bound (exclusive) @throws IllegalArgumentException if {@code randomNumberOrigin} is greater than or equal to {@code randomNumberBound} """ if (randomNumberOrigin >= randomNumberBound) { throw new IllegalArgumentException(); } return DoubleStream.generate(new DoubleSupplier() { private final double bound = randomNumberBound - randomNumberOrigin; @Override public double getAsDouble() { double result = random.nextDouble() * bound + randomNumberOrigin; if (result >= randomNumberBound) { result = Double.longBitsToDouble(Double.doubleToLongBits(randomNumberBound) - 1); } return result; } }); }
java
@NotNull public DoubleStream doubles(final double randomNumberOrigin, final double randomNumberBound) { if (randomNumberOrigin >= randomNumberBound) { throw new IllegalArgumentException(); } return DoubleStream.generate(new DoubleSupplier() { private final double bound = randomNumberBound - randomNumberOrigin; @Override public double getAsDouble() { double result = random.nextDouble() * bound + randomNumberOrigin; if (result >= randomNumberBound) { result = Double.longBitsToDouble(Double.doubleToLongBits(randomNumberBound) - 1); } return result; } }); }
[ "@", "NotNull", "public", "DoubleStream", "doubles", "(", "final", "double", "randomNumberOrigin", ",", "final", "double", "randomNumberBound", ")", "{", "if", "(", "randomNumberOrigin", ">=", "randomNumberBound", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "DoubleStream", ".", "generate", "(", "new", "DoubleSupplier", "(", ")", "{", "private", "final", "double", "bound", "=", "randomNumberBound", "-", "randomNumberOrigin", ";", "@", "Override", "public", "double", "getAsDouble", "(", ")", "{", "double", "result", "=", "random", ".", "nextDouble", "(", ")", "*", "bound", "+", "randomNumberOrigin", ";", "if", "(", "result", ">=", "randomNumberBound", ")", "{", "result", "=", "Double", ".", "longBitsToDouble", "(", "Double", ".", "doubleToLongBits", "(", "randomNumberBound", ")", "-", "1", ")", ";", "}", "return", "result", ";", "}", "}", ")", ";", "}" ]
Returns an effectively unlimited stream of pseudorandom {@code double} values, each conforming to the given origin (inclusive) and bound (exclusive) @param randomNumberOrigin the origin (inclusive) of each random value @param randomNumberBound the bound (exclusive) of each random value @return a stream of pseudorandom {@code double} values, each with the given origin (inclusive) and bound (exclusive) @throws IllegalArgumentException if {@code randomNumberOrigin} is greater than or equal to {@code randomNumberBound}
[ "Returns", "an", "effectively", "unlimited", "stream", "of", "pseudorandom", "{", "@code", "double", "}", "values", "each", "conforming", "to", "the", "given", "origin", "(", "inclusive", ")", "and", "bound", "(", "exclusive", ")" ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/RandomCompat.java#L338-L356
autermann/yaml
src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java
YamlMappingNode.put
public T put(YamlNode key, boolean value) { """ Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this} """ return put(key, getNodeFactory().booleanNode(value)); }
java
public T put(YamlNode key, boolean value) { return put(key, getNodeFactory().booleanNode(value)); }
[ "public", "T", "put", "(", "YamlNode", "key", ",", "boolean", "value", ")", "{", "return", "put", "(", "key", ",", "getNodeFactory", "(", ")", ".", "booleanNode", "(", "value", ")", ")", ";", "}" ]
Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this}
[ "Adds", "the", "specified", "{", "@code", "key", "}", "/", "{", "@code", "value", "}", "pair", "to", "this", "mapping", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L324-L326
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/S.java
S.formatCurrency
public static String formatCurrency(ITemplate template, Object data, String currencyCode) { """ Transformer method. Format currency using specified parameters @param template @param data @param currencyCode @return the currency string See {@link #formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)} """ return formatCurrency(template, data, currencyCode, null); }
java
public static String formatCurrency(ITemplate template, Object data, String currencyCode) { return formatCurrency(template, data, currencyCode, null); }
[ "public", "static", "String", "formatCurrency", "(", "ITemplate", "template", ",", "Object", "data", ",", "String", "currencyCode", ")", "{", "return", "formatCurrency", "(", "template", ",", "data", ",", "currencyCode", ",", "null", ")", ";", "}" ]
Transformer method. Format currency using specified parameters @param template @param data @param currencyCode @return the currency string See {@link #formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)}
[ "Transformer", "method", ".", "Format", "currency", "using", "specified", "parameters" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/S.java#L1482-L1484
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatStreamReader.java
MapFlatStreamReader.copyStreamDescriptorWithSequence
private static StreamDescriptor copyStreamDescriptorWithSequence(StreamDescriptor streamDescriptor, int sequence) { """ Creates StreamDescriptor which is a copy of this one with the value of sequence changed to the value passed in. Recursively calls itself on the nested streams. """ List<StreamDescriptor> streamDescriptors = streamDescriptor.getNestedStreams().stream() .map(stream -> copyStreamDescriptorWithSequence(stream, sequence)) .collect(toImmutableList()); return new StreamDescriptor( streamDescriptor.getStreamName(), streamDescriptor.getStreamId(), streamDescriptor.getFieldName(), streamDescriptor.getStreamType(), streamDescriptor.getOrcDataSource(), streamDescriptors, sequence); }
java
private static StreamDescriptor copyStreamDescriptorWithSequence(StreamDescriptor streamDescriptor, int sequence) { List<StreamDescriptor> streamDescriptors = streamDescriptor.getNestedStreams().stream() .map(stream -> copyStreamDescriptorWithSequence(stream, sequence)) .collect(toImmutableList()); return new StreamDescriptor( streamDescriptor.getStreamName(), streamDescriptor.getStreamId(), streamDescriptor.getFieldName(), streamDescriptor.getStreamType(), streamDescriptor.getOrcDataSource(), streamDescriptors, sequence); }
[ "private", "static", "StreamDescriptor", "copyStreamDescriptorWithSequence", "(", "StreamDescriptor", "streamDescriptor", ",", "int", "sequence", ")", "{", "List", "<", "StreamDescriptor", ">", "streamDescriptors", "=", "streamDescriptor", ".", "getNestedStreams", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "stream", "->", "copyStreamDescriptorWithSequence", "(", "stream", ",", "sequence", ")", ")", ".", "collect", "(", "toImmutableList", "(", ")", ")", ";", "return", "new", "StreamDescriptor", "(", "streamDescriptor", ".", "getStreamName", "(", ")", ",", "streamDescriptor", ".", "getStreamId", "(", ")", ",", "streamDescriptor", ".", "getFieldName", "(", ")", ",", "streamDescriptor", ".", "getStreamType", "(", ")", ",", "streamDescriptor", ".", "getOrcDataSource", "(", ")", ",", "streamDescriptors", ",", "sequence", ")", ";", "}" ]
Creates StreamDescriptor which is a copy of this one with the value of sequence changed to the value passed in. Recursively calls itself on the nested streams.
[ "Creates", "StreamDescriptor", "which", "is", "a", "copy", "of", "this", "one", "with", "the", "value", "of", "sequence", "changed", "to", "the", "value", "passed", "in", ".", "Recursively", "calls", "itself", "on", "the", "nested", "streams", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatStreamReader.java#L263-L277
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/ActivityUtils.java
ActivityUtils.getCurrentActivity
public Activity getCurrentActivity(boolean shouldSleepFirst, boolean waitForActivity) { """ Returns the current {@code Activity}. @param shouldSleepFirst whether to sleep a default pause first @param waitForActivity whether to wait for the activity @return the current {@code Activity} """ if(shouldSleepFirst){ sleeper.sleep(); } if(!config.trackActivities){ return activity; } if(waitForActivity){ waitForActivityIfNotAvailable(); } if(!activityStack.isEmpty()){ activity=activityStack.peek().get(); } return activity; }
java
public Activity getCurrentActivity(boolean shouldSleepFirst, boolean waitForActivity) { if(shouldSleepFirst){ sleeper.sleep(); } if(!config.trackActivities){ return activity; } if(waitForActivity){ waitForActivityIfNotAvailable(); } if(!activityStack.isEmpty()){ activity=activityStack.peek().get(); } return activity; }
[ "public", "Activity", "getCurrentActivity", "(", "boolean", "shouldSleepFirst", ",", "boolean", "waitForActivity", ")", "{", "if", "(", "shouldSleepFirst", ")", "{", "sleeper", ".", "sleep", "(", ")", ";", "}", "if", "(", "!", "config", ".", "trackActivities", ")", "{", "return", "activity", ";", "}", "if", "(", "waitForActivity", ")", "{", "waitForActivityIfNotAvailable", "(", ")", ";", "}", "if", "(", "!", "activityStack", ".", "isEmpty", "(", ")", ")", "{", "activity", "=", "activityStack", ".", "peek", "(", ")", ".", "get", "(", ")", ";", "}", "return", "activity", ";", "}" ]
Returns the current {@code Activity}. @param shouldSleepFirst whether to sleep a default pause first @param waitForActivity whether to wait for the activity @return the current {@code Activity}
[ "Returns", "the", "current", "{", "@code", "Activity", "}", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/ActivityUtils.java#L295-L310
calimero-project/calimero-core
src/tuwien/auto/calimero/knxnetip/ConnectionBase.java
ConnectionBase.checkChannelId
protected boolean checkChannelId(final int id, final String svcType) { """ Validates channel id received in a packet against the one assigned to this connection. @param id received id to check @param svcType packet service type @return <code>true</code> if valid, <code>false</code> otherwise """ if (id == channelId) return true; logger.warn("received service " + svcType + " with wrong channel ID " + id + ", expected " + channelId + " - ignored"); return false; }
java
protected boolean checkChannelId(final int id, final String svcType) { if (id == channelId) return true; logger.warn("received service " + svcType + " with wrong channel ID " + id + ", expected " + channelId + " - ignored"); return false; }
[ "protected", "boolean", "checkChannelId", "(", "final", "int", "id", ",", "final", "String", "svcType", ")", "{", "if", "(", "id", "==", "channelId", ")", "return", "true", ";", "logger", ".", "warn", "(", "\"received service \"", "+", "svcType", "+", "\" with wrong channel ID \"", "+", "id", "+", "\", expected \"", "+", "channelId", "+", "\" - ignored\"", ")", ";", "return", "false", ";", "}" ]
Validates channel id received in a packet against the one assigned to this connection. @param id received id to check @param svcType packet service type @return <code>true</code> if valid, <code>false</code> otherwise
[ "Validates", "channel", "id", "received", "in", "a", "packet", "against", "the", "one", "assigned", "to", "this", "connection", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/ConnectionBase.java#L487-L494
trellis-ldp/trellis
core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java
HttpUtils.buildEtagHash
public static String buildEtagHash(final String identifier, final Instant modified, final Prefer prefer) { """ Build a hash value suitable for generating an ETag. @param identifier the resource identifier @param modified the last modified value @param prefer a prefer header, may be null @return a corresponding hash value """ final String sep = "."; final String hash = prefer != null ? prefer.getInclude().hashCode() + sep + prefer.getOmit().hashCode() : ""; return md5Hex(modified.toEpochMilli() + sep + modified.getNano() + sep + hash + sep + identifier); }
java
public static String buildEtagHash(final String identifier, final Instant modified, final Prefer prefer) { final String sep = "."; final String hash = prefer != null ? prefer.getInclude().hashCode() + sep + prefer.getOmit().hashCode() : ""; return md5Hex(modified.toEpochMilli() + sep + modified.getNano() + sep + hash + sep + identifier); }
[ "public", "static", "String", "buildEtagHash", "(", "final", "String", "identifier", ",", "final", "Instant", "modified", ",", "final", "Prefer", "prefer", ")", "{", "final", "String", "sep", "=", "\".\"", ";", "final", "String", "hash", "=", "prefer", "!=", "null", "?", "prefer", ".", "getInclude", "(", ")", ".", "hashCode", "(", ")", "+", "sep", "+", "prefer", ".", "getOmit", "(", ")", ".", "hashCode", "(", ")", ":", "\"\"", ";", "return", "md5Hex", "(", "modified", ".", "toEpochMilli", "(", ")", "+", "sep", "+", "modified", ".", "getNano", "(", ")", "+", "sep", "+", "hash", "+", "sep", "+", "identifier", ")", ";", "}" ]
Build a hash value suitable for generating an ETag. @param identifier the resource identifier @param modified the last modified value @param prefer a prefer header, may be null @return a corresponding hash value
[ "Build", "a", "hash", "value", "suitable", "for", "generating", "an", "ETag", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java#L113-L117
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMPreParser.java
OSMPreParser.startElement
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { """ Fires whenever an XML start markup is encountered. It indicates which version of osm file is to be parsed. @param uri URI of the local element @param localName Name of the local element (without prefix) @param qName qName of the local element (with prefix) @param attributes Attributes of the local element (contained in the markup) @throws SAXException Any SAX exception, possibly wrapping another exception """ if (localName.compareToIgnoreCase("osm") == 0) { version = attributes.getValue(GPXTags.VERSION); } else if (localName.compareToIgnoreCase("node") == 0) { totalNode++; } else if (localName.compareToIgnoreCase("way") == 0) { totalWay++; } else if (localName.compareToIgnoreCase("relation") == 0) { totalRelation++; } }
java
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (localName.compareToIgnoreCase("osm") == 0) { version = attributes.getValue(GPXTags.VERSION); } else if (localName.compareToIgnoreCase("node") == 0) { totalNode++; } else if (localName.compareToIgnoreCase("way") == 0) { totalWay++; } else if (localName.compareToIgnoreCase("relation") == 0) { totalRelation++; } }
[ "@", "Override", "public", "void", "startElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ",", "Attributes", "attributes", ")", "throws", "SAXException", "{", "if", "(", "localName", ".", "compareToIgnoreCase", "(", "\"osm\"", ")", "==", "0", ")", "{", "version", "=", "attributes", ".", "getValue", "(", "GPXTags", ".", "VERSION", ")", ";", "}", "else", "if", "(", "localName", ".", "compareToIgnoreCase", "(", "\"node\"", ")", "==", "0", ")", "{", "totalNode", "++", ";", "}", "else", "if", "(", "localName", ".", "compareToIgnoreCase", "(", "\"way\"", ")", "==", "0", ")", "{", "totalWay", "++", ";", "}", "else", "if", "(", "localName", ".", "compareToIgnoreCase", "(", "\"relation\"", ")", "==", "0", ")", "{", "totalRelation", "++", ";", "}", "}" ]
Fires whenever an XML start markup is encountered. It indicates which version of osm file is to be parsed. @param uri URI of the local element @param localName Name of the local element (without prefix) @param qName qName of the local element (with prefix) @param attributes Attributes of the local element (contained in the markup) @throws SAXException Any SAX exception, possibly wrapping another exception
[ "Fires", "whenever", "an", "XML", "start", "markup", "is", "encountered", ".", "It", "indicates", "which", "version", "of", "osm", "file", "is", "to", "be", "parsed", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMPreParser.java#L92-L103
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.cvSet
public List<Type> cvSet(int folds, Random rand) { """ Creates <tt>folds</tt> data sets that contain data from this data set. The data points in each set will be random. These are meant for cross validation @param folds the number of cross validation sets to create. Should be greater then 1 @param rand the source of randomness @return the list of data sets. """ double[] splits = new double[folds]; Arrays.fill(splits, 1.0/folds); return randomSplit(rand, splits); }
java
public List<Type> cvSet(int folds, Random rand) { double[] splits = new double[folds]; Arrays.fill(splits, 1.0/folds); return randomSplit(rand, splits); }
[ "public", "List", "<", "Type", ">", "cvSet", "(", "int", "folds", ",", "Random", "rand", ")", "{", "double", "[", "]", "splits", "=", "new", "double", "[", "folds", "]", ";", "Arrays", ".", "fill", "(", "splits", ",", "1.0", "/", "folds", ")", ";", "return", "randomSplit", "(", "rand", ",", "splits", ")", ";", "}" ]
Creates <tt>folds</tt> data sets that contain data from this data set. The data points in each set will be random. These are meant for cross validation @param folds the number of cross validation sets to create. Should be greater then 1 @param rand the source of randomness @return the list of data sets.
[ "Creates", "<tt", ">", "folds<", "/", "tt", ">", "data", "sets", "that", "contain", "data", "from", "this", "data", "set", ".", "The", "data", "points", "in", "each", "set", "will", "be", "random", ".", "These", "are", "meant", "for", "cross", "validation" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L580-L585
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java
GerritQueryHandler.queryJava
public List<JSONObject> queryJava(String queryString, boolean getPatchSets, boolean getCurrentPatchSet, boolean getFiles) throws SshException, IOException, GerritQueryException { """ Runs the query and returns the result as a list of Java JSONObjects. @param queryString the query. @param getPatchSets getPatchSets if all patch-sets of the projects found should be included in the result. Meaning if --patch-sets should be appended to the command call. @param getCurrentPatchSet if the current patch-set for the projects found should be included in the result. Meaning if --current-patch-set should be appended to the command call. @param getFiles if the files of the patch sets should be included in the result. Meaning if --files should be appended to the command call. @return the query result as a List of JSONObjects. @throws GerritQueryException if Gerrit reports an error with the query. @throws SshException if there is an error in the SSH Connection. @throws IOException for some other IO problem. """ return queryJava(queryString, getPatchSets, getCurrentPatchSet, getFiles, false); }
java
public List<JSONObject> queryJava(String queryString, boolean getPatchSets, boolean getCurrentPatchSet, boolean getFiles) throws SshException, IOException, GerritQueryException { return queryJava(queryString, getPatchSets, getCurrentPatchSet, getFiles, false); }
[ "public", "List", "<", "JSONObject", ">", "queryJava", "(", "String", "queryString", ",", "boolean", "getPatchSets", ",", "boolean", "getCurrentPatchSet", ",", "boolean", "getFiles", ")", "throws", "SshException", ",", "IOException", ",", "GerritQueryException", "{", "return", "queryJava", "(", "queryString", ",", "getPatchSets", ",", "getCurrentPatchSet", ",", "getFiles", ",", "false", ")", ";", "}" ]
Runs the query and returns the result as a list of Java JSONObjects. @param queryString the query. @param getPatchSets getPatchSets if all patch-sets of the projects found should be included in the result. Meaning if --patch-sets should be appended to the command call. @param getCurrentPatchSet if the current patch-set for the projects found should be included in the result. Meaning if --current-patch-set should be appended to the command call. @param getFiles if the files of the patch sets should be included in the result. Meaning if --files should be appended to the command call. @return the query result as a List of JSONObjects. @throws GerritQueryException if Gerrit reports an error with the query. @throws SshException if there is an error in the SSH Connection. @throws IOException for some other IO problem.
[ "Runs", "the", "query", "and", "returns", "the", "result", "as", "a", "list", "of", "Java", "JSONObjects", ".", "@param", "queryString", "the", "query", ".", "@param", "getPatchSets", "getPatchSets", "if", "all", "patch", "-", "sets", "of", "the", "projects", "found", "should", "be", "included", "in", "the", "result", ".", "Meaning", "if", "--", "patch", "-", "sets", "should", "be", "appended", "to", "the", "command", "call", ".", "@param", "getCurrentPatchSet", "if", "the", "current", "patch", "-", "set", "for", "the", "projects", "found", "should", "be", "included", "in", "the", "result", ".", "Meaning", "if", "--", "current", "-", "patch", "-", "set", "should", "be", "appended", "to", "the", "command", "call", ".", "@param", "getFiles", "if", "the", "files", "of", "the", "patch", "sets", "should", "be", "included", "in", "the", "result", ".", "Meaning", "if", "--", "files", "should", "be", "appended", "to", "the", "command", "call", "." ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L156-L159
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.setErrorCodeVariableOnErrorEventDefinition
protected void setErrorCodeVariableOnErrorEventDefinition(Element errorEventDefinition, ErrorEventDefinition definition) { """ Sets the value for "camunda:errorCodeVariable" on the passed definition if it's present. @param errorEventDefinition the XML errorEventDefinition tag @param definition the errorEventDefintion that can get the errorCodeVariable value """ String errorCodeVar = errorEventDefinition.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "errorCodeVariable"); if (errorCodeVar != null) { definition.setErrorCodeVariable(errorCodeVar); } }
java
protected void setErrorCodeVariableOnErrorEventDefinition(Element errorEventDefinition, ErrorEventDefinition definition) { String errorCodeVar = errorEventDefinition.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "errorCodeVariable"); if (errorCodeVar != null) { definition.setErrorCodeVariable(errorCodeVar); } }
[ "protected", "void", "setErrorCodeVariableOnErrorEventDefinition", "(", "Element", "errorEventDefinition", ",", "ErrorEventDefinition", "definition", ")", "{", "String", "errorCodeVar", "=", "errorEventDefinition", ".", "attributeNS", "(", "CAMUNDA_BPMN_EXTENSIONS_NS", ",", "\"errorCodeVariable\"", ")", ";", "if", "(", "errorCodeVar", "!=", "null", ")", "{", "definition", ".", "setErrorCodeVariable", "(", "errorCodeVar", ")", ";", "}", "}" ]
Sets the value for "camunda:errorCodeVariable" on the passed definition if it's present. @param errorEventDefinition the XML errorEventDefinition tag @param definition the errorEventDefintion that can get the errorCodeVariable value
[ "Sets", "the", "value", "for", "camunda", ":", "errorCodeVariable", "on", "the", "passed", "definition", "if", "it", "s", "present", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L1122-L1127
gallandarakhneorg/afc
advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ShapeFileIndexReader.java
ShapeFileIndexReader.seek
@Override public void seek(int recordIndex) throws IOException { """ Move the reading head at the specified record index. <p>If the index is negative, the next record to read is assumed to be the first record. If the index is greater or equals to the count of records, the exception {@link EOFException} will be thrown. @param recordIndex is the index of record to reply at the next read. @throws IOException in case of error. """ readHeader(); int ri = recordIndex; if (ri < 0) { ri = 0; } if (ri >= this.recordCount) { throw new EOFException(); } // Goto the record setReadingPosition(recordIndex, RECORD_SIZE * ri); }
java
@Override public void seek(int recordIndex) throws IOException { readHeader(); int ri = recordIndex; if (ri < 0) { ri = 0; } if (ri >= this.recordCount) { throw new EOFException(); } // Goto the record setReadingPosition(recordIndex, RECORD_SIZE * ri); }
[ "@", "Override", "public", "void", "seek", "(", "int", "recordIndex", ")", "throws", "IOException", "{", "readHeader", "(", ")", ";", "int", "ri", "=", "recordIndex", ";", "if", "(", "ri", "<", "0", ")", "{", "ri", "=", "0", ";", "}", "if", "(", "ri", ">=", "this", ".", "recordCount", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "// Goto the record", "setReadingPosition", "(", "recordIndex", ",", "RECORD_SIZE", "*", "ri", ")", ";", "}" ]
Move the reading head at the specified record index. <p>If the index is negative, the next record to read is assumed to be the first record. If the index is greater or equals to the count of records, the exception {@link EOFException} will be thrown. @param recordIndex is the index of record to reply at the next read. @throws IOException in case of error.
[ "Move", "the", "reading", "head", "at", "the", "specified", "record", "index", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ShapeFileIndexReader.java#L116-L129
danieldk/dictomaton
src/main/java/eu/danieldk/dictomaton/CompactIntArray.java
CompactIntArray.binarySearch
public int binarySearch(int fromIndex, int toIndex, int value) { """ Search a value in the array, the subarray <i>(fromIndex, toIndex]</i> should be sorted. @param fromIndex The index of the first element to be searched. @param toIndex The index of the last element to be searched (exclusive). @param value The value to be searched. @return """ --toIndex; while (toIndex >= fromIndex) { int mid = (fromIndex + toIndex) >>> 1; int midVal = get(mid); if (midVal > value) toIndex = mid - 1; else if (midVal < value) fromIndex = mid + 1; else return mid; } return -(fromIndex + 1); }
java
public int binarySearch(int fromIndex, int toIndex, int value) { --toIndex; while (toIndex >= fromIndex) { int mid = (fromIndex + toIndex) >>> 1; int midVal = get(mid); if (midVal > value) toIndex = mid - 1; else if (midVal < value) fromIndex = mid + 1; else return mid; } return -(fromIndex + 1); }
[ "public", "int", "binarySearch", "(", "int", "fromIndex", ",", "int", "toIndex", ",", "int", "value", ")", "{", "--", "toIndex", ";", "while", "(", "toIndex", ">=", "fromIndex", ")", "{", "int", "mid", "=", "(", "fromIndex", "+", "toIndex", ")", ">>>", "1", ";", "int", "midVal", "=", "get", "(", "mid", ")", ";", "if", "(", "midVal", ">", "value", ")", "toIndex", "=", "mid", "-", "1", ";", "else", "if", "(", "midVal", "<", "value", ")", "fromIndex", "=", "mid", "+", "1", ";", "else", "return", "mid", ";", "}", "return", "-", "(", "fromIndex", "+", "1", ")", ";", "}" ]
Search a value in the array, the subarray <i>(fromIndex, toIndex]</i> should be sorted. @param fromIndex The index of the first element to be searched. @param toIndex The index of the last element to be searched (exclusive). @param value The value to be searched. @return
[ "Search", "a", "value", "in", "the", "array", "the", "subarray", "<i", ">", "(", "fromIndex", "toIndex", "]", "<", "/", "i", ">", "should", "be", "sorted", "." ]
train
https://github.com/danieldk/dictomaton/blob/c0a3ae2d407ebd88023ea2d0f02a4882b0492df0/src/main/java/eu/danieldk/dictomaton/CompactIntArray.java#L64-L82
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.getHybridConnection
public HybridConnectionInner getHybridConnection(String resourceGroupName, String name, String namespaceName, String relayName) { """ Retrieve a Hybrid Connection in use in an App Service plan. Retrieve a Hybrid Connection in use in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param namespaceName Name of the Service Bus namespace. @param relayName Name of the Service Bus relay. @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 HybridConnectionInner object if successful. """ return getHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single().body(); }
java
public HybridConnectionInner getHybridConnection(String resourceGroupName, String name, String namespaceName, String relayName) { return getHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single().body(); }
[ "public", "HybridConnectionInner", "getHybridConnection", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "namespaceName", ",", "String", "relayName", ")", "{", "return", "getHybridConnectionWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "namespaceName", ",", "relayName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve a Hybrid Connection in use in an App Service plan. Retrieve a Hybrid Connection in use in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param namespaceName Name of the Service Bus namespace. @param relayName Name of the Service Bus relay. @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 HybridConnectionInner object if successful.
[ "Retrieve", "a", "Hybrid", "Connection", "in", "use", "in", "an", "App", "Service", "plan", ".", "Retrieve", "a", "Hybrid", "Connection", "in", "use", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1135-L1137
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.getAt
public static String getAt(CharSequence self, Collection indices) { """ Select a List of characters from a CharSequence using a Collection to identify the indices to be selected. @param self a CharSequence @param indices a Collection of indices @return a String consisting of the characters at the given indices @since 1.0 """ StringBuilder answer = new StringBuilder(); for (Object value : indices) { if (value instanceof Range) { answer.append(getAt(self, (Range) value)); } else if (value instanceof Collection) { answer.append(getAt(self, (Collection) value)); } else { int idx = DefaultTypeTransformation.intUnbox(value); answer.append(getAt(self, idx)); } } return answer.toString(); }
java
public static String getAt(CharSequence self, Collection indices) { StringBuilder answer = new StringBuilder(); for (Object value : indices) { if (value instanceof Range) { answer.append(getAt(self, (Range) value)); } else if (value instanceof Collection) { answer.append(getAt(self, (Collection) value)); } else { int idx = DefaultTypeTransformation.intUnbox(value); answer.append(getAt(self, idx)); } } return answer.toString(); }
[ "public", "static", "String", "getAt", "(", "CharSequence", "self", ",", "Collection", "indices", ")", "{", "StringBuilder", "answer", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "value", ":", "indices", ")", "{", "if", "(", "value", "instanceof", "Range", ")", "{", "answer", ".", "append", "(", "getAt", "(", "self", ",", "(", "Range", ")", "value", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "Collection", ")", "{", "answer", ".", "append", "(", "getAt", "(", "self", ",", "(", "Collection", ")", "value", ")", ")", ";", "}", "else", "{", "int", "idx", "=", "DefaultTypeTransformation", ".", "intUnbox", "(", "value", ")", ";", "answer", ".", "append", "(", "getAt", "(", "self", ",", "idx", ")", ")", ";", "}", "}", "return", "answer", ".", "toString", "(", ")", ";", "}" ]
Select a List of characters from a CharSequence using a Collection to identify the indices to be selected. @param self a CharSequence @param indices a Collection of indices @return a String consisting of the characters at the given indices @since 1.0
[ "Select", "a", "List", "of", "characters", "from", "a", "CharSequence", "using", "a", "Collection", "to", "identify", "the", "indices", "to", "be", "selected", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1205-L1218
osglworks/java-tool
src/main/java/org/osgl/Lang.java
F5.andThen
public F5<P1, P2, P3, P4, P5, R> andThen( final Func5<? super P1, ? super P2, ? super P3, ? super P4, ? super P5, ? extends R>... fs ) { """ Returns a composed function that applied, in sequence, this function and all functions specified one by one. If applying anyone of the functions throws an exception, it is relayed to the caller of the composed function. If an exception is thrown out, the following functions will not be applied. <p>When apply the composed function, the result of the last function is returned</p> @param fs a sequence of function to be applied after this function @return a composed function """ if (0 == fs.length) { return this; } final F5<P1, P2, P3, P4, P5, R> me = this; return new F5<P1, P2, P3, P4, P5, R>() { @Override public R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { R r = me.apply(p1, p2, p3, p4, p5); for (Func5<? super P1, ? super P2, ? super P3, ? super P4, ? super P5, ? extends R> f : fs) { r = f.apply(p1, p2, p3, p4, p5); } return r; } }; }
java
public F5<P1, P2, P3, P4, P5, R> andThen( final Func5<? super P1, ? super P2, ? super P3, ? super P4, ? super P5, ? extends R>... fs ) { if (0 == fs.length) { return this; } final F5<P1, P2, P3, P4, P5, R> me = this; return new F5<P1, P2, P3, P4, P5, R>() { @Override public R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { R r = me.apply(p1, p2, p3, p4, p5); for (Func5<? super P1, ? super P2, ? super P3, ? super P4, ? super P5, ? extends R> f : fs) { r = f.apply(p1, p2, p3, p4, p5); } return r; } }; }
[ "public", "F5", "<", "P1", ",", "P2", ",", "P3", ",", "P4", ",", "P5", ",", "R", ">", "andThen", "(", "final", "Func5", "<", "?", "super", "P1", ",", "?", "super", "P2", ",", "?", "super", "P3", ",", "?", "super", "P4", ",", "?", "super", "P5", ",", "?", "extends", "R", ">", "...", "fs", ")", "{", "if", "(", "0", "==", "fs", ".", "length", ")", "{", "return", "this", ";", "}", "final", "F5", "<", "P1", ",", "P2", ",", "P3", ",", "P4", ",", "P5", ",", "R", ">", "me", "=", "this", ";", "return", "new", "F5", "<", "P1", ",", "P2", ",", "P3", ",", "P4", ",", "P5", ",", "R", ">", "(", ")", "{", "@", "Override", "public", "R", "apply", "(", "P1", "p1", ",", "P2", "p2", ",", "P3", "p3", ",", "P4", "p4", ",", "P5", "p5", ")", "{", "R", "r", "=", "me", ".", "apply", "(", "p1", ",", "p2", ",", "p3", ",", "p4", ",", "p5", ")", ";", "for", "(", "Func5", "<", "?", "super", "P1", ",", "?", "super", "P2", ",", "?", "super", "P3", ",", "?", "super", "P4", ",", "?", "super", "P5", ",", "?", "extends", "R", ">", "f", ":", "fs", ")", "{", "r", "=", "f", ".", "apply", "(", "p1", ",", "p2", ",", "p3", ",", "p4", ",", "p5", ")", ";", "}", "return", "r", ";", "}", "}", ";", "}" ]
Returns a composed function that applied, in sequence, this function and all functions specified one by one. If applying anyone of the functions throws an exception, it is relayed to the caller of the composed function. If an exception is thrown out, the following functions will not be applied. <p>When apply the composed function, the result of the last function is returned</p> @param fs a sequence of function to be applied after this function @return a composed function
[ "Returns", "a", "composed", "function", "that", "applied", "in", "sequence", "this", "function", "and", "all", "functions", "specified", "one", "by", "one", ".", "If", "applying", "anyone", "of", "the", "functions", "throws", "an", "exception", "it", "is", "relayed", "to", "the", "caller", "of", "the", "composed", "function", ".", "If", "an", "exception", "is", "thrown", "out", "the", "following", "functions", "will", "not", "be", "applied", ".", "<p", ">", "When", "apply", "the", "composed", "function", "the", "result", "of", "the", "last", "function", "is", "returned<", "/", "p", ">" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1890-L1908
UrielCh/ovh-java-sdk
ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java
ApiOvhCaasregistry.serviceName_namespaces_namespaceId_GET
public OvhNamespace serviceName_namespaces_namespaceId_GET(String serviceName, String namespaceId) throws IOException { """ Inspect namespace REST: GET /caas/registry/{serviceName}/namespaces/{namespaceId} @param namespaceId [required] Namespace id @param serviceName [required] Service name API beta """ String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}"; StringBuilder sb = path(qPath, serviceName, namespaceId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNamespace.class); }
java
public OvhNamespace serviceName_namespaces_namespaceId_GET(String serviceName, String namespaceId) throws IOException { String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}"; StringBuilder sb = path(qPath, serviceName, namespaceId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNamespace.class); }
[ "public", "OvhNamespace", "serviceName_namespaces_namespaceId_GET", "(", "String", "serviceName", ",", "String", "namespaceId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/registry/{serviceName}/namespaces/{namespaceId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "namespaceId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhNamespace", ".", "class", ")", ";", "}" ]
Inspect namespace REST: GET /caas/registry/{serviceName}/namespaces/{namespaceId} @param namespaceId [required] Namespace id @param serviceName [required] Service name API beta
[ "Inspect", "namespace" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L387-L392
yanzhenjie/AndPermission
support/src/main/java/com/yanzhenjie/permission/AndPermission.java
AndPermission.hasAlwaysDeniedPermission
public static boolean hasAlwaysDeniedPermission(Context context, List<String> deniedPermissions) { """ Some privileges permanently disabled, may need to set up in the execute. @param context {@link Context}. @param deniedPermissions one or more permissions. @return true, other wise is false. """ return hasAlwaysDeniedPermission(getContextSource(context), deniedPermissions); }
java
public static boolean hasAlwaysDeniedPermission(Context context, List<String> deniedPermissions) { return hasAlwaysDeniedPermission(getContextSource(context), deniedPermissions); }
[ "public", "static", "boolean", "hasAlwaysDeniedPermission", "(", "Context", "context", ",", "List", "<", "String", ">", "deniedPermissions", ")", "{", "return", "hasAlwaysDeniedPermission", "(", "getContextSource", "(", "context", ")", ",", "deniedPermissions", ")", ";", "}" ]
Some privileges permanently disabled, may need to set up in the execute. @param context {@link Context}. @param deniedPermissions one or more permissions. @return true, other wise is false.
[ "Some", "privileges", "permanently", "disabled", "may", "need", "to", "set", "up", "in", "the", "execute", "." ]
train
https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/AndPermission.java#L94-L96
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java
OpenShiftManagedClustersInner.createOrUpdateAsync
public Observable<OpenShiftManagedClusterInner> createOrUpdateAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { """ Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. @param resourceGroupName The name of the resource group. @param resourceName The name of the OpenShift managed cluster resource. @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() { @Override public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) { return response.body(); } }); }
java
public Observable<OpenShiftManagedClusterInner> createOrUpdateAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() { @Override public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OpenShiftManagedClusterInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "OpenShiftManagedClusterInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OpenShiftManagedClusterInner", ">", ",", "OpenShiftManagedClusterInner", ">", "(", ")", "{", "@", "Override", "public", "OpenShiftManagedClusterInner", "call", "(", "ServiceResponse", "<", "OpenShiftManagedClusterInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. @param resourceGroupName The name of the resource group. @param resourceName The name of the OpenShift managed cluster resource. @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "an", "OpenShift", "managed", "cluster", ".", "Creates", "or", "updates", "a", "OpenShift", "managed", "cluster", "with", "the", "specified", "configuration", "for", "agents", "and", "OpenShift", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java#L473-L480
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlAnnotationType annotation, PyAppendable it, IExtraLanguageGeneratorContext context) { """ Generate the given object. @param annotation the annotation. @param it the target for the generated content. @param context the context. """ generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(), annotation.getName(), false, Collections.emptyList(), getTypeBuilder().getDocumentation(annotation), true, annotation.getMembers(), it, context, null); }
java
protected void _generate(SarlAnnotationType annotation, PyAppendable it, IExtraLanguageGeneratorContext context) { generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(), annotation.getName(), false, Collections.emptyList(), getTypeBuilder().getDocumentation(annotation), true, annotation.getMembers(), it, context, null); }
[ "protected", "void", "_generate", "(", "SarlAnnotationType", "annotation", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "generateTypeDeclaration", "(", "this", ".", "qualifiedNameProvider", ".", "getFullyQualifiedName", "(", "annotation", ")", ".", "toString", "(", ")", ",", "annotation", ".", "getName", "(", ")", ",", "false", ",", "Collections", ".", "emptyList", "(", ")", ",", "getTypeBuilder", "(", ")", ".", "getDocumentation", "(", "annotation", ")", ",", "true", ",", "annotation", ".", "getMembers", "(", ")", ",", "it", ",", "context", ",", "null", ")", ";", "}" ]
Generate the given object. @param annotation the annotation. @param it the target for the generated content. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L923-L930
drapostolos/type-parser
src/main/java/com/github/drapostolos/typeparser/TypeParser.java
TypeParser.parseType
public Object parseType(String input, Type targetType) { """ Parses the given {@code input} string to the given {@code targetType}. <p/> @param input - string value to parse. @param targetType - the expected type to convert {@code input} to. @return an instance of {@code targetType} corresponding to the given {@code input}. @throws NullPointerException if any given argument is {@code null}. @throws TypeParserException if anything goes wrong while parsing {@code input} to the given {@code targetType}. @throws NoSuchRegisteredParserException if there is no registered {@link Parser} for the given {@code targetType}. """ if (input == null) { throw new NullPointerException(makeNullArgumentErrorMsg("input")); } if (targetType == null) { throw new NullPointerException(makeNullArgumentErrorMsg("targetType")); } return parseType2(input, new TargetType(targetType)); }
java
public Object parseType(String input, Type targetType) { if (input == null) { throw new NullPointerException(makeNullArgumentErrorMsg("input")); } if (targetType == null) { throw new NullPointerException(makeNullArgumentErrorMsg("targetType")); } return parseType2(input, new TargetType(targetType)); }
[ "public", "Object", "parseType", "(", "String", "input", ",", "Type", "targetType", ")", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "makeNullArgumentErrorMsg", "(", "\"input\"", ")", ")", ";", "}", "if", "(", "targetType", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "makeNullArgumentErrorMsg", "(", "\"targetType\"", ")", ")", ";", "}", "return", "parseType2", "(", "input", ",", "new", "TargetType", "(", "targetType", ")", ")", ";", "}" ]
Parses the given {@code input} string to the given {@code targetType}. <p/> @param input - string value to parse. @param targetType - the expected type to convert {@code input} to. @return an instance of {@code targetType} corresponding to the given {@code input}. @throws NullPointerException if any given argument is {@code null}. @throws TypeParserException if anything goes wrong while parsing {@code input} to the given {@code targetType}. @throws NoSuchRegisteredParserException if there is no registered {@link Parser} for the given {@code targetType}.
[ "Parses", "the", "given", "{", "@code", "input", "}", "string", "to", "the", "given", "{", "@code", "targetType", "}", ".", "<p", "/", ">" ]
train
https://github.com/drapostolos/type-parser/blob/74c66311f8dd009897c74ab5069e36c045cda073/src/main/java/com/github/drapostolos/typeparser/TypeParser.java#L127-L137
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java
LocalizedMessage.getFormattedMessage
@Override public String getFormattedMessage() { """ Returns the formatted message after looking up the format in the resource bundle. @return The formatted message String. """ if (formattedMessage != null) { return formattedMessage; } ResourceBundle bundle = this.resourceBundle; if (bundle == null) { if (baseName != null) { bundle = getResourceBundle(baseName, locale, false); } else { bundle = getResourceBundle(loggerName, locale, true); } } final String myKey = getFormat(); final String msgPattern = (bundle == null || !bundle.containsKey(myKey)) ? myKey : bundle.getString(myKey); final Object[] array = argArray == null ? stringArgs : argArray; final FormattedMessage msg = new FormattedMessage(msgPattern, array); formattedMessage = msg.getFormattedMessage(); throwable = msg.getThrowable(); return formattedMessage; }
java
@Override public String getFormattedMessage() { if (formattedMessage != null) { return formattedMessage; } ResourceBundle bundle = this.resourceBundle; if (bundle == null) { if (baseName != null) { bundle = getResourceBundle(baseName, locale, false); } else { bundle = getResourceBundle(loggerName, locale, true); } } final String myKey = getFormat(); final String msgPattern = (bundle == null || !bundle.containsKey(myKey)) ? myKey : bundle.getString(myKey); final Object[] array = argArray == null ? stringArgs : argArray; final FormattedMessage msg = new FormattedMessage(msgPattern, array); formattedMessage = msg.getFormattedMessage(); throwable = msg.getThrowable(); return formattedMessage; }
[ "@", "Override", "public", "String", "getFormattedMessage", "(", ")", "{", "if", "(", "formattedMessage", "!=", "null", ")", "{", "return", "formattedMessage", ";", "}", "ResourceBundle", "bundle", "=", "this", ".", "resourceBundle", ";", "if", "(", "bundle", "==", "null", ")", "{", "if", "(", "baseName", "!=", "null", ")", "{", "bundle", "=", "getResourceBundle", "(", "baseName", ",", "locale", ",", "false", ")", ";", "}", "else", "{", "bundle", "=", "getResourceBundle", "(", "loggerName", ",", "locale", ",", "true", ")", ";", "}", "}", "final", "String", "myKey", "=", "getFormat", "(", ")", ";", "final", "String", "msgPattern", "=", "(", "bundle", "==", "null", "||", "!", "bundle", ".", "containsKey", "(", "myKey", ")", ")", "?", "myKey", ":", "bundle", ".", "getString", "(", "myKey", ")", ";", "final", "Object", "[", "]", "array", "=", "argArray", "==", "null", "?", "stringArgs", ":", "argArray", ";", "final", "FormattedMessage", "msg", "=", "new", "FormattedMessage", "(", "msgPattern", ",", "array", ")", ";", "formattedMessage", "=", "msg", ".", "getFormattedMessage", "(", ")", ";", "throwable", "=", "msg", ".", "getThrowable", "(", ")", ";", "return", "formattedMessage", ";", "}" ]
Returns the formatted message after looking up the format in the resource bundle. @return The formatted message String.
[ "Returns", "the", "formatted", "message", "after", "looking", "up", "the", "format", "in", "the", "resource", "bundle", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessage.java#L179-L199
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java
WorkManagerImpl.beforeRunCheck
@Trivial private void beforeRunCheck( Work work, WorkListener workListener, long startTimeout) throws WorkRejectedException { """ Input parameter checks that can be done before calling run. @param work @param workListener @param startTimeout @throws WorkRejectedException """ WorkRejectedException wrex = null; if (work == null) { wrex = new WorkRejectedException(new NullPointerException("work")); wrex.setErrorCode(WorkException.UNDEFINED); } else if (startTimeout < WorkManager.IMMEDIATE) wrex = new WorkRejectedException("startTimeout=" + startTimeout, WorkException.START_TIMED_OUT); else if (stopped) wrex = new WorkRejectedException(new UnavailableException(bootstrapContext.resourceAdapterID)); if (wrex != null) { if (workListener != null) { WorkEvent event = new WorkEvent(work == null ? this : work, WorkEvent.WORK_REJECTED, work, wrex); workListener.workRejected(event); } throw wrex; } }
java
@Trivial private void beforeRunCheck( Work work, WorkListener workListener, long startTimeout) throws WorkRejectedException { WorkRejectedException wrex = null; if (work == null) { wrex = new WorkRejectedException(new NullPointerException("work")); wrex.setErrorCode(WorkException.UNDEFINED); } else if (startTimeout < WorkManager.IMMEDIATE) wrex = new WorkRejectedException("startTimeout=" + startTimeout, WorkException.START_TIMED_OUT); else if (stopped) wrex = new WorkRejectedException(new UnavailableException(bootstrapContext.resourceAdapterID)); if (wrex != null) { if (workListener != null) { WorkEvent event = new WorkEvent(work == null ? this : work, WorkEvent.WORK_REJECTED, work, wrex); workListener.workRejected(event); } throw wrex; } }
[ "@", "Trivial", "private", "void", "beforeRunCheck", "(", "Work", "work", ",", "WorkListener", "workListener", ",", "long", "startTimeout", ")", "throws", "WorkRejectedException", "{", "WorkRejectedException", "wrex", "=", "null", ";", "if", "(", "work", "==", "null", ")", "{", "wrex", "=", "new", "WorkRejectedException", "(", "new", "NullPointerException", "(", "\"work\"", ")", ")", ";", "wrex", ".", "setErrorCode", "(", "WorkException", ".", "UNDEFINED", ")", ";", "}", "else", "if", "(", "startTimeout", "<", "WorkManager", ".", "IMMEDIATE", ")", "wrex", "=", "new", "WorkRejectedException", "(", "\"startTimeout=\"", "+", "startTimeout", ",", "WorkException", ".", "START_TIMED_OUT", ")", ";", "else", "if", "(", "stopped", ")", "wrex", "=", "new", "WorkRejectedException", "(", "new", "UnavailableException", "(", "bootstrapContext", ".", "resourceAdapterID", ")", ")", ";", "if", "(", "wrex", "!=", "null", ")", "{", "if", "(", "workListener", "!=", "null", ")", "{", "WorkEvent", "event", "=", "new", "WorkEvent", "(", "work", "==", "null", "?", "this", ":", "work", ",", "WorkEvent", ".", "WORK_REJECTED", ",", "work", ",", "wrex", ")", ";", "workListener", ".", "workRejected", "(", "event", ")", ";", "}", "throw", "wrex", ";", "}", "}" ]
Input parameter checks that can be done before calling run. @param work @param workListener @param startTimeout @throws WorkRejectedException
[ "Input", "parameter", "checks", "that", "can", "be", "done", "before", "calling", "run", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/WorkManagerImpl.java#L273-L295
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
TransactionableDataManager.getItemData
public ItemData getItemData(String identifier, boolean checkChangesLogOnly) throws RepositoryException { """ Return item data by identifier in this transient storage then in storage container. @param identifier @param checkChangesLogOnly @return existed item data or null if not found @throws RepositoryException @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(java.lang.String) """ if (txStarted()) { ItemState state = transactionLog.getItemState(identifier); if (state != null) { return state.isDeleted() ? null : state.getData(); } } return (checkChangesLogOnly) ? null: storageDataManager.getItemData(identifier); }
java
public ItemData getItemData(String identifier, boolean checkChangesLogOnly) throws RepositoryException { if (txStarted()) { ItemState state = transactionLog.getItemState(identifier); if (state != null) { return state.isDeleted() ? null : state.getData(); } } return (checkChangesLogOnly) ? null: storageDataManager.getItemData(identifier); }
[ "public", "ItemData", "getItemData", "(", "String", "identifier", ",", "boolean", "checkChangesLogOnly", ")", "throws", "RepositoryException", "{", "if", "(", "txStarted", "(", ")", ")", "{", "ItemState", "state", "=", "transactionLog", ".", "getItemState", "(", "identifier", ")", ";", "if", "(", "state", "!=", "null", ")", "{", "return", "state", ".", "isDeleted", "(", ")", "?", "null", ":", "state", ".", "getData", "(", ")", ";", "}", "}", "return", "(", "checkChangesLogOnly", ")", "?", "null", ":", "storageDataManager", ".", "getItemData", "(", "identifier", ")", ";", "}" ]
Return item data by identifier in this transient storage then in storage container. @param identifier @param checkChangesLogOnly @return existed item data or null if not found @throws RepositoryException @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(java.lang.String)
[ "Return", "item", "data", "by", "identifier", "in", "this", "transient", "storage", "then", "in", "storage", "container", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java#L389-L402
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.failoverPriorityChange
public void failoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) { """ Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param failoverPolicies List of failover policies. @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 """ failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().last().body(); }
java
public void failoverPriorityChange(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) { failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().last().body(); }
[ "public", "void", "failoverPriorityChange", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "List", "<", "FailoverPolicy", ">", "failoverPolicies", ")", "{", "failoverPriorityChangeWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "failoverPolicies", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param failoverPolicies List of failover policies. @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
[ "Changes", "the", "failover", "priority", "for", "the", "Azure", "Cosmos", "DB", "database", "account", ".", "A", "failover", "priority", "of", "0", "indicates", "a", "write", "region", ".", "The", "maximum", "value", "for", "a", "failover", "priority", "=", "(", "total", "number", "of", "regions", "-", "1", ")", ".", "Failover", "priority", "values", "must", "be", "unique", "for", "each", "of", "the", "regions", "in", "which", "the", "database", "account", "exists", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L769-L771
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java
ClassificationService.attachClassification
public ClassificationModel attachClassification(GraphRewrite event, ClassificationModel classificationModel, FileModel fileModel) { """ This method just attaches the {@link ClassificationModel} to the {@link FileModel}. It will only do so if this link is not already present. """ if (fileModel instanceof DuplicateArchiveModel) { fileModel = ((DuplicateArchiveModel) fileModel).getCanonicalArchive(); } if (!isClassificationLinkedToFileModel(event, classificationModel, fileModel)) { classificationModel.addFileModel(fileModel); if (fileModel instanceof SourceFileModel) ((SourceFileModel) fileModel).setGenerateSourceReport(true); } ClassificationServiceCache.cacheClassificationFileModel(event, classificationModel, fileModel, true); return classificationModel; }
java
public ClassificationModel attachClassification(GraphRewrite event, ClassificationModel classificationModel, FileModel fileModel) { if (fileModel instanceof DuplicateArchiveModel) { fileModel = ((DuplicateArchiveModel) fileModel).getCanonicalArchive(); } if (!isClassificationLinkedToFileModel(event, classificationModel, fileModel)) { classificationModel.addFileModel(fileModel); if (fileModel instanceof SourceFileModel) ((SourceFileModel) fileModel).setGenerateSourceReport(true); } ClassificationServiceCache.cacheClassificationFileModel(event, classificationModel, fileModel, true); return classificationModel; }
[ "public", "ClassificationModel", "attachClassification", "(", "GraphRewrite", "event", ",", "ClassificationModel", "classificationModel", ",", "FileModel", "fileModel", ")", "{", "if", "(", "fileModel", "instanceof", "DuplicateArchiveModel", ")", "{", "fileModel", "=", "(", "(", "DuplicateArchiveModel", ")", "fileModel", ")", ".", "getCanonicalArchive", "(", ")", ";", "}", "if", "(", "!", "isClassificationLinkedToFileModel", "(", "event", ",", "classificationModel", ",", "fileModel", ")", ")", "{", "classificationModel", ".", "addFileModel", "(", "fileModel", ")", ";", "if", "(", "fileModel", "instanceof", "SourceFileModel", ")", "(", "(", "SourceFileModel", ")", "fileModel", ")", ".", "setGenerateSourceReport", "(", "true", ")", ";", "}", "ClassificationServiceCache", ".", "cacheClassificationFileModel", "(", "event", ",", "classificationModel", ",", "fileModel", ",", "true", ")", ";", "return", "classificationModel", ";", "}" ]
This method just attaches the {@link ClassificationModel} to the {@link FileModel}. It will only do so if this link is not already present.
[ "This", "method", "just", "attaches", "the", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java#L296-L312
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/vectorwriter/OmsVectorWriter.java
OmsVectorWriter.writeVector
public static void writeVector( String path, SimpleFeatureCollection featureCollection ) throws IOException { """ Fast write access mode. @param path the vector file path. @param featureCollection the {@link FeatureCollection} to write. @throws IOException """ OmsVectorWriter writer = new OmsVectorWriter(); writer.file = path; writer.inVector = featureCollection; writer.process(); }
java
public static void writeVector( String path, SimpleFeatureCollection featureCollection ) throws IOException { OmsVectorWriter writer = new OmsVectorWriter(); writer.file = path; writer.inVector = featureCollection; writer.process(); }
[ "public", "static", "void", "writeVector", "(", "String", "path", ",", "SimpleFeatureCollection", "featureCollection", ")", "throws", "IOException", "{", "OmsVectorWriter", "writer", "=", "new", "OmsVectorWriter", "(", ")", ";", "writer", ".", "file", "=", "path", ";", "writer", ".", "inVector", "=", "featureCollection", ";", "writer", ".", "process", "(", ")", ";", "}" ]
Fast write access mode. @param path the vector file path. @param featureCollection the {@link FeatureCollection} to write. @throws IOException
[ "Fast", "write", "access", "mode", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/vectorwriter/OmsVectorWriter.java#L102-L107
timothyb89/EventBus
src/main/java/org/timothyb89/eventbus/EventBus.java
EventBus.registerMethod
protected void registerMethod( Object o, Method m, int priority, boolean vetoable) { """ Registers the given method to the event bus. The object is assumed to be of the class that contains the given method. <p>The method parameters are checked and added to the event queue corresponding to the {@link Event} used as the first method parameter. In other words, if passed a reference to the following method:</p> <p><code> public void xyzHandler(XYZEvent event) { ... } </code></p> <p>... <code>xyzHandler</code> will be added to the event queue for {@code XYZEvent} assuming that {@code XYZEvent} extends {@link Event} and an event queue has been created for that event type.</p> @param o an instance of the class containing the method <code>m</code> @param m the method to register @param priority the event priority @param vetoable vetoable flag """ // check the parameter types, and attempt to resolve the event // type if (m.getParameterTypes().length != 1) { log.warn("Skipping invalid event handler definition: " + m); return; } // make sure the parameter is an Event // this additional/technically unneeded check should cut down on the // time required to process the loop over the definitions for methods // that don't match Class<?> param = m.getParameterTypes()[0]; if (!Event.class.isAssignableFrom(param)) { log.warn("Skipping event handler without an Event parameter: " + m); return; } // add the method to all assignable definitions. // this may result in the method being added to multiple queues, // that is, the queues for each superclass. // (this is intended and is fundamentally what makes subclassed events // work as expected) for (EventQueueDefinition d : definitions) { if (param.isAssignableFrom(d.getEventType())) { d.add(new EventQueueEntry(o, m, priority, vetoable)); log.debug("Added {} to queue {}", m, d.getEventType()); } } }
java
protected void registerMethod( Object o, Method m, int priority, boolean vetoable) { // check the parameter types, and attempt to resolve the event // type if (m.getParameterTypes().length != 1) { log.warn("Skipping invalid event handler definition: " + m); return; } // make sure the parameter is an Event // this additional/technically unneeded check should cut down on the // time required to process the loop over the definitions for methods // that don't match Class<?> param = m.getParameterTypes()[0]; if (!Event.class.isAssignableFrom(param)) { log.warn("Skipping event handler without an Event parameter: " + m); return; } // add the method to all assignable definitions. // this may result in the method being added to multiple queues, // that is, the queues for each superclass. // (this is intended and is fundamentally what makes subclassed events // work as expected) for (EventQueueDefinition d : definitions) { if (param.isAssignableFrom(d.getEventType())) { d.add(new EventQueueEntry(o, m, priority, vetoable)); log.debug("Added {} to queue {}", m, d.getEventType()); } } }
[ "protected", "void", "registerMethod", "(", "Object", "o", ",", "Method", "m", ",", "int", "priority", ",", "boolean", "vetoable", ")", "{", "// check the parameter types, and attempt to resolve the event", "// type", "if", "(", "m", ".", "getParameterTypes", "(", ")", ".", "length", "!=", "1", ")", "{", "log", ".", "warn", "(", "\"Skipping invalid event handler definition: \"", "+", "m", ")", ";", "return", ";", "}", "// make sure the parameter is an Event", "// this additional/technically unneeded check should cut down on the", "// time required to process the loop over the definitions for methods", "// that don't match", "Class", "<", "?", ">", "param", "=", "m", ".", "getParameterTypes", "(", ")", "[", "0", "]", ";", "if", "(", "!", "Event", ".", "class", ".", "isAssignableFrom", "(", "param", ")", ")", "{", "log", ".", "warn", "(", "\"Skipping event handler without an Event parameter: \"", "+", "m", ")", ";", "return", ";", "}", "// add the method to all assignable definitions.", "// this may result in the method being added to multiple queues,", "// that is, the queues for each superclass.", "// (this is intended and is fundamentally what makes subclassed events", "// work as expected)", "for", "(", "EventQueueDefinition", "d", ":", "definitions", ")", "{", "if", "(", "param", ".", "isAssignableFrom", "(", "d", ".", "getEventType", "(", ")", ")", ")", "{", "d", ".", "add", "(", "new", "EventQueueEntry", "(", "o", ",", "m", ",", "priority", ",", "vetoable", ")", ")", ";", "log", ".", "debug", "(", "\"Added {} to queue {}\"", ",", "m", ",", "d", ".", "getEventType", "(", ")", ")", ";", "}", "}", "}" ]
Registers the given method to the event bus. The object is assumed to be of the class that contains the given method. <p>The method parameters are checked and added to the event queue corresponding to the {@link Event} used as the first method parameter. In other words, if passed a reference to the following method:</p> <p><code> public void xyzHandler(XYZEvent event) { ... } </code></p> <p>... <code>xyzHandler</code> will be added to the event queue for {@code XYZEvent} assuming that {@code XYZEvent} extends {@link Event} and an event queue has been created for that event type.</p> @param o an instance of the class containing the method <code>m</code> @param m the method to register @param priority the event priority @param vetoable vetoable flag
[ "Registers", "the", "given", "method", "to", "the", "event", "bus", ".", "The", "object", "is", "assumed", "to", "be", "of", "the", "class", "that", "contains", "the", "given", "method", ".", "<p", ">", "The", "method", "parameters", "are", "checked", "and", "added", "to", "the", "event", "queue", "corresponding", "to", "the", "{" ]
train
https://github.com/timothyb89/EventBus/blob/9285406c16eda84e20da6c72fe2500c24c7848db/src/main/java/org/timothyb89/eventbus/EventBus.java#L149-L179
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/JsonFixture.java
JsonFixture.setJsonPathTo
public void setJsonPathTo(String path, Object value) { """ Update a value in a the content by supplied jsonPath @param path the jsonPath to locate the key whose value needs changing @param value the new value to set """ Object cleanValue = cleanupValue(value); String jsonPath = getPathExpr(path); String newContent = getPathHelper().updateJsonPathWithValue(content, jsonPath, cleanValue); content = newContent; }
java
public void setJsonPathTo(String path, Object value) { Object cleanValue = cleanupValue(value); String jsonPath = getPathExpr(path); String newContent = getPathHelper().updateJsonPathWithValue(content, jsonPath, cleanValue); content = newContent; }
[ "public", "void", "setJsonPathTo", "(", "String", "path", ",", "Object", "value", ")", "{", "Object", "cleanValue", "=", "cleanupValue", "(", "value", ")", ";", "String", "jsonPath", "=", "getPathExpr", "(", "path", ")", ";", "String", "newContent", "=", "getPathHelper", "(", ")", ".", "updateJsonPathWithValue", "(", "content", ",", "jsonPath", ",", "cleanValue", ")", ";", "content", "=", "newContent", ";", "}" ]
Update a value in a the content by supplied jsonPath @param path the jsonPath to locate the key whose value needs changing @param value the new value to set
[ "Update", "a", "value", "in", "a", "the", "content", "by", "supplied", "jsonPath" ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/JsonFixture.java#L107-L112
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/OperatingSystem.java
OperatingSystem.getPageSize
public static synchronized int getPageSize() throws OperatingSystemException { """ Get the base OS page size (this current Java process may not necessarily be using this page size). Not implemented on Windows. @return Page size. @throws OperatingSystemException Error computing page size. """ if (cachedPageSize == -1) { switch (instance().getOperatingSystemType()) { case AIX: case HPUX: case IBMi: case Linux: case Mac: case Solaris: case zOS: cachedPageSize = getPageSizePOSIX(); break; default: throw new OperatingSystemException(Tr.formatMessage(tc, "os.pagesize.unavailable")); } } return cachedPageSize; }
java
public static synchronized int getPageSize() throws OperatingSystemException { if (cachedPageSize == -1) { switch (instance().getOperatingSystemType()) { case AIX: case HPUX: case IBMi: case Linux: case Mac: case Solaris: case zOS: cachedPageSize = getPageSizePOSIX(); break; default: throw new OperatingSystemException(Tr.formatMessage(tc, "os.pagesize.unavailable")); } } return cachedPageSize; }
[ "public", "static", "synchronized", "int", "getPageSize", "(", ")", "throws", "OperatingSystemException", "{", "if", "(", "cachedPageSize", "==", "-", "1", ")", "{", "switch", "(", "instance", "(", ")", ".", "getOperatingSystemType", "(", ")", ")", "{", "case", "AIX", ":", "case", "HPUX", ":", "case", "IBMi", ":", "case", "Linux", ":", "case", "Mac", ":", "case", "Solaris", ":", "case", "zOS", ":", "cachedPageSize", "=", "getPageSizePOSIX", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "OperatingSystemException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"os.pagesize.unavailable\"", ")", ")", ";", "}", "}", "return", "cachedPageSize", ";", "}" ]
Get the base OS page size (this current Java process may not necessarily be using this page size). Not implemented on Windows. @return Page size. @throws OperatingSystemException Error computing page size.
[ "Get", "the", "base", "OS", "page", "size", "(", "this", "current", "Java", "process", "may", "not", "necessarily", "be", "using", "this", "page", "size", ")", ".", "Not", "implemented", "on", "Windows", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/OperatingSystem.java#L92-L109
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java
RangeHashFunction.generateFileName
protected String generateFileName(int subBucket, String oldName) { """ generates a new filename for a subbucket from the given oldName @param subBucket @param oldName @return """ int dotPos = oldName.lastIndexOf("."); int slashPos = Math.max(oldName.lastIndexOf("/"), oldName.lastIndexOf("\\")); String prefix; String suffix; if (dotPos > slashPos) { prefix = oldName.substring(0, dotPos); suffix = oldName.substring(dotPos); } else { prefix = oldName; suffix = ""; } return prefix + "_" + subBucket + suffix; }
java
protected String generateFileName(int subBucket, String oldName) { int dotPos = oldName.lastIndexOf("."); int slashPos = Math.max(oldName.lastIndexOf("/"), oldName.lastIndexOf("\\")); String prefix; String suffix; if (dotPos > slashPos) { prefix = oldName.substring(0, dotPos); suffix = oldName.substring(dotPos); } else { prefix = oldName; suffix = ""; } return prefix + "_" + subBucket + suffix; }
[ "protected", "String", "generateFileName", "(", "int", "subBucket", ",", "String", "oldName", ")", "{", "int", "dotPos", "=", "oldName", ".", "lastIndexOf", "(", "\".\"", ")", ";", "int", "slashPos", "=", "Math", ".", "max", "(", "oldName", ".", "lastIndexOf", "(", "\"/\"", ")", ",", "oldName", ".", "lastIndexOf", "(", "\"\\\\\"", ")", ")", ";", "String", "prefix", ";", "String", "suffix", ";", "if", "(", "dotPos", ">", "slashPos", ")", "{", "prefix", "=", "oldName", ".", "substring", "(", "0", ",", "dotPos", ")", ";", "suffix", "=", "oldName", ".", "substring", "(", "dotPos", ")", ";", "}", "else", "{", "prefix", "=", "oldName", ";", "suffix", "=", "\"\"", ";", "}", "return", "prefix", "+", "\"_\"", "+", "subBucket", "+", "suffix", ";", "}" ]
generates a new filename for a subbucket from the given oldName @param subBucket @param oldName @return
[ "generates", "a", "new", "filename", "for", "a", "subbucket", "from", "the", "given", "oldName" ]
train
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L307-L321
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.enterClass
public ClassSymbol enterClass(Name flatName, JavaFileObject classFile) { """ Creates a new toplevel class symbol with given flat name and given class (or source) file. @param flatName a fully qualified binary class name @param classFile the class file or compilation unit defining the class (may be {@code null}) @return a newly created class symbol @throws AssertionError if the class symbol already exists """ ClassSymbol cs = classes.get(flatName); if (cs != null) { String msg = Log.format("%s: completer = %s; class file = %s; source file = %s", cs.fullname, cs.completer, cs.classfile, cs.sourcefile); throw new AssertionError(msg); } Name packageName = Convert.packagePart(flatName); PackageSymbol owner = packageName.isEmpty() ? syms.unnamedPackage : enterPackage(packageName); cs = defineClass(Convert.shortName(flatName), owner); cs.classfile = classFile; classes.put(flatName, cs); return cs; }
java
public ClassSymbol enterClass(Name flatName, JavaFileObject classFile) { ClassSymbol cs = classes.get(flatName); if (cs != null) { String msg = Log.format("%s: completer = %s; class file = %s; source file = %s", cs.fullname, cs.completer, cs.classfile, cs.sourcefile); throw new AssertionError(msg); } Name packageName = Convert.packagePart(flatName); PackageSymbol owner = packageName.isEmpty() ? syms.unnamedPackage : enterPackage(packageName); cs = defineClass(Convert.shortName(flatName), owner); cs.classfile = classFile; classes.put(flatName, cs); return cs; }
[ "public", "ClassSymbol", "enterClass", "(", "Name", "flatName", ",", "JavaFileObject", "classFile", ")", "{", "ClassSymbol", "cs", "=", "classes", ".", "get", "(", "flatName", ")", ";", "if", "(", "cs", "!=", "null", ")", "{", "String", "msg", "=", "Log", ".", "format", "(", "\"%s: completer = %s; class file = %s; source file = %s\"", ",", "cs", ".", "fullname", ",", "cs", ".", "completer", ",", "cs", ".", "classfile", ",", "cs", ".", "sourcefile", ")", ";", "throw", "new", "AssertionError", "(", "msg", ")", ";", "}", "Name", "packageName", "=", "Convert", ".", "packagePart", "(", "flatName", ")", ";", "PackageSymbol", "owner", "=", "packageName", ".", "isEmpty", "(", ")", "?", "syms", ".", "unnamedPackage", ":", "enterPackage", "(", "packageName", ")", ";", "cs", "=", "defineClass", "(", "Convert", ".", "shortName", "(", "flatName", ")", ",", "owner", ")", ";", "cs", ".", "classfile", "=", "classFile", ";", "classes", ".", "put", "(", "flatName", ",", "cs", ")", ";", "return", "cs", ";", "}" ]
Creates a new toplevel class symbol with given flat name and given class (or source) file. @param flatName a fully qualified binary class name @param classFile the class file or compilation unit defining the class (may be {@code null}) @return a newly created class symbol @throws AssertionError if the class symbol already exists
[ "Creates", "a", "new", "toplevel", "class", "symbol", "with", "given", "flat", "name", "and", "given", "class", "(", "or", "source", ")", "file", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L2408-L2426
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.beginCreateOrUpdateAsync
public Observable<AppServiceCertificateOrderInner> beginCreateOrUpdateAsync(String resourceGroupName, String certificateOrderName, AppServiceCertificateOrderInner certificateDistinguishedName) { """ Create or update a certificate purchase order. Create or update a certificate purchase order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param certificateDistinguishedName Distinguished name to to use for the certificate order. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AppServiceCertificateOrderInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, certificateOrderName, certificateDistinguishedName).map(new Func1<ServiceResponse<AppServiceCertificateOrderInner>, AppServiceCertificateOrderInner>() { @Override public AppServiceCertificateOrderInner call(ServiceResponse<AppServiceCertificateOrderInner> response) { return response.body(); } }); }
java
public Observable<AppServiceCertificateOrderInner> beginCreateOrUpdateAsync(String resourceGroupName, String certificateOrderName, AppServiceCertificateOrderInner certificateDistinguishedName) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, certificateOrderName, certificateDistinguishedName).map(new Func1<ServiceResponse<AppServiceCertificateOrderInner>, AppServiceCertificateOrderInner>() { @Override public AppServiceCertificateOrderInner call(ServiceResponse<AppServiceCertificateOrderInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppServiceCertificateOrderInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "AppServiceCertificateOrderInner", "certificateDistinguishedName", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ",", "certificateDistinguishedName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "AppServiceCertificateOrderInner", ">", ",", "AppServiceCertificateOrderInner", ">", "(", ")", "{", "@", "Override", "public", "AppServiceCertificateOrderInner", "call", "(", "ServiceResponse", "<", "AppServiceCertificateOrderInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update a certificate purchase order. Create or update a certificate purchase order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param certificateDistinguishedName Distinguished name to to use for the certificate order. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AppServiceCertificateOrderInner object
[ "Create", "or", "update", "a", "certificate", "purchase", "order", ".", "Create", "or", "update", "a", "certificate", "purchase", "order", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L704-L711
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/cp/CPSubsystemConfig.java
CPSubsystemConfig.setSemaphoreConfigs
public CPSubsystemConfig setSemaphoreConfigs(Map<String, CPSemaphoreConfig> cpSemaphoreConfigs) { """ Sets the map of CP {@link ISemaphore} configurations, mapped by config name. Names could optionally contain a {@link CPGroup} name, such as "mySemaphore@group1". @param cpSemaphoreConfigs the CP {@link ISemaphore} config map to set @return this config instance """ this.semaphoreConfigs.clear(); this.semaphoreConfigs.putAll(cpSemaphoreConfigs); for (Entry<String, CPSemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public CPSubsystemConfig setSemaphoreConfigs(Map<String, CPSemaphoreConfig> cpSemaphoreConfigs) { this.semaphoreConfigs.clear(); this.semaphoreConfigs.putAll(cpSemaphoreConfigs); for (Entry<String, CPSemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "CPSubsystemConfig", "setSemaphoreConfigs", "(", "Map", "<", "String", ",", "CPSemaphoreConfig", ">", "cpSemaphoreConfigs", ")", "{", "this", ".", "semaphoreConfigs", ".", "clear", "(", ")", ";", "this", ".", "semaphoreConfigs", ".", "putAll", "(", "cpSemaphoreConfigs", ")", ";", "for", "(", "Entry", "<", "String", ",", "CPSemaphoreConfig", ">", "entry", ":", "this", ".", "semaphoreConfigs", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of CP {@link ISemaphore} configurations, mapped by config name. Names could optionally contain a {@link CPGroup} name, such as "mySemaphore@group1". @param cpSemaphoreConfigs the CP {@link ISemaphore} config map to set @return this config instance
[ "Sets", "the", "map", "of", "CP", "{", "@link", "ISemaphore", "}", "configurations", "mapped", "by", "config", "name", ".", "Names", "could", "optionally", "contain", "a", "{", "@link", "CPGroup", "}", "name", "such", "as", "mySemaphore@group1", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/cp/CPSubsystemConfig.java#L491-L498
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java
NameHelper.getPropertyName
public String getPropertyName(String jsonFieldName, JsonNode node) { """ Convert jsonFieldName into the equivalent Java fieldname by replacing illegal characters and normalizing it. @param jsonFieldName @param node @return """ jsonFieldName = getFieldName(jsonFieldName, node); jsonFieldName = replaceIllegalCharacters(jsonFieldName); jsonFieldName = normalizeName(jsonFieldName); jsonFieldName = makeLowerCamelCase(jsonFieldName); if (isKeyword(jsonFieldName)) { jsonFieldName = "_" + jsonFieldName; } if (isKeyword(jsonFieldName)) { jsonFieldName += "_"; } return jsonFieldName; }
java
public String getPropertyName(String jsonFieldName, JsonNode node) { jsonFieldName = getFieldName(jsonFieldName, node); jsonFieldName = replaceIllegalCharacters(jsonFieldName); jsonFieldName = normalizeName(jsonFieldName); jsonFieldName = makeLowerCamelCase(jsonFieldName); if (isKeyword(jsonFieldName)) { jsonFieldName = "_" + jsonFieldName; } if (isKeyword(jsonFieldName)) { jsonFieldName += "_"; } return jsonFieldName; }
[ "public", "String", "getPropertyName", "(", "String", "jsonFieldName", ",", "JsonNode", "node", ")", "{", "jsonFieldName", "=", "getFieldName", "(", "jsonFieldName", ",", "node", ")", ";", "jsonFieldName", "=", "replaceIllegalCharacters", "(", "jsonFieldName", ")", ";", "jsonFieldName", "=", "normalizeName", "(", "jsonFieldName", ")", ";", "jsonFieldName", "=", "makeLowerCamelCase", "(", "jsonFieldName", ")", ";", "if", "(", "isKeyword", "(", "jsonFieldName", ")", ")", "{", "jsonFieldName", "=", "\"_\"", "+", "jsonFieldName", ";", "}", "if", "(", "isKeyword", "(", "jsonFieldName", ")", ")", "{", "jsonFieldName", "+=", "\"_\"", ";", "}", "return", "jsonFieldName", ";", "}" ]
Convert jsonFieldName into the equivalent Java fieldname by replacing illegal characters and normalizing it. @param jsonFieldName @param node @return
[ "Convert", "jsonFieldName", "into", "the", "equivalent", "Java", "fieldname", "by", "replacing", "illegal", "characters", "and", "normalizing", "it", "." ]
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java#L103-L119
dropwizard/dropwizard
dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java
ConstraintMessage.getMessage
public static String getMessage(ConstraintViolation<?> v, Invocable invocable) { """ Gets the human friendly location of where the violation was raised. """ final Pair<Path, ? extends ConstraintDescriptor<?>> of = Pair.of(v.getPropertyPath(), v.getConstraintDescriptor()); final String cachePrefix = PREFIX_CACHE.getIfPresent(of); if (cachePrefix == null) { final String prefix = calculatePrefix(v, invocable); PREFIX_CACHE.put(of, prefix); return prefix + v.getMessage(); } return cachePrefix + v.getMessage(); }
java
public static String getMessage(ConstraintViolation<?> v, Invocable invocable) { final Pair<Path, ? extends ConstraintDescriptor<?>> of = Pair.of(v.getPropertyPath(), v.getConstraintDescriptor()); final String cachePrefix = PREFIX_CACHE.getIfPresent(of); if (cachePrefix == null) { final String prefix = calculatePrefix(v, invocable); PREFIX_CACHE.put(of, prefix); return prefix + v.getMessage(); } return cachePrefix + v.getMessage(); }
[ "public", "static", "String", "getMessage", "(", "ConstraintViolation", "<", "?", ">", "v", ",", "Invocable", "invocable", ")", "{", "final", "Pair", "<", "Path", ",", "?", "extends", "ConstraintDescriptor", "<", "?", ">", ">", "of", "=", "Pair", ".", "of", "(", "v", ".", "getPropertyPath", "(", ")", ",", "v", ".", "getConstraintDescriptor", "(", ")", ")", ";", "final", "String", "cachePrefix", "=", "PREFIX_CACHE", ".", "getIfPresent", "(", "of", ")", ";", "if", "(", "cachePrefix", "==", "null", ")", "{", "final", "String", "prefix", "=", "calculatePrefix", "(", "v", ",", "invocable", ")", ";", "PREFIX_CACHE", ".", "put", "(", "of", ",", "prefix", ")", ";", "return", "prefix", "+", "v", ".", "getMessage", "(", ")", ";", "}", "return", "cachePrefix", "+", "v", ".", "getMessage", "(", ")", ";", "}" ]
Gets the human friendly location of where the violation was raised.
[ "Gets", "the", "human", "friendly", "location", "of", "where", "the", "violation", "was", "raised", "." ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java#L40-L50
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.getActiveOperation
protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) { """ Get the active operation. @param id the active operation id @return the active operation, {@code null} if if there is no registered operation """ //noinspection unchecked return (ActiveOperation<T, A>) activeRequests.get(id); }
java
protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) { //noinspection unchecked return (ActiveOperation<T, A>) activeRequests.get(id); }
[ "protected", "<", "T", ",", "A", ">", "ActiveOperation", "<", "T", ",", "A", ">", "getActiveOperation", "(", "final", "Integer", "id", ")", "{", "//noinspection unchecked", "return", "(", "ActiveOperation", "<", "T", ",", "A", ">", ")", "activeRequests", ".", "get", "(", "id", ")", ";", "}" ]
Get the active operation. @param id the active operation id @return the active operation, {@code null} if if there is no registered operation
[ "Get", "the", "active", "operation", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L428-L431
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.newReader
public static BufferedReader newReader(Path self, String charset) throws IOException { """ Create a buffered reader for this file, using the specified charset as the encoding. @param self a Path @param charset the charset for this Path @return a BufferedReader @throws java.io.FileNotFoundException if the Path was not found @throws java.io.UnsupportedEncodingException if the encoding specified is not supported @since 2.3.0 """ return Files.newBufferedReader(self, Charset.forName(charset)); }
java
public static BufferedReader newReader(Path self, String charset) throws IOException { return Files.newBufferedReader(self, Charset.forName(charset)); }
[ "public", "static", "BufferedReader", "newReader", "(", "Path", "self", ",", "String", "charset", ")", "throws", "IOException", "{", "return", "Files", ".", "newBufferedReader", "(", "self", ",", "Charset", ".", "forName", "(", "charset", ")", ")", ";", "}" ]
Create a buffered reader for this file, using the specified charset as the encoding. @param self a Path @param charset the charset for this Path @return a BufferedReader @throws java.io.FileNotFoundException if the Path was not found @throws java.io.UnsupportedEncodingException if the encoding specified is not supported @since 2.3.0
[ "Create", "a", "buffered", "reader", "for", "this", "file", "using", "the", "specified", "charset", "as", "the", "encoding", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1414-L1416
dbracewell/mango
src/main/java/com/davidbracewell/conversion/Val.java
Val.asSet
public <T> Set<T> asSet(Class<T> itemType) { """ Converts the object to a Set @param <T> the type parameter @param itemType The class of the item in the Set @return The object as a Set """ return asCollection(Set.class, itemType); }
java
public <T> Set<T> asSet(Class<T> itemType) { return asCollection(Set.class, itemType); }
[ "public", "<", "T", ">", "Set", "<", "T", ">", "asSet", "(", "Class", "<", "T", ">", "itemType", ")", "{", "return", "asCollection", "(", "Set", ".", "class", ",", "itemType", ")", ";", "}" ]
Converts the object to a Set @param <T> the type parameter @param itemType The class of the item in the Set @return The object as a Set
[ "Converts", "the", "object", "to", "a", "Set" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/Val.java#L762-L764
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java
StringBuilders.appendKeyDqValue
public static StringBuilder appendKeyDqValue(final StringBuilder sb, final Entry<String, String> entry) { """ Appends in the following format: key=double quoted value. @param sb a string builder @param entry a map entry @return {@code key="value"} """ return appendKeyDqValue(sb, entry.getKey(), entry.getValue()); }
java
public static StringBuilder appendKeyDqValue(final StringBuilder sb, final Entry<String, String> entry) { return appendKeyDqValue(sb, entry.getKey(), entry.getValue()); }
[ "public", "static", "StringBuilder", "appendKeyDqValue", "(", "final", "StringBuilder", "sb", ",", "final", "Entry", "<", "String", ",", "String", ">", "entry", ")", "{", "return", "appendKeyDqValue", "(", "sb", ",", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}" ]
Appends in the following format: key=double quoted value. @param sb a string builder @param entry a map entry @return {@code key="value"}
[ "Appends", "in", "the", "following", "format", ":", "key", "=", "double", "quoted", "value", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java#L48-L50
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/debug/DebugHelper.java
DebugHelper.debugAnnotation
public static void debugAnnotation(Rectangle rectangle, String styleClass, PdfWriter writer) { """ adding a link (annotation) to information about the styleClass used @param rectangle the value of rectangle @param styleClass the value of styleClass @param writer the value of writer """ if (styleClass == null) { log.warning("not showing link to styleClass because there is no styleClass"); return; } // only now we can define a goto action, we know the position of the image PdfAction act = PdfAction.gotoLocalPage(styleClass, true); writer.getDirectContent().setAction(act, rectangle.getLeft(), rectangle.getBottom(), rectangle.getRight(), rectangle.getTop()); }
java
public static void debugAnnotation(Rectangle rectangle, String styleClass, PdfWriter writer) { if (styleClass == null) { log.warning("not showing link to styleClass because there is no styleClass"); return; } // only now we can define a goto action, we know the position of the image PdfAction act = PdfAction.gotoLocalPage(styleClass, true); writer.getDirectContent().setAction(act, rectangle.getLeft(), rectangle.getBottom(), rectangle.getRight(), rectangle.getTop()); }
[ "public", "static", "void", "debugAnnotation", "(", "Rectangle", "rectangle", ",", "String", "styleClass", ",", "PdfWriter", "writer", ")", "{", "if", "(", "styleClass", "==", "null", ")", "{", "log", ".", "warning", "(", "\"not showing link to styleClass because there is no styleClass\"", ")", ";", "return", ";", "}", "// only now we can define a goto action, we know the position of the image", "PdfAction", "act", "=", "PdfAction", ".", "gotoLocalPage", "(", "styleClass", ",", "true", ")", ";", "writer", ".", "getDirectContent", "(", ")", ".", "setAction", "(", "act", ",", "rectangle", ".", "getLeft", "(", ")", ",", "rectangle", ".", "getBottom", "(", ")", ",", "rectangle", ".", "getRight", "(", ")", ",", "rectangle", ".", "getTop", "(", ")", ")", ";", "}" ]
adding a link (annotation) to information about the styleClass used @param rectangle the value of rectangle @param styleClass the value of styleClass @param writer the value of writer
[ "adding", "a", "link", "(", "annotation", ")", "to", "information", "about", "the", "styleClass", "used" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/debug/DebugHelper.java#L132-L140
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/SQLService.java
SQLService.toClob
public Clob toClob(String stringName, Connection sqlConnection) { """ Converts the given string to a clob object @param stringName string name to clob @param sqlConnection Connection object @return Clob object or NULL """ Clob clobName = null; try { clobName = sqlConnection.createClob(); clobName.setString(1, stringName); } catch (SQLException e) { // TODO Auto-generated catch block logger.info("Unable to create clob object"); e.printStackTrace(); } return clobName; }
java
public Clob toClob(String stringName, Connection sqlConnection) { Clob clobName = null; try { clobName = sqlConnection.createClob(); clobName.setString(1, stringName); } catch (SQLException e) { // TODO Auto-generated catch block logger.info("Unable to create clob object"); e.printStackTrace(); } return clobName; }
[ "public", "Clob", "toClob", "(", "String", "stringName", ",", "Connection", "sqlConnection", ")", "{", "Clob", "clobName", "=", "null", ";", "try", "{", "clobName", "=", "sqlConnection", ".", "createClob", "(", ")", ";", "clobName", ".", "setString", "(", "1", ",", "stringName", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "// TODO Auto-generated catch block", "logger", ".", "info", "(", "\"Unable to create clob object\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "clobName", ";", "}" ]
Converts the given string to a clob object @param stringName string name to clob @param sqlConnection Connection object @return Clob object or NULL
[ "Converts", "the", "given", "string", "to", "a", "clob", "object" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/SQLService.java#L328-L339
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.processPOTopicInjections
protected void processPOTopicInjections(final POBuildData buildData, final SpecTopic specTopic, final Map<String, TranslationDetails> translations) { """ Process a spec topic and add any translation strings for it. @param buildData Information and data structures for the build. @param specTopic The spec topic to process any injections for. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files. """ // Prerequisites addStringsFromTopicRelationships(buildData, specTopic.getPrerequisiteRelationships(), DocBookXMLPreProcessor.PREREQUISITE_PROPERTY, DocBookXMLPreProcessor.ROLE_PREREQUISITE, translations); // See also addStringsFromTopicRelationships(buildData, specTopic.getRelatedRelationships(), DocBookXMLPreProcessor.SEE_ALSO_PROPERTY, DocBookXMLPreProcessor.ROLE_SEE_ALSO, translations); // Link List addStringsFromTopicRelationships(buildData, specTopic.getLinkListRelationships(), null, DocBookXMLPreProcessor.ROLE_LINK_LIST, translations); // Previous final List<Relationship> prevRelationships = specTopic.getPreviousRelationships(); if (prevRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } // Next final List<Relationship> nextRelationships = specTopic.getNextRelationships(); if (nextRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } }
java
protected void processPOTopicInjections(final POBuildData buildData, final SpecTopic specTopic, final Map<String, TranslationDetails> translations) { // Prerequisites addStringsFromTopicRelationships(buildData, specTopic.getPrerequisiteRelationships(), DocBookXMLPreProcessor.PREREQUISITE_PROPERTY, DocBookXMLPreProcessor.ROLE_PREREQUISITE, translations); // See also addStringsFromTopicRelationships(buildData, specTopic.getRelatedRelationships(), DocBookXMLPreProcessor.SEE_ALSO_PROPERTY, DocBookXMLPreProcessor.ROLE_SEE_ALSO, translations); // Link List addStringsFromTopicRelationships(buildData, specTopic.getLinkListRelationships(), null, DocBookXMLPreProcessor.ROLE_LINK_LIST, translations); // Previous final List<Relationship> prevRelationships = specTopic.getPreviousRelationships(); if (prevRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } // Next final List<Relationship> nextRelationships = specTopic.getNextRelationships(); if (nextRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } }
[ "protected", "void", "processPOTopicInjections", "(", "final", "POBuildData", "buildData", ",", "final", "SpecTopic", "specTopic", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "{", "// Prerequisites", "addStringsFromTopicRelationships", "(", "buildData", ",", "specTopic", ".", "getPrerequisiteRelationships", "(", ")", ",", "DocBookXMLPreProcessor", ".", "PREREQUISITE_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PREREQUISITE", ",", "translations", ")", ";", "// See also", "addStringsFromTopicRelationships", "(", "buildData", ",", "specTopic", ".", "getRelatedRelationships", "(", ")", ",", "DocBookXMLPreProcessor", ".", "SEE_ALSO_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_SEE_ALSO", ",", "translations", ")", ";", "// Link List", "addStringsFromTopicRelationships", "(", "buildData", ",", "specTopic", ".", "getLinkListRelationships", "(", ")", ",", "null", ",", "DocBookXMLPreProcessor", ".", "ROLE_LINK_LIST", ",", "translations", ")", ";", "// Previous", "final", "List", "<", "Relationship", ">", "prevRelationships", "=", "specTopic", ".", "getPreviousRelationships", "(", ")", ";", "if", "(", "prevRelationships", ".", "size", "(", ")", ">", "1", ")", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "prevRelationships", ",", "DocBookXMLPreProcessor", ".", "PREVIOUS_STEPS_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_TITLE_LINK", ",", "translations", ")", ";", "}", "else", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "prevRelationships", ",", "DocBookXMLPreProcessor", ".", "PREVIOUS_STEP_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_TITLE_LINK", ",", "translations", ")", ";", "}", "// Next", "final", "List", "<", "Relationship", ">", "nextRelationships", "=", "specTopic", ".", "getNextRelationships", "(", ")", ";", "if", "(", "nextRelationships", ".", "size", "(", ")", ">", "1", ")", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "nextRelationships", ",", "DocBookXMLPreProcessor", ".", "NEXT_STEPS_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_TITLE_LINK", ",", "translations", ")", ";", "}", "else", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "nextRelationships", ",", "DocBookXMLPreProcessor", ".", "NEXT_STEP_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_TITLE_LINK", ",", "translations", ")", ";", "}", "}" ]
Process a spec topic and add any translation strings for it. @param buildData Information and data structures for the build. @param specTopic The spec topic to process any injections for. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Process", "a", "spec", "topic", "and", "add", "any", "translation", "strings", "for", "it", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1101-L1138