repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java
IndexWriter.generateBackpointerUpdate
private AttributeUpdate generateBackpointerUpdate(long fromOffset, long toOffset) { """ Generates an AttributeUpdate that creates a new or updates an existing Backpointer. @param fromOffset The offset at which the Backpointer originates. @param toOffset The offset at which the Backpointer ends. """ return new AttributeUpdate(getBackpointerAttributeKey(fromOffset), AttributeUpdateType.Replace, toOffset); }
java
private AttributeUpdate generateBackpointerUpdate(long fromOffset, long toOffset) { return new AttributeUpdate(getBackpointerAttributeKey(fromOffset), AttributeUpdateType.Replace, toOffset); }
[ "private", "AttributeUpdate", "generateBackpointerUpdate", "(", "long", "fromOffset", ",", "long", "toOffset", ")", "{", "return", "new", "AttributeUpdate", "(", "getBackpointerAttributeKey", "(", "fromOffset", ")", ",", "AttributeUpdateType", ".", "Replace", ",", "toOffset", ")", ";", "}" ]
Generates an AttributeUpdate that creates a new or updates an existing Backpointer. @param fromOffset The offset at which the Backpointer originates. @param toOffset The offset at which the Backpointer ends.
[ "Generates", "an", "AttributeUpdate", "that", "creates", "a", "new", "or", "updates", "an", "existing", "Backpointer", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java#L315-L317
micronaut-projects/micronaut-core
inject-java/src/main/java/io/micronaut/annotation/processing/ExecutableElementParamInfo.java
ExecutableElementParamInfo.addGenericTypes
void addGenericTypes(String paramName, Map<String, Object> generics) { """ Adds generics info for the given parameter name. @param paramName The parameter name @param generics The generics info """ genericTypes.put(paramName, generics); }
java
void addGenericTypes(String paramName, Map<String, Object> generics) { genericTypes.put(paramName, generics); }
[ "void", "addGenericTypes", "(", "String", "paramName", ",", "Map", "<", "String", ",", "Object", ">", "generics", ")", "{", "genericTypes", ".", "put", "(", "paramName", ",", "generics", ")", ";", "}" ]
Adds generics info for the given parameter name. @param paramName The parameter name @param generics The generics info
[ "Adds", "generics", "info", "for", "the", "given", "parameter", "name", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/ExecutableElementParamInfo.java#L72-L74
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java
DiagnosticsInner.listSiteDetectorResponsesSlotAsync
public Observable<Page<DetectorResponseInner>> listSiteDetectorResponsesSlotAsync(final String resourceGroupName, final String siteName, final String slot) { """ List Site Detector Responses. List Site Detector Responses. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorResponseInner&gt; object """ return listSiteDetectorResponsesSlotWithServiceResponseAsync(resourceGroupName, siteName, slot) .map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() { @Override public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) { return response.body(); } }); }
java
public Observable<Page<DetectorResponseInner>> listSiteDetectorResponsesSlotAsync(final String resourceGroupName, final String siteName, final String slot) { return listSiteDetectorResponsesSlotWithServiceResponseAsync(resourceGroupName, siteName, slot) .map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() { @Override public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DetectorResponseInner", ">", ">", "listSiteDetectorResponsesSlotAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "slot", ")", "{", "return", "listSiteDetectorResponsesSlotWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ",", "slot", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "DetectorResponseInner", ">", ">", ",", "Page", "<", "DetectorResponseInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "DetectorResponseInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "DetectorResponseInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List Site Detector Responses. List Site Detector Responses. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorResponseInner&gt; object
[ "List", "Site", "Detector", "Responses", ".", "List", "Site", "Detector", "Responses", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L2088-L2096
rhiot/rhiot
gateway/components/camel-webcam/src/main/java/io/rhiot/gateway/camel/webcam/WebcamHelper.java
WebcamHelper.consumeBufferedImage
public static void consumeBufferedImage(BufferedImage image, Processor processor, WebcamEndpoint endpoint, ExceptionHandler exceptionHandler) { """ Consume the java.awt.BufferedImage from the webcam, all params required. @param image The image to process. @param processor Processor that handles the exchange. @param endpoint WebcamEndpoint receiving the exchange. """ Validate.notNull(image); Validate.notNull(processor); Validate.notNull(endpoint); try { Exchange exchange = createOutOnlyExchangeWithBodyAndHeaders(endpoint, image); processor.process(exchange); } catch (Exception e) { exceptionHandler.handleException(e); } }
java
public static void consumeBufferedImage(BufferedImage image, Processor processor, WebcamEndpoint endpoint, ExceptionHandler exceptionHandler) { Validate.notNull(image); Validate.notNull(processor); Validate.notNull(endpoint); try { Exchange exchange = createOutOnlyExchangeWithBodyAndHeaders(endpoint, image); processor.process(exchange); } catch (Exception e) { exceptionHandler.handleException(e); } }
[ "public", "static", "void", "consumeBufferedImage", "(", "BufferedImage", "image", ",", "Processor", "processor", ",", "WebcamEndpoint", "endpoint", ",", "ExceptionHandler", "exceptionHandler", ")", "{", "Validate", ".", "notNull", "(", "image", ")", ";", "Validate", ".", "notNull", "(", "processor", ")", ";", "Validate", ".", "notNull", "(", "endpoint", ")", ";", "try", "{", "Exchange", "exchange", "=", "createOutOnlyExchangeWithBodyAndHeaders", "(", "endpoint", ",", "image", ")", ";", "processor", ".", "process", "(", "exchange", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "exceptionHandler", ".", "handleException", "(", "e", ")", ";", "}", "}" ]
Consume the java.awt.BufferedImage from the webcam, all params required. @param image The image to process. @param processor Processor that handles the exchange. @param endpoint WebcamEndpoint receiving the exchange.
[ "Consume", "the", "java", ".", "awt", ".", "BufferedImage", "from", "the", "webcam", "all", "params", "required", "." ]
train
https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/gateway/components/camel-webcam/src/main/java/io/rhiot/gateway/camel/webcam/WebcamHelper.java#L66-L77
apereo/cas
support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java
GoogleAuthenticatorTokenCouchDbRepository.findOneByUidForOtp
@View(name = "by_uid_otp", map = "function(doc) { """ Find first by uid, otp pair. @param uid uid to search @param otp otp to search @return token for uid, otp pair """ if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }") public CouchDbGoogleAuthenticatorToken findOneByUidForOtp(final String uid, final Integer otp) { val view = createQuery("by_uid_otp").key(ComplexKey.of(uid, otp)).limit(1); return db.queryView(view, CouchDbGoogleAuthenticatorToken.class).stream().findFirst().orElse(null); }
java
@View(name = "by_uid_otp", map = "function(doc) { if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }") public CouchDbGoogleAuthenticatorToken findOneByUidForOtp(final String uid, final Integer otp) { val view = createQuery("by_uid_otp").key(ComplexKey.of(uid, otp)).limit(1); return db.queryView(view, CouchDbGoogleAuthenticatorToken.class).stream().findFirst().orElse(null); }
[ "@", "View", "(", "name", "=", "\"by_uid_otp\"", ",", "map", "=", "\"function(doc) { if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }\"", ")", "public", "CouchDbGoogleAuthenticatorToken", "findOneByUidForOtp", "(", "final", "String", "uid", ",", "final", "Integer", "otp", ")", "{", "val", "view", "=", "createQuery", "(", "\"by_uid_otp\"", ")", ".", "key", "(", "ComplexKey", ".", "of", "(", "uid", ",", "otp", ")", ")", ".", "limit", "(", "1", ")", ";", "return", "db", ".", "queryView", "(", "view", ",", "CouchDbGoogleAuthenticatorToken", ".", "class", ")", ".", "stream", "(", ")", ".", "findFirst", "(", ")", ".", "orElse", "(", "null", ")", ";", "}" ]
Find first by uid, otp pair. @param uid uid to search @param otp otp to search @return token for uid, otp pair
[ "Find", "first", "by", "uid", "otp", "pair", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/token/GoogleAuthenticatorTokenCouchDbRepository.java#L33-L37
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/UsersApi.java
UsersApi.getUsers
public GetUsersSuccessResponse getUsers(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException { """ Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param limit Limit the number of users the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned users. (optional) @param order The sort order. (optional) @param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional) @param filterName The name of a filter to use on the results. (optional) @param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional) @param roles Return only users who have the Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional) @param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional) @param userEnabled Return only enabled or disabled users. (optional) @param userValid Return only valid or invalid users. (optional) @return GetUsersSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<GetUsersSuccessResponse> resp = getUsersWithHttpInfo(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid); return resp.getData(); }
java
public GetUsersSuccessResponse getUsers(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException { ApiResponse<GetUsersSuccessResponse> resp = getUsersWithHttpInfo(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid); return resp.getData(); }
[ "public", "GetUsersSuccessResponse", "getUsers", "(", "Integer", "limit", ",", "Integer", "offset", ",", "String", "order", ",", "String", "sortBy", ",", "String", "filterName", ",", "String", "filterParameters", ",", "String", "roles", ",", "String", "skills", ",", "Boolean", "userEnabled", ",", "String", "userValid", ")", "throws", "ApiException", "{", "ApiResponse", "<", "GetUsersSuccessResponse", ">", "resp", "=", "getUsersWithHttpInfo", "(", "limit", ",", "offset", ",", "order", ",", "sortBy", ",", "filterName", ",", "filterParameters", ",", "roles", ",", "skills", ",", "userEnabled", ",", "userValid", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param limit Limit the number of users the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned users. (optional) @param order The sort order. (optional) @param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional) @param filterName The name of a filter to use on the results. (optional) @param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional) @param roles Return only users who have the Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional) @param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional) @param userEnabled Return only enabled or disabled users. (optional) @param userValid Return only valid or invalid users. (optional) @return GetUsersSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "users", ".", "Get", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", ")", "objects", "based", "on", "the", "specified", "filters", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/UsersApi.java#L652-L655
JakeWharton/butterknife
butterknife-runtime/src/main/java/butterknife/ViewCollections.java
ViewCollections.set
@UiThread public static <T extends View, V> void set(@NonNull List<T> list, @NonNull Property<? super T, V> setter, @Nullable V value) { """ Apply the specified {@code value} across the {@code list} of views using the {@code property}. """ //noinspection ForLoopReplaceableByForEach for (int i = 0, count = list.size(); i < count; i++) { setter.set(list.get(i), value); } }
java
@UiThread public static <T extends View, V> void set(@NonNull List<T> list, @NonNull Property<? super T, V> setter, @Nullable V value) { //noinspection ForLoopReplaceableByForEach for (int i = 0, count = list.size(); i < count; i++) { setter.set(list.get(i), value); } }
[ "@", "UiThread", "public", "static", "<", "T", "extends", "View", ",", "V", ">", "void", "set", "(", "@", "NonNull", "List", "<", "T", ">", "list", ",", "@", "NonNull", "Property", "<", "?", "super", "T", ",", "V", ">", "setter", ",", "@", "Nullable", "V", "value", ")", "{", "//noinspection ForLoopReplaceableByForEach", "for", "(", "int", "i", "=", "0", ",", "count", "=", "list", ".", "size", "(", ")", ";", "i", "<", "count", ";", "i", "++", ")", "{", "setter", ".", "set", "(", "list", ".", "get", "(", "i", ")", ",", "value", ")", ";", "}", "}" ]
Apply the specified {@code value} across the {@code list} of views using the {@code property}.
[ "Apply", "the", "specified", "{" ]
train
https://github.com/JakeWharton/butterknife/blob/0ead8a7b21620effcf78c728089fc16ae9d664c0/butterknife-runtime/src/main/java/butterknife/ViewCollections.java#L94-L101
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addSizeLessThanOrEqualToCondition
protected void addSizeLessThanOrEqualToCondition(final String propertyName, final Integer size) { """ Add a Field Search Condition that will check if the size of a collection in an entity is less than or equal to the specified size. @param propertyName The name of the collection as defined in the Entity mapping class. @param size The size that the collection should be less than or equal to. """ final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class)); fieldConditions.add(getCriteriaBuilder().le(propertySizeExpression, size)); }
java
protected void addSizeLessThanOrEqualToCondition(final String propertyName, final Integer size) { final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class)); fieldConditions.add(getCriteriaBuilder().le(propertySizeExpression, size)); }
[ "protected", "void", "addSizeLessThanOrEqualToCondition", "(", "final", "String", "propertyName", ",", "final", "Integer", "size", ")", "{", "final", "Expression", "<", "Integer", ">", "propertySizeExpression", "=", "getCriteriaBuilder", "(", ")", ".", "size", "(", "getRootPath", "(", ")", ".", "get", "(", "propertyName", ")", ".", "as", "(", "Set", ".", "class", ")", ")", ";", "fieldConditions", ".", "add", "(", "getCriteriaBuilder", "(", ")", ".", "le", "(", "propertySizeExpression", ",", "size", ")", ")", ";", "}" ]
Add a Field Search Condition that will check if the size of a collection in an entity is less than or equal to the specified size. @param propertyName The name of the collection as defined in the Entity mapping class. @param size The size that the collection should be less than or equal to.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "check", "if", "the", "size", "of", "a", "collection", "in", "an", "entity", "is", "less", "than", "or", "equal", "to", "the", "specified", "size", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L270-L273
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.modifyUser
@Deprecated public User modifyUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException { """ Modifies an existing user. Only administrators can change attributes of a user. <pre><code>GitLab Endpoint: PUT /users/:id</code></pre> <p>The following properties of the provided User instance can be set during update:<pre><code> email (required) - Email username (required) - Username name (required) - Name skype (optional) - Skype ID linkedin (optional) - LinkedIn twitter (optional) - Twitter account websiteUrl (optional) - Website URL organization (optional) - Organization name projectsLimit (optional) - Number of projects user can create externUid (optional) - External UID provider (optional) - External provider name bio (optional) - User's biography location (optional) - User's location admin (optional) - User is admin - true or false (default) canCreateGroup (optional) - User can create groups - true or false skipConfirmation (optional) - Skip confirmation - true or false (default) external (optional) - Flags the user as external - true or false(default) sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user </code></pre> @param user the User instance with the user info to modify @param password the new password for the user @param projectsLimit the maximum number of project @return the modified User instance @throws GitLabApiException if any exception occurs @deprecated Will be removed in version 5.0, replaced by {@link #updateUser(User, CharSequence)} """ Form form = userToForm(user, projectsLimit, password, false, false); Response response = put(Response.Status.OK, form.asMap(), "users", user.getId()); return (response.readEntity(User.class)); }
java
@Deprecated public User modifyUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException { Form form = userToForm(user, projectsLimit, password, false, false); Response response = put(Response.Status.OK, form.asMap(), "users", user.getId()); return (response.readEntity(User.class)); }
[ "@", "Deprecated", "public", "User", "modifyUser", "(", "User", "user", ",", "CharSequence", "password", ",", "Integer", "projectsLimit", ")", "throws", "GitLabApiException", "{", "Form", "form", "=", "userToForm", "(", "user", ",", "projectsLimit", ",", "password", ",", "false", ",", "false", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "form", ".", "asMap", "(", ")", ",", "\"users\"", ",", "user", ".", "getId", "(", ")", ")", ";", "return", "(", "response", ".", "readEntity", "(", "User", ".", "class", ")", ")", ";", "}" ]
Modifies an existing user. Only administrators can change attributes of a user. <pre><code>GitLab Endpoint: PUT /users/:id</code></pre> <p>The following properties of the provided User instance can be set during update:<pre><code> email (required) - Email username (required) - Username name (required) - Name skype (optional) - Skype ID linkedin (optional) - LinkedIn twitter (optional) - Twitter account websiteUrl (optional) - Website URL organization (optional) - Organization name projectsLimit (optional) - Number of projects user can create externUid (optional) - External UID provider (optional) - External provider name bio (optional) - User's biography location (optional) - User's location admin (optional) - User is admin - true or false (default) canCreateGroup (optional) - User can create groups - true or false skipConfirmation (optional) - Skip confirmation - true or false (default) external (optional) - Flags the user as external - true or false(default) sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user </code></pre> @param user the User instance with the user info to modify @param password the new password for the user @param projectsLimit the maximum number of project @return the modified User instance @throws GitLabApiException if any exception occurs @deprecated Will be removed in version 5.0, replaced by {@link #updateUser(User, CharSequence)}
[ "Modifies", "an", "existing", "user", ".", "Only", "administrators", "can", "change", "attributes", "of", "a", "user", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L530-L535
alkacon/opencms-core
src/org/opencms/db/CmsAliasManager.java
CmsAliasManager.processAliasImport
protected CmsAliasImportResult processAliasImport( CmsObject cms, String siteRoot, String aliasPath, String vfsPath, CmsAliasMode mode) { """ Processes a single alias import operation which has already been parsed into fields.<p> @param cms the current CMS context @param siteRoot the site root @param aliasPath the alias path @param vfsPath the VFS resource path @param mode the alias mode @return the result of the import operation """ try { return importAlias(cms, siteRoot, aliasPath, vfsPath, mode); } catch (CmsException e) { return new CmsAliasImportResult( CmsAliasImportStatus.aliasImportError, e.getLocalizedMessage(), aliasPath, vfsPath, mode); } }
java
protected CmsAliasImportResult processAliasImport( CmsObject cms, String siteRoot, String aliasPath, String vfsPath, CmsAliasMode mode) { try { return importAlias(cms, siteRoot, aliasPath, vfsPath, mode); } catch (CmsException e) { return new CmsAliasImportResult( CmsAliasImportStatus.aliasImportError, e.getLocalizedMessage(), aliasPath, vfsPath, mode); } }
[ "protected", "CmsAliasImportResult", "processAliasImport", "(", "CmsObject", "cms", ",", "String", "siteRoot", ",", "String", "aliasPath", ",", "String", "vfsPath", ",", "CmsAliasMode", "mode", ")", "{", "try", "{", "return", "importAlias", "(", "cms", ",", "siteRoot", ",", "aliasPath", ",", "vfsPath", ",", "mode", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "return", "new", "CmsAliasImportResult", "(", "CmsAliasImportStatus", ".", "aliasImportError", ",", "e", ".", "getLocalizedMessage", "(", ")", ",", "aliasPath", ",", "vfsPath", ",", "mode", ")", ";", "}", "}" ]
Processes a single alias import operation which has already been parsed into fields.<p> @param cms the current CMS context @param siteRoot the site root @param aliasPath the alias path @param vfsPath the VFS resource path @param mode the alias mode @return the result of the import operation
[ "Processes", "a", "single", "alias", "import", "operation", "which", "has", "already", "been", "parsed", "into", "fields", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L409-L426
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java
RandomMatrices_ZDRM.rectangle
public static ZMatrixRMaj rectangle(int numRow , int numCol , Random rand ) { """ <p> Returns a matrix where all the elements are selected independently from a uniform distribution between -1 and 1 inclusive. </p> @param numRow Number of rows in the new matrix. @param numCol Number of columns in the new matrix. @param rand Random number generator used to fill the matrix. @return The randomly generated matrix. """ return rectangle(numRow,numCol,-1,1,rand); }
java
public static ZMatrixRMaj rectangle(int numRow , int numCol , Random rand ) { return rectangle(numRow,numCol,-1,1,rand); }
[ "public", "static", "ZMatrixRMaj", "rectangle", "(", "int", "numRow", ",", "int", "numCol", ",", "Random", "rand", ")", "{", "return", "rectangle", "(", "numRow", ",", "numCol", ",", "-", "1", ",", "1", ",", "rand", ")", ";", "}" ]
<p> Returns a matrix where all the elements are selected independently from a uniform distribution between -1 and 1 inclusive. </p> @param numRow Number of rows in the new matrix. @param numCol Number of columns in the new matrix. @param rand Random number generator used to fill the matrix. @return The randomly generated matrix.
[ "<p", ">", "Returns", "a", "matrix", "where", "all", "the", "elements", "are", "selected", "independently", "from", "a", "uniform", "distribution", "between", "-", "1", "and", "1", "inclusive", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java#L43-L45
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java
LocaleUtils.getAvailableLocaleSuffixes
public static List<String> getAvailableLocaleSuffixes(String messageBundle, ServletContext servletContext) { """ Returns the list of available locale suffixes for a message resource bundle @param messageBundle the resource bundle path @param servletContext the servlet context @return the list of available locale suffixes for a message resource bundle """ return getAvailableLocaleSuffixes(messageBundle, MSG_RESOURCE_BUNDLE_SUFFIX, servletContext); }
java
public static List<String> getAvailableLocaleSuffixes(String messageBundle, ServletContext servletContext) { return getAvailableLocaleSuffixes(messageBundle, MSG_RESOURCE_BUNDLE_SUFFIX, servletContext); }
[ "public", "static", "List", "<", "String", ">", "getAvailableLocaleSuffixes", "(", "String", "messageBundle", ",", "ServletContext", "servletContext", ")", "{", "return", "getAvailableLocaleSuffixes", "(", "messageBundle", ",", "MSG_RESOURCE_BUNDLE_SUFFIX", ",", "servletContext", ")", ";", "}" ]
Returns the list of available locale suffixes for a message resource bundle @param messageBundle the resource bundle path @param servletContext the servlet context @return the list of available locale suffixes for a message resource bundle
[ "Returns", "the", "list", "of", "available", "locale", "suffixes", "for", "a", "message", "resource", "bundle" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java#L180-L183
kaazing/gateway
security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java
DefaultLoginContextFactory.createLoginContext
protected LoginContext createLoginContext(Subject subject, CallbackHandler handler, DefaultLoginResult loginResult) throws LoginException { """ For login context providers that can abstract their tokens into a subject and a CallbackHandler that understands their token, this is a utility method that can be called to construct a create login. @param subject the subject that has been created for the user, or <code>null</code> if none has been created. @param handler the callback handler that can understand @param loginResult the login result object capturing the result of the login call. @return a login context @throws LoginException when a login context cannot be created """ return new ResultAwareLoginContext(name, subject, handler, configuration, loginResult); }
java
protected LoginContext createLoginContext(Subject subject, CallbackHandler handler, DefaultLoginResult loginResult) throws LoginException { return new ResultAwareLoginContext(name, subject, handler, configuration, loginResult); }
[ "protected", "LoginContext", "createLoginContext", "(", "Subject", "subject", ",", "CallbackHandler", "handler", ",", "DefaultLoginResult", "loginResult", ")", "throws", "LoginException", "{", "return", "new", "ResultAwareLoginContext", "(", "name", ",", "subject", ",", "handler", ",", "configuration", ",", "loginResult", ")", ";", "}" ]
For login context providers that can abstract their tokens into a subject and a CallbackHandler that understands their token, this is a utility method that can be called to construct a create login. @param subject the subject that has been created for the user, or <code>null</code> if none has been created. @param handler the callback handler that can understand @param loginResult the login result object capturing the result of the login call. @return a login context @throws LoginException when a login context cannot be created
[ "For", "login", "context", "providers", "that", "can", "abstract", "their", "tokens", "into", "a", "subject", "and", "a", "CallbackHandler", "that", "understands", "their", "token", "this", "is", "a", "utility", "method", "that", "can", "be", "called", "to", "construct", "a", "create", "login", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java#L192-L195
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java
ServerImpl.setSelfDeafened
public void setSelfDeafened(long userId, boolean deafened) { """ Sets the self-deafened state of the user with the given id. @param userId The id of the user. @param deafened Whether the user with the given id is self-deafened or not. """ if (deafened) { selfDeafened.add(userId); } else { selfDeafened.remove(userId); } }
java
public void setSelfDeafened(long userId, boolean deafened) { if (deafened) { selfDeafened.add(userId); } else { selfDeafened.remove(userId); } }
[ "public", "void", "setSelfDeafened", "(", "long", "userId", ",", "boolean", "deafened", ")", "{", "if", "(", "deafened", ")", "{", "selfDeafened", ".", "add", "(", "userId", ")", ";", "}", "else", "{", "selfDeafened", ".", "remove", "(", "userId", ")", ";", "}", "}" ]
Sets the self-deafened state of the user with the given id. @param userId The id of the user. @param deafened Whether the user with the given id is self-deafened or not.
[ "Sets", "the", "self", "-", "deafened", "state", "of", "the", "user", "with", "the", "given", "id", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L744-L750
renepickhardt/metalcon
graphityServer/src/main/java/de/metalcon/server/tomcat/NSSP/create/CreateRequest.java
CreateRequest.checkRequest
public static CreateRequest checkRequest(final HttpServletRequest request, final DiskFileItemFactory factory, final CreateResponse createResponse) throws FileUploadException { """ check a create request for validity concerning NSSP @param request Tomcat servlet request @param factory disk file item factory @param createResponse create response object @return create request object<br> <b>null</b> if the create request is invalid @throws FileUploadException if errors encountered while processing the request """ final FormItemList formItemList = FormItemList.extractFormItems( request, factory); return checkRequest(formItemList, createResponse); }
java
public static CreateRequest checkRequest(final HttpServletRequest request, final DiskFileItemFactory factory, final CreateResponse createResponse) throws FileUploadException { final FormItemList formItemList = FormItemList.extractFormItems( request, factory); return checkRequest(formItemList, createResponse); }
[ "public", "static", "CreateRequest", "checkRequest", "(", "final", "HttpServletRequest", "request", ",", "final", "DiskFileItemFactory", "factory", ",", "final", "CreateResponse", "createResponse", ")", "throws", "FileUploadException", "{", "final", "FormItemList", "formItemList", "=", "FormItemList", ".", "extractFormItems", "(", "request", ",", "factory", ")", ";", "return", "checkRequest", "(", "formItemList", ",", "createResponse", ")", ";", "}" ]
check a create request for validity concerning NSSP @param request Tomcat servlet request @param factory disk file item factory @param createResponse create response object @return create request object<br> <b>null</b> if the create request is invalid @throws FileUploadException if errors encountered while processing the request
[ "check", "a", "create", "request", "for", "validity", "concerning", "NSSP" ]
train
https://github.com/renepickhardt/metalcon/blob/26a7bd89d2225fe2172dc958d10f64a1bd9cf52f/graphityServer/src/main/java/de/metalcon/server/tomcat/NSSP/create/CreateRequest.java#L56-L62
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeVariableAccess
private RValue executeVariableAccess(Expr.VariableAccess expr, CallStack frame) { """ Execute a variable access expression at a given point in the function or method body. This simply loads the value of the given variable from the frame. @param expr --- The expression to execute @param frame --- The current stack frame @return """ Decl.Variable decl = expr.getVariableDeclaration(); return frame.getLocal(decl.getName()); }
java
private RValue executeVariableAccess(Expr.VariableAccess expr, CallStack frame) { Decl.Variable decl = expr.getVariableDeclaration(); return frame.getLocal(decl.getName()); }
[ "private", "RValue", "executeVariableAccess", "(", "Expr", ".", "VariableAccess", "expr", ",", "CallStack", "frame", ")", "{", "Decl", ".", "Variable", "decl", "=", "expr", ".", "getVariableDeclaration", "(", ")", ";", "return", "frame", ".", "getLocal", "(", "decl", ".", "getName", "(", ")", ")", ";", "}" ]
Execute a variable access expression at a given point in the function or method body. This simply loads the value of the given variable from the frame. @param expr --- The expression to execute @param frame --- The current stack frame @return
[ "Execute", "a", "variable", "access", "expression", "at", "a", "given", "point", "in", "the", "function", "or", "method", "body", ".", "This", "simply", "loads", "the", "value", "of", "the", "given", "variable", "from", "the", "frame", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L813-L816
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java
JsonUtil.put
public static void put(Writer writer, char value) throws IOException { """ Writes the given value with the given writer, sanitizing with {@link #sanitize(String)} as a valid JSON-formatted data. @param writer @param value @throws IOException @author vvakame """ writer.write("\""); writer.write(sanitize(value)); writer.write("\""); }
java
public static void put(Writer writer, char value) throws IOException { writer.write("\""); writer.write(sanitize(value)); writer.write("\""); }
[ "public", "static", "void", "put", "(", "Writer", "writer", ",", "char", "value", ")", "throws", "IOException", "{", "writer", ".", "write", "(", "\"\\\"\"", ")", ";", "writer", ".", "write", "(", "sanitize", "(", "value", ")", ")", ";", "writer", ".", "write", "(", "\"\\\"\"", ")", ";", "}" ]
Writes the given value with the given writer, sanitizing with {@link #sanitize(String)} as a valid JSON-formatted data. @param writer @param value @throws IOException @author vvakame
[ "Writes", "the", "given", "value", "with", "the", "given", "writer", "sanitizing", "with", "{" ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L182-L186
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsDialogElements.java
CmsDialogElements.computeElements
public static List<CmsDialogElement> computeElements(CmsObject cms, String xmlPageUri, Locale locale) { """ Creates a list of possible elements of a template from the template property "template-elements" and the elements available in the provided resource file.<p> @param cms the CmsObject @param xmlPageUri the resource to read the elements from @param locale the current element locale @return the list of elements in a String array with element name, nice name (if present) and mandatory flag """ CmsXmlPage page = null; try { // read the xmlpage file CmsFile pageFile = cms.readFile(xmlPageUri, CmsResourceFilter.IGNORE_EXPIRATION); page = CmsXmlPageFactory.unmarshal(cms, pageFile); } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_XMLPAGE_FAILED_1, xmlPageUri), e); // xmlpage will be null, only "template-elements" property on template will be checked } return computeElements(cms, page, xmlPageUri, locale); }
java
public static List<CmsDialogElement> computeElements(CmsObject cms, String xmlPageUri, Locale locale) { CmsXmlPage page = null; try { // read the xmlpage file CmsFile pageFile = cms.readFile(xmlPageUri, CmsResourceFilter.IGNORE_EXPIRATION); page = CmsXmlPageFactory.unmarshal(cms, pageFile); } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_XMLPAGE_FAILED_1, xmlPageUri), e); // xmlpage will be null, only "template-elements" property on template will be checked } return computeElements(cms, page, xmlPageUri, locale); }
[ "public", "static", "List", "<", "CmsDialogElement", ">", "computeElements", "(", "CmsObject", "cms", ",", "String", "xmlPageUri", ",", "Locale", "locale", ")", "{", "CmsXmlPage", "page", "=", "null", ";", "try", "{", "// read the xmlpage file", "CmsFile", "pageFile", "=", "cms", ".", "readFile", "(", "xmlPageUri", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "page", "=", "CmsXmlPageFactory", ".", "unmarshal", "(", "cms", ",", "pageFile", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "warn", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_READ_XMLPAGE_FAILED_1", ",", "xmlPageUri", ")", ",", "e", ")", ";", "// xmlpage will be null, only \"template-elements\" property on template will be checked", "}", "return", "computeElements", "(", "cms", ",", "page", ",", "xmlPageUri", ",", "locale", ")", ";", "}" ]
Creates a list of possible elements of a template from the template property "template-elements" and the elements available in the provided resource file.<p> @param cms the CmsObject @param xmlPageUri the resource to read the elements from @param locale the current element locale @return the list of elements in a String array with element name, nice name (if present) and mandatory flag
[ "Creates", "a", "list", "of", "possible", "elements", "of", "a", "template", "from", "the", "template", "property", "template", "-", "elements", "and", "the", "elements", "available", "in", "the", "provided", "resource", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsDialogElements.java#L226-L238
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java
ProviderList.getJarList
ProviderList getJarList(String[] jarClassNames) { """ Construct a special ProviderList for JAR verification. It consists of the providers specified via jarClassNames, which must be on the bootclasspath and cannot be in signed JAR files. This is to avoid possible recursion and deadlock during verification. """ List<ProviderConfig> newConfigs = new ArrayList<>(); for (String className : jarClassNames) { ProviderConfig newConfig = new ProviderConfig(className); for (ProviderConfig config : configs) { // if the equivalent object is present in this provider list, // use the old object rather than the new object. // this ensures that when the provider is loaded in the // new thread local list, it will also become available // in this provider list if (config.equals(newConfig)) { newConfig = config; break; } } newConfigs.add(newConfig); } ProviderConfig[] configArray = newConfigs.toArray(PC0); return new ProviderList(configArray, false); }
java
ProviderList getJarList(String[] jarClassNames) { List<ProviderConfig> newConfigs = new ArrayList<>(); for (String className : jarClassNames) { ProviderConfig newConfig = new ProviderConfig(className); for (ProviderConfig config : configs) { // if the equivalent object is present in this provider list, // use the old object rather than the new object. // this ensures that when the provider is loaded in the // new thread local list, it will also become available // in this provider list if (config.equals(newConfig)) { newConfig = config; break; } } newConfigs.add(newConfig); } ProviderConfig[] configArray = newConfigs.toArray(PC0); return new ProviderList(configArray, false); }
[ "ProviderList", "getJarList", "(", "String", "[", "]", "jarClassNames", ")", "{", "List", "<", "ProviderConfig", ">", "newConfigs", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "className", ":", "jarClassNames", ")", "{", "ProviderConfig", "newConfig", "=", "new", "ProviderConfig", "(", "className", ")", ";", "for", "(", "ProviderConfig", "config", ":", "configs", ")", "{", "// if the equivalent object is present in this provider list,", "// use the old object rather than the new object.", "// this ensures that when the provider is loaded in the", "// new thread local list, it will also become available", "// in this provider list", "if", "(", "config", ".", "equals", "(", "newConfig", ")", ")", "{", "newConfig", "=", "config", ";", "break", ";", "}", "}", "newConfigs", ".", "add", "(", "newConfig", ")", ";", "}", "ProviderConfig", "[", "]", "configArray", "=", "newConfigs", ".", "toArray", "(", "PC0", ")", ";", "return", "new", "ProviderList", "(", "configArray", ",", "false", ")", ";", "}" ]
Construct a special ProviderList for JAR verification. It consists of the providers specified via jarClassNames, which must be on the bootclasspath and cannot be in signed JAR files. This is to avoid possible recursion and deadlock during verification.
[ "Construct", "a", "special", "ProviderList", "for", "JAR", "verification", ".", "It", "consists", "of", "the", "providers", "specified", "via", "jarClassNames", "which", "must", "be", "on", "the", "bootclasspath", "and", "cannot", "be", "in", "signed", "JAR", "files", ".", "This", "is", "to", "avoid", "possible", "recursion", "and", "deadlock", "during", "verification", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java#L209-L228
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VcfManager.java
VcfManager.query
public List<VariantContext> query(Region region) throws Exception { """ This method aims to provide a very simple, safe and quick way of accessing to a small fragment of the VCF file. This must not be used in production for reading big data files. It returns a maximum of 10,000 variant records. @param region @return @throws IOException """ return query(region, null, new VariantOptions(), VariantContext.class); }
java
public List<VariantContext> query(Region region) throws Exception { return query(region, null, new VariantOptions(), VariantContext.class); }
[ "public", "List", "<", "VariantContext", ">", "query", "(", "Region", "region", ")", "throws", "Exception", "{", "return", "query", "(", "region", ",", "null", ",", "new", "VariantOptions", "(", ")", ",", "VariantContext", ".", "class", ")", ";", "}" ]
This method aims to provide a very simple, safe and quick way of accessing to a small fragment of the VCF file. This must not be used in production for reading big data files. It returns a maximum of 10,000 variant records. @param region @return @throws IOException
[ "This", "method", "aims", "to", "provide", "a", "very", "simple", "safe", "and", "quick", "way", "of", "accessing", "to", "a", "small", "fragment", "of", "the", "VCF", "file", ".", "This", "must", "not", "be", "used", "in", "production", "for", "reading", "big", "data", "files", ".", "It", "returns", "a", "maximum", "of", "10", "000", "variant", "records", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VcfManager.java#L127-L129
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setDate
public void setDate(final int parameterIndex, final Date date) throws SQLException { """ Sets the designated parameter to the given <code>java.sql.Date</code> value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQL <code>DATE</code> value when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param date the parameter value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> """ if(date == null) { setNull(parameterIndex, Types.DATE); return; } setParameter(parameterIndex, new DateParameter(date.getTime())); }
java
public void setDate(final int parameterIndex, final Date date) throws SQLException { if(date == null) { setNull(parameterIndex, Types.DATE); return; } setParameter(parameterIndex, new DateParameter(date.getTime())); }
[ "public", "void", "setDate", "(", "final", "int", "parameterIndex", ",", "final", "Date", "date", ")", "throws", "SQLException", "{", "if", "(", "date", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "DATE", ")", ";", "return", ";", "}", "setParameter", "(", "parameterIndex", ",", "new", "DateParameter", "(", "date", ".", "getTime", "(", ")", ")", ")", ";", "}" ]
Sets the designated parameter to the given <code>java.sql.Date</code> value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQL <code>DATE</code> value when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param date the parameter value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "java", ".", "sql", ".", "Date<", "/", "code", ">", "value", "using", "the", "default", "time", "zone", "of", "the", "virtual", "machine", "that", "is", "running", "the", "application", ".", "The", "driver", "converts", "this", "to", "an", "SQL", "<code", ">", "DATE<", "/", "code", ">", "value", "when", "it", "sends", "it", "to", "the", "database", "." ]
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1130-L1138
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setReplicatedMapConfigs
public Config setReplicatedMapConfigs(Map<String, ReplicatedMapConfig> replicatedMapConfigs) { """ Sets the map of {@link com.hazelcast.core.ReplicatedMap} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param replicatedMapConfigs the replicated map configuration map to set @return this config instance """ this.replicatedMapConfigs.clear(); this.replicatedMapConfigs.putAll(replicatedMapConfigs); for (final Entry<String, ReplicatedMapConfig> entry : this.replicatedMapConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setReplicatedMapConfigs(Map<String, ReplicatedMapConfig> replicatedMapConfigs) { this.replicatedMapConfigs.clear(); this.replicatedMapConfigs.putAll(replicatedMapConfigs); for (final Entry<String, ReplicatedMapConfig> entry : this.replicatedMapConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setReplicatedMapConfigs", "(", "Map", "<", "String", ",", "ReplicatedMapConfig", ">", "replicatedMapConfigs", ")", "{", "this", ".", "replicatedMapConfigs", ".", "clear", "(", ")", ";", "this", ".", "replicatedMapConfigs", ".", "putAll", "(", "replicatedMapConfigs", ")", ";", "for", "(", "final", "Entry", "<", "String", ",", "ReplicatedMapConfig", ">", "entry", ":", "this", ".", "replicatedMapConfigs", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of {@link com.hazelcast.core.ReplicatedMap} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param replicatedMapConfigs the replicated map configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "ReplicatedMap", "}", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1197-L1204
aws/aws-sdk-java
jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java
JmesPathEvaluationVisitor.visit
@Override public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException { """ Evaluates function expression in applicative order. Each argument is an expression, each argument expression is evaluated before evaluating the function. The function is then called with the evaluated function arguments. The result of the function-expression is the result returned by the function call. @param function JmesPath function type @param input Input json node against which evaluation is done @return Result of the function evaluation @throws InvalidTypeException """ List<JsonNode> evaluatedArguments = new ArrayList<JsonNode>(); List<JmesPathExpression> arguments = function.getExpressions(); for (JmesPathExpression arg : arguments) { evaluatedArguments.add(arg.accept(this, input)); } return function.evaluate(evaluatedArguments); }
java
@Override public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException { List<JsonNode> evaluatedArguments = new ArrayList<JsonNode>(); List<JmesPathExpression> arguments = function.getExpressions(); for (JmesPathExpression arg : arguments) { evaluatedArguments.add(arg.accept(this, input)); } return function.evaluate(evaluatedArguments); }
[ "@", "Override", "public", "JsonNode", "visit", "(", "JmesPathFunction", "function", ",", "JsonNode", "input", ")", "throws", "InvalidTypeException", "{", "List", "<", "JsonNode", ">", "evaluatedArguments", "=", "new", "ArrayList", "<", "JsonNode", ">", "(", ")", ";", "List", "<", "JmesPathExpression", ">", "arguments", "=", "function", ".", "getExpressions", "(", ")", ";", "for", "(", "JmesPathExpression", "arg", ":", "arguments", ")", "{", "evaluatedArguments", ".", "add", "(", "arg", ".", "accept", "(", "this", ",", "input", ")", ")", ";", "}", "return", "function", ".", "evaluate", "(", "evaluatedArguments", ")", ";", "}" ]
Evaluates function expression in applicative order. Each argument is an expression, each argument expression is evaluated before evaluating the function. The function is then called with the evaluated function arguments. The result of the function-expression is the result returned by the function call. @param function JmesPath function type @param input Input json node against which evaluation is done @return Result of the function evaluation @throws InvalidTypeException
[ "Evaluates", "function", "expression", "in", "applicative", "order", ".", "Each", "argument", "is", "an", "expression", "each", "argument", "expression", "is", "evaluated", "before", "evaluating", "the", "function", ".", "The", "function", "is", "then", "called", "with", "the", "evaluated", "function", "arguments", ".", "The", "result", "of", "the", "function", "-", "expression", "is", "the", "result", "returned", "by", "the", "function", "call", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java#L193-L201
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java
InstantSearch.getEmptyView
@Nullable private static View getEmptyView(@Nullable View rootView) { """ Finds the empty view in the given rootView. @param rootView the topmost view in the view hierarchy of the Activity. @return the empty view if it was in the rootView. @throws RuntimeException if the rootView is null. """ if (rootView == null) { throw new RuntimeException("A null rootView was passed to getEmptyView, but Hits/RefinementList require one."); } return rootView.findViewById(android.R.id.empty); }
java
@Nullable private static View getEmptyView(@Nullable View rootView) { if (rootView == null) { throw new RuntimeException("A null rootView was passed to getEmptyView, but Hits/RefinementList require one."); } return rootView.findViewById(android.R.id.empty); }
[ "@", "Nullable", "private", "static", "View", "getEmptyView", "(", "@", "Nullable", "View", "rootView", ")", "{", "if", "(", "rootView", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"A null rootView was passed to getEmptyView, but Hits/RefinementList require one.\"", ")", ";", "}", "return", "rootView", ".", "findViewById", "(", "android", ".", "R", ".", "id", ".", "empty", ")", ";", "}" ]
Finds the empty view in the given rootView. @param rootView the topmost view in the view hierarchy of the Activity. @return the empty view if it was in the rootView. @throws RuntimeException if the rootView is null.
[ "Finds", "the", "empty", "view", "in", "the", "given", "rootView", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java#L573-L579
lessthanoptimal/BoofCV
main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java
UtilImageIO.loadImage
public static <T extends ImageGray<T>> T loadImage(String fileName, Class<T> imageType ) { """ Loads the image and converts into the specified image type. @param fileName Path to image file. @param imageType Type of image that should be returned. @return The image or null if the image could not be loaded. """ BufferedImage img = loadImage(fileName); if( img == null ) return null; return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType); }
java
public static <T extends ImageGray<T>> T loadImage(String fileName, Class<T> imageType ) { BufferedImage img = loadImage(fileName); if( img == null ) return null; return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "T", "loadImage", "(", "String", "fileName", ",", "Class", "<", "T", ">", "imageType", ")", "{", "BufferedImage", "img", "=", "loadImage", "(", "fileName", ")", ";", "if", "(", "img", "==", "null", ")", "return", "null", ";", "return", "ConvertBufferedImage", ".", "convertFromSingle", "(", "img", ",", "(", "T", ")", "null", ",", "imageType", ")", ";", "}" ]
Loads the image and converts into the specified image type. @param fileName Path to image file. @param imageType Type of image that should be returned. @return The image or null if the image could not be loaded.
[ "Loads", "the", "image", "and", "converts", "into", "the", "specified", "image", "type", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L121-L127
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java
Base64.setInitialBuffer
void setInitialBuffer(byte[] out, int outPos, int outAvail) { """ Sets the streaming buffer. This is a small optimization where we try to buffer directly to the consumer's output array for one round (if the consumer calls this method first) instead of starting our own buffer. @param out byte[] array to buffer directly to. @param outPos Position to start buffering into. @param outAvail Amount of bytes available for direct buffering. """ // We can re-use consumer's original output array under // special circumstances, saving on some System.arraycopy(). if (out != null && out.length == outAvail) { buffer = out; pos = outPos; readPos = outPos; } }
java
void setInitialBuffer(byte[] out, int outPos, int outAvail) { // We can re-use consumer's original output array under // special circumstances, saving on some System.arraycopy(). if (out != null && out.length == outAvail) { buffer = out; pos = outPos; readPos = outPos; } }
[ "void", "setInitialBuffer", "(", "byte", "[", "]", "out", ",", "int", "outPos", ",", "int", "outAvail", ")", "{", "// We can re-use consumer's original output array under", "// special circumstances, saving on some System.arraycopy().", "if", "(", "out", "!=", "null", "&&", "out", ".", "length", "==", "outAvail", ")", "{", "buffer", "=", "out", ";", "pos", "=", "outPos", ";", "readPos", "=", "outPos", ";", "}", "}" ]
Sets the streaming buffer. This is a small optimization where we try to buffer directly to the consumer's output array for one round (if the consumer calls this method first) instead of starting our own buffer. @param out byte[] array to buffer directly to. @param outPos Position to start buffering into. @param outAvail Amount of bytes available for direct buffering.
[ "Sets", "the", "streaming", "buffer", ".", "This", "is", "a", "small", "optimization", "where", "we", "try", "to", "buffer", "directly", "to", "the", "consumer", "s", "output", "array", "for", "one", "round", "(", "if", "the", "consumer", "calls", "this", "method", "first", ")", "instead", "of", "starting", "our", "own", "buffer", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java#L419-L427
facebook/fresco
drawee/src/main/java/com/facebook/drawee/view/SimpleDraweeView.java
SimpleDraweeView.setImageURI
public void setImageURI(Uri uri, @Nullable Object callerContext) { """ Displays an image given by the uri. @param uri uri of the image @param callerContext caller context """ DraweeController controller = mControllerBuilder .setCallerContext(callerContext) .setUri(uri) .setOldController(getController()) .build(); setController(controller); }
java
public void setImageURI(Uri uri, @Nullable Object callerContext) { DraweeController controller = mControllerBuilder .setCallerContext(callerContext) .setUri(uri) .setOldController(getController()) .build(); setController(controller); }
[ "public", "void", "setImageURI", "(", "Uri", "uri", ",", "@", "Nullable", "Object", "callerContext", ")", "{", "DraweeController", "controller", "=", "mControllerBuilder", ".", "setCallerContext", "(", "callerContext", ")", ".", "setUri", "(", "uri", ")", ".", "setOldController", "(", "getController", "(", ")", ")", ".", "build", "(", ")", ";", "setController", "(", "controller", ")", ";", "}" ]
Displays an image given by the uri. @param uri uri of the image @param callerContext caller context
[ "Displays", "an", "image", "given", "by", "the", "uri", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/view/SimpleDraweeView.java#L162-L170
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java
MailService.findMessage
public MailMessage findMessage(final MailAccount mailAccount, final Predicate<MailMessage> condition, final long timeoutSeconds) { """ <p> Tries to find a message for the specified mail account applying the specified {@code condition} until it times out using the specified {@code timeout} and {@link EmailConstants#MAIL_SLEEP_MILLIS}. </p> <b>Note:</b><br /> This method uses the specified mail account independently without reservation. If, however, the specified mail account has been reserved by any thread (including the current one), an {@link IllegalStateException} is thrown. </p> @param mailAccount the mail account @param condition the condition a message must meet @param timeoutSeconds the timeout in seconds @return the mail message """ return findMessage(mailAccount, condition, timeoutSeconds, defaultSleepMillis); }
java
public MailMessage findMessage(final MailAccount mailAccount, final Predicate<MailMessage> condition, final long timeoutSeconds) { return findMessage(mailAccount, condition, timeoutSeconds, defaultSleepMillis); }
[ "public", "MailMessage", "findMessage", "(", "final", "MailAccount", "mailAccount", ",", "final", "Predicate", "<", "MailMessage", ">", "condition", ",", "final", "long", "timeoutSeconds", ")", "{", "return", "findMessage", "(", "mailAccount", ",", "condition", ",", "timeoutSeconds", ",", "defaultSleepMillis", ")", ";", "}" ]
<p> Tries to find a message for the specified mail account applying the specified {@code condition} until it times out using the specified {@code timeout} and {@link EmailConstants#MAIL_SLEEP_MILLIS}. </p> <b>Note:</b><br /> This method uses the specified mail account independently without reservation. If, however, the specified mail account has been reserved by any thread (including the current one), an {@link IllegalStateException} is thrown. </p> @param mailAccount the mail account @param condition the condition a message must meet @param timeoutSeconds the timeout in seconds @return the mail message
[ "<p", ">", "Tries", "to", "find", "a", "message", "for", "the", "specified", "mail", "account", "applying", "the", "specified", "{", "@code", "condition", "}", "until", "it", "times", "out", "using", "the", "specified", "{", "@code", "timeout", "}", "and", "{", "@link", "EmailConstants#MAIL_SLEEP_MILLIS", "}", ".", "<", "/", "p", ">", "<b", ">", "Note", ":", "<", "/", "b", ">", "<br", "/", ">", "This", "method", "uses", "the", "specified", "mail", "account", "independently", "without", "reservation", ".", "If", "however", "the", "specified", "mail", "account", "has", "been", "reserved", "by", "any", "thread", "(", "including", "the", "current", "one", ")", "an", "{", "@link", "IllegalStateException", "}", "is", "thrown", ".", "<", "/", "p", ">" ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L141-L144
CenturyLinkCloud/mdw
mdw-workflow/assets/com/centurylink/mdw/camel/DefaultNotifyHandler.java
DefaultNotifyHandler.handleEventMessage
public String handleEventMessage(String message, Object messageObj, Map<String,String> metaInfo) throws EventHandlerException { """ This is for non-Camel style event handlers. It is not used here. Overriding has no effect in the context of a Camel route. """ return null; }
java
public String handleEventMessage(String message, Object messageObj, Map<String,String> metaInfo) throws EventHandlerException { return null; }
[ "public", "String", "handleEventMessage", "(", "String", "message", ",", "Object", "messageObj", ",", "Map", "<", "String", ",", "String", ">", "metaInfo", ")", "throws", "EventHandlerException", "{", "return", "null", ";", "}" ]
This is for non-Camel style event handlers. It is not used here. Overriding has no effect in the context of a Camel route.
[ "This", "is", "for", "non", "-", "Camel", "style", "event", "handlers", ".", "It", "is", "not", "used", "here", ".", "Overriding", "has", "no", "effect", "in", "the", "context", "of", "a", "Camel", "route", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/assets/com/centurylink/mdw/camel/DefaultNotifyHandler.java#L94-L96
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/common/CheckUpdateApi.java
CheckUpdateApi.onConnect
@Override public void onConnect(int rst, HuaweiApiClient client) { """ Huawei Api Client 连接回调 @param rst 结果码 @param client HuaweiApiClient 实例 """ HMSAgentLog.d("onConnect:" + rst); Activity activityCur = ActivityMgr.INST.getLastActivity(); if (activityCur != null && client != null) { client.checkUpdate(activityCur, this); } else if (activity != null && client != null){ client.checkUpdate(activity, this); } else { // 跟SE确认:activity 为 null , 不处理 | Activity is null and does not need to be processed HMSAgentLog.e("no activity to checkUpdate"); onCheckUpdateResult(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE); return; } }
java
@Override public void onConnect(int rst, HuaweiApiClient client) { HMSAgentLog.d("onConnect:" + rst); Activity activityCur = ActivityMgr.INST.getLastActivity(); if (activityCur != null && client != null) { client.checkUpdate(activityCur, this); } else if (activity != null && client != null){ client.checkUpdate(activity, this); } else { // 跟SE确认:activity 为 null , 不处理 | Activity is null and does not need to be processed HMSAgentLog.e("no activity to checkUpdate"); onCheckUpdateResult(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE); return; } }
[ "@", "Override", "public", "void", "onConnect", "(", "int", "rst", ",", "HuaweiApiClient", "client", ")", "{", "HMSAgentLog", ".", "d", "(", "\"onConnect:\"", "+", "rst", ")", ";", "Activity", "activityCur", "=", "ActivityMgr", ".", "INST", ".", "getLastActivity", "(", ")", ";", "if", "(", "activityCur", "!=", "null", "&&", "client", "!=", "null", ")", "{", "client", ".", "checkUpdate", "(", "activityCur", ",", "this", ")", ";", "}", "else", "if", "(", "activity", "!=", "null", "&&", "client", "!=", "null", ")", "{", "client", ".", "checkUpdate", "(", "activity", ",", "this", ")", ";", "}", "else", "{", "// 跟SE确认:activity 为 null , 不处理 | Activity is null and does not need to be processed\r", "HMSAgentLog", ".", "e", "(", "\"no activity to checkUpdate\"", ")", ";", "onCheckUpdateResult", "(", "HMSAgent", ".", "AgentResultCode", ".", "NO_ACTIVITY_FOR_USE", ")", ";", "return", ";", "}", "}" ]
Huawei Api Client 连接回调 @param rst 结果码 @param client HuaweiApiClient 实例
[ "Huawei", "Api", "Client", "连接回调" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/common/CheckUpdateApi.java#L32-L49
lucee/Lucee
core/src/main/java/lucee/runtime/type/wrap/ListAsArray.java
ListAsArray.addAll
@Override public boolean addAll(int index, java.util.Collection c) { """ /*---@Override public void add(int index, Object element) { list.add(index, element); } @Override public boolean addAll(java.util.Collection c) { return list.addAll(c); } """ return list.addAll(index, c); }
java
@Override public boolean addAll(int index, java.util.Collection c) { return list.addAll(index, c); }
[ "@", "Override", "public", "boolean", "addAll", "(", "int", "index", ",", "java", ".", "util", ".", "Collection", "c", ")", "{", "return", "list", ".", "addAll", "(", "index", ",", "c", ")", ";", "}" ]
/*---@Override public void add(int index, Object element) { list.add(index, element); } @Override public boolean addAll(java.util.Collection c) { return list.addAll(c); }
[ "/", "*", "---", "@Override", "public", "void", "add", "(", "int", "index", "Object", "element", ")", "{", "list", ".", "add", "(", "index", "element", ")", ";", "}" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/wrap/ListAsArray.java#L482-L485
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/util/FluentIterableWrapper.java
FluentIterableWrapper.filter
@CheckReturnValue public final <F extends E> FluentIterableWrapper<F> filter(Class<F> clazz) { """ Returns the elements from this fluent iterable that are instances of the supplied type. The resulting fluent iterable's iterator does not support {@code remove()}. @since 1.25.0 """ return from(Iterables.filter(iterable, clazz)); }
java
@CheckReturnValue public final <F extends E> FluentIterableWrapper<F> filter(Class<F> clazz) { return from(Iterables.filter(iterable, clazz)); }
[ "@", "CheckReturnValue", "public", "final", "<", "F", "extends", "E", ">", "FluentIterableWrapper", "<", "F", ">", "filter", "(", "Class", "<", "F", ">", "clazz", ")", "{", "return", "from", "(", "Iterables", ".", "filter", "(", "iterable", ",", "clazz", ")", ")", ";", "}" ]
Returns the elements from this fluent iterable that are instances of the supplied type. The resulting fluent iterable's iterator does not support {@code remove()}. @since 1.25.0
[ "Returns", "the", "elements", "from", "this", "fluent", "iterable", "that", "are", "instances", "of", "the", "supplied", "type", ".", "The", "resulting", "fluent", "iterable", "s", "iterator", "does", "not", "support", "{" ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/FluentIterableWrapper.java#L87-L90
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.tryRelease
private boolean tryRelease(long c, WorkQueue v, long inc) { """ Signals and releases worker v if it is top of idle worker stack. This performs a one-shot version of signalWork only if there is (apparently) at least one idle worker. @param c incoming ctl value @param v if non-null, a worker @param inc the increment to active count (zero when compensating) @return true if successful """ int sp = (int)c, ns = sp & ~UNSIGNALLED; if (v != null) { int vs = v.scanState; long nc = (v.stackPred & SP_MASK) | (UC_MASK & (c + inc)); if (sp == vs && U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = ns; LockSupport.unpark(v.parker); return true; } } return false; }
java
private boolean tryRelease(long c, WorkQueue v, long inc) { int sp = (int)c, ns = sp & ~UNSIGNALLED; if (v != null) { int vs = v.scanState; long nc = (v.stackPred & SP_MASK) | (UC_MASK & (c + inc)); if (sp == vs && U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = ns; LockSupport.unpark(v.parker); return true; } } return false; }
[ "private", "boolean", "tryRelease", "(", "long", "c", ",", "WorkQueue", "v", ",", "long", "inc", ")", "{", "int", "sp", "=", "(", "int", ")", "c", ",", "ns", "=", "sp", "&", "~", "UNSIGNALLED", ";", "if", "(", "v", "!=", "null", ")", "{", "int", "vs", "=", "v", ".", "scanState", ";", "long", "nc", "=", "(", "v", ".", "stackPred", "&", "SP_MASK", ")", "|", "(", "UC_MASK", "&", "(", "c", "+", "inc", ")", ")", ";", "if", "(", "sp", "==", "vs", "&&", "U", ".", "compareAndSwapLong", "(", "this", ",", "CTL", ",", "c", ",", "nc", ")", ")", "{", "v", ".", "scanState", "=", "ns", ";", "LockSupport", ".", "unpark", "(", "v", ".", "parker", ")", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Signals and releases worker v if it is top of idle worker stack. This performs a one-shot version of signalWork only if there is (apparently) at least one idle worker. @param c incoming ctl value @param v if non-null, a worker @param inc the increment to active count (zero when compensating) @return true if successful
[ "Signals", "and", "releases", "worker", "v", "if", "it", "is", "top", "of", "idle", "worker", "stack", ".", "This", "performs", "a", "one", "-", "shot", "version", "of", "signalWork", "only", "if", "there", "is", "(", "apparently", ")", "at", "least", "one", "idle", "worker", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1729-L1741
line/centraldogma
common/src/main/java/com/linecorp/centraldogma/internal/api/v1/WatchTimeout.java
WatchTimeout.makeReasonable
public static long makeReasonable(long expectedTimeoutMillis, long bufferMillis) { """ Returns a reasonable timeout duration for a watch request. @param expectedTimeoutMillis timeout duration that a user wants to use, in milliseconds @param bufferMillis buffer duration which needs to be added, in milliseconds @return timeout duration in milliseconds, between the specified {@code bufferMillis} and the {@link #MAX_MILLIS}. """ checkArgument(expectedTimeoutMillis > 0, "expectedTimeoutMillis: %s (expected: > 0)", expectedTimeoutMillis); checkArgument(bufferMillis >= 0, "bufferMillis: %s (expected: > 0)", bufferMillis); final long timeout = Math.min(expectedTimeoutMillis, MAX_MILLIS); if (bufferMillis == 0) { return timeout; } if (timeout > MAX_MILLIS - bufferMillis) { return MAX_MILLIS; } else { return bufferMillis + timeout; } }
java
public static long makeReasonable(long expectedTimeoutMillis, long bufferMillis) { checkArgument(expectedTimeoutMillis > 0, "expectedTimeoutMillis: %s (expected: > 0)", expectedTimeoutMillis); checkArgument(bufferMillis >= 0, "bufferMillis: %s (expected: > 0)", bufferMillis); final long timeout = Math.min(expectedTimeoutMillis, MAX_MILLIS); if (bufferMillis == 0) { return timeout; } if (timeout > MAX_MILLIS - bufferMillis) { return MAX_MILLIS; } else { return bufferMillis + timeout; } }
[ "public", "static", "long", "makeReasonable", "(", "long", "expectedTimeoutMillis", ",", "long", "bufferMillis", ")", "{", "checkArgument", "(", "expectedTimeoutMillis", ">", "0", ",", "\"expectedTimeoutMillis: %s (expected: > 0)\"", ",", "expectedTimeoutMillis", ")", ";", "checkArgument", "(", "bufferMillis", ">=", "0", ",", "\"bufferMillis: %s (expected: > 0)\"", ",", "bufferMillis", ")", ";", "final", "long", "timeout", "=", "Math", ".", "min", "(", "expectedTimeoutMillis", ",", "MAX_MILLIS", ")", ";", "if", "(", "bufferMillis", "==", "0", ")", "{", "return", "timeout", ";", "}", "if", "(", "timeout", ">", "MAX_MILLIS", "-", "bufferMillis", ")", "{", "return", "MAX_MILLIS", ";", "}", "else", "{", "return", "bufferMillis", "+", "timeout", ";", "}", "}" ]
Returns a reasonable timeout duration for a watch request. @param expectedTimeoutMillis timeout duration that a user wants to use, in milliseconds @param bufferMillis buffer duration which needs to be added, in milliseconds @return timeout duration in milliseconds, between the specified {@code bufferMillis} and the {@link #MAX_MILLIS}.
[ "Returns", "a", "reasonable", "timeout", "duration", "for", "a", "watch", "request", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/common/src/main/java/com/linecorp/centraldogma/internal/api/v1/WatchTimeout.java#L49-L65
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_PUT
public void organizationName_service_exchangeService_domain_domainName_PUT(String organizationName, String exchangeService, String domainName, OvhDomain body) throws IOException { """ Alter this object properties REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName} @param body [required] New object properties @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param domainName [required] Domain name """ String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}"; StringBuilder sb = path(qPath, organizationName, exchangeService, domainName); exec(qPath, "PUT", sb.toString(), body); }
java
public void organizationName_service_exchangeService_domain_domainName_PUT(String organizationName, String exchangeService, String domainName, OvhDomain body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}"; StringBuilder sb = path(qPath, organizationName, exchangeService, domainName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "organizationName_service_exchangeService_domain_domainName_PUT", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "domainName", ",", "OvhDomain", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "organizationName", ",", "exchangeService", ",", "domainName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName} @param body [required] New object properties @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param domainName [required] Domain name
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L500-L504
Alluxio/alluxio
core/base/src/main/java/alluxio/collections/IndexedSet.java
IndexedSet.contains
public <V> boolean contains(IndexDefinition<T, V> indexDefinition, V value) { """ Whether there is an object with the specified index field value in the set. @param indexDefinition the field index definition @param value the field value @param <V> the field type @return true if there is one such object, otherwise false """ FieldIndex<T, V> index = (FieldIndex<T, V>) mIndices.get(indexDefinition); if (index == null) { throw new IllegalStateException("the given index isn't defined for this IndexedSet"); } return index.containsField(value); }
java
public <V> boolean contains(IndexDefinition<T, V> indexDefinition, V value) { FieldIndex<T, V> index = (FieldIndex<T, V>) mIndices.get(indexDefinition); if (index == null) { throw new IllegalStateException("the given index isn't defined for this IndexedSet"); } return index.containsField(value); }
[ "public", "<", "V", ">", "boolean", "contains", "(", "IndexDefinition", "<", "T", ",", "V", ">", "indexDefinition", ",", "V", "value", ")", "{", "FieldIndex", "<", "T", ",", "V", ">", "index", "=", "(", "FieldIndex", "<", "T", ",", "V", ">", ")", "mIndices", ".", "get", "(", "indexDefinition", ")", ";", "if", "(", "index", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"the given index isn't defined for this IndexedSet\"", ")", ";", "}", "return", "index", ".", "containsField", "(", "value", ")", ";", "}" ]
Whether there is an object with the specified index field value in the set. @param indexDefinition the field index definition @param value the field value @param <V> the field type @return true if there is one such object, otherwise false
[ "Whether", "there", "is", "an", "object", "with", "the", "specified", "index", "field", "value", "in", "the", "set", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/collections/IndexedSet.java#L247-L253
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java
RobustLoaderWriterResilienceStrategy.removeFailure
@Override public void removeFailure(K key, StoreAccessException e) { """ Delete the key from the loader-writer. @param key the key being removed @param e the triggered failure """ try { loaderWriter.delete(key); } catch(Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } finally { cleanup(key, e); } }
java
@Override public void removeFailure(K key, StoreAccessException e) { try { loaderWriter.delete(key); } catch(Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } finally { cleanup(key, e); } }
[ "@", "Override", "public", "void", "removeFailure", "(", "K", "key", ",", "StoreAccessException", "e", ")", "{", "try", "{", "loaderWriter", ".", "delete", "(", "key", ")", ";", "}", "catch", "(", "Exception", "e1", ")", "{", "throw", "ExceptionFactory", ".", "newCacheWritingException", "(", "e1", ",", "e", ")", ";", "}", "finally", "{", "cleanup", "(", "key", ",", "e", ")", ";", "}", "}" ]
Delete the key from the loader-writer. @param key the key being removed @param e the triggered failure
[ "Delete", "the", "key", "from", "the", "loader", "-", "writer", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java#L103-L112
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java
base_resource.resource_to_string
protected String resource_to_string(nitro_service service, options option) { """ Converts MPS resource to Json string. @param service nitro_service object. @param option Options object. @return string in Json format. """ String onerror = service.get_onerror(); return service.get_payload_formatter().resource_to_string(this, option, onerror); }
java
protected String resource_to_string(nitro_service service, options option) { String onerror = service.get_onerror(); return service.get_payload_formatter().resource_to_string(this, option, onerror); }
[ "protected", "String", "resource_to_string", "(", "nitro_service", "service", ",", "options", "option", ")", "{", "String", "onerror", "=", "service", ".", "get_onerror", "(", ")", ";", "return", "service", ".", "get_payload_formatter", "(", ")", ".", "resource_to_string", "(", "this", ",", "option", ",", "onerror", ")", ";", "}" ]
Converts MPS resource to Json string. @param service nitro_service object. @param option Options object. @return string in Json format.
[ "Converts", "MPS", "resource", "to", "Json", "string", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L56-L60
Omertron/api-omdb
src/main/java/com/omertron/omdbapi/model/AbstractJsonMapping.java
AbstractJsonMapping.handleUnknown
@JsonAnySetter protected void handleUnknown(String key, Object value) { """ Handle unknown properties and print a message @param key @param value """ StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName()); unknown.append(": Unknown property='").append(key); unknown.append("' value='").append(value).append("'"); LOG.trace(unknown.toString()); }
java
@JsonAnySetter protected void handleUnknown(String key, Object value) { StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName()); unknown.append(": Unknown property='").append(key); unknown.append("' value='").append(value).append("'"); LOG.trace(unknown.toString()); }
[ "@", "JsonAnySetter", "protected", "void", "handleUnknown", "(", "String", "key", ",", "Object", "value", ")", "{", "StringBuilder", "unknown", "=", "new", "StringBuilder", "(", "this", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "unknown", ".", "append", "(", "\": Unknown property='\"", ")", ".", "append", "(", "key", ")", ";", "unknown", ".", "append", "(", "\"' value='\"", ")", ".", "append", "(", "value", ")", ".", "append", "(", "\"'\"", ")", ";", "LOG", ".", "trace", "(", "unknown", ".", "toString", "(", ")", ")", ";", "}" ]
Handle unknown properties and print a message @param key @param value
[ "Handle", "unknown", "properties", "and", "print", "a", "message" ]
train
https://github.com/Omertron/api-omdb/blob/acb506ded2d7b8a4159b48161ffab8cb5b7bad44/src/main/java/com/omertron/omdbapi/model/AbstractJsonMapping.java#L63-L70
tango-controls/JTango
server/src/main/java/org/tango/server/ServerManager.java
ServerManager.startError
public synchronized void startError(final String[] args, final String execName) throws DevFailed { """ Idem as start but throw exceptions. @see ServerManager#start(String[], String) @param args @param execName @throws DevFailed """ if (isStarted.get()) { throw DevFailedUtils.newDevFailed("this server is already started"); } init(args, execName); }
java
public synchronized void startError(final String[] args, final String execName) throws DevFailed { if (isStarted.get()) { throw DevFailedUtils.newDevFailed("this server is already started"); } init(args, execName); }
[ "public", "synchronized", "void", "startError", "(", "final", "String", "[", "]", "args", ",", "final", "String", "execName", ")", "throws", "DevFailed", "{", "if", "(", "isStarted", ".", "get", "(", ")", ")", "{", "throw", "DevFailedUtils", ".", "newDevFailed", "(", "\"this server is already started\"", ")", ";", "}", "init", "(", "args", ",", "execName", ")", ";", "}" ]
Idem as start but throw exceptions. @see ServerManager#start(String[], String) @param args @param execName @throws DevFailed
[ "Idem", "as", "start", "but", "throw", "exceptions", ".", "@see", "ServerManager#start", "(", "String", "[]", "String", ")" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/ServerManager.java#L196-L201
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.deleteCertificate
public void deleteCertificate(String resourceGroupName, String certificateOrderName, String name) { """ Delete the certificate associated with a certificate order. Delete the certificate associated with a certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param name Name of the certificate. @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 """ deleteCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name).toBlocking().single().body(); }
java
public void deleteCertificate(String resourceGroupName, String certificateOrderName, String name) { deleteCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name).toBlocking().single().body(); }
[ "public", "void", "deleteCertificate", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "String", "name", ")", "{", "deleteCertificateWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Delete the certificate associated with a certificate order. Delete the certificate associated with a certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param name Name of the certificate. @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
[ "Delete", "the", "certificate", "associated", "with", "a", "certificate", "order", ".", "Delete", "the", "certificate", "associated", "with", "a", "certificate", "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#L1381-L1383
apache/incubator-heron
heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java
TopologyBuilder.setBolt
public BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelismHint) { """ Define a new bolt in this topology with the specified amount of parallelism. @param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs. @param bolt the bolt @param parallelismHint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somewhere around the cluster. @return use the returned object to declare the inputs to this component """ validateComponentName(id); BoltDeclarer b = new BoltDeclarer(id, bolt, parallelismHint); bolts.put(id, b); return b; }
java
public BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelismHint) { validateComponentName(id); BoltDeclarer b = new BoltDeclarer(id, bolt, parallelismHint); bolts.put(id, b); return b; }
[ "public", "BoltDeclarer", "setBolt", "(", "String", "id", ",", "IRichBolt", "bolt", ",", "Number", "parallelismHint", ")", "{", "validateComponentName", "(", "id", ")", ";", "BoltDeclarer", "b", "=", "new", "BoltDeclarer", "(", "id", ",", "bolt", ",", "parallelismHint", ")", ";", "bolts", ".", "put", "(", "id", ",", "b", ")", ";", "return", "b", ";", "}" ]
Define a new bolt in this topology with the specified amount of parallelism. @param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs. @param bolt the bolt @param parallelismHint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somewhere around the cluster. @return use the returned object to declare the inputs to this component
[ "Define", "a", "new", "bolt", "in", "this", "topology", "with", "the", "specified", "amount", "of", "parallelism", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java#L128-L133
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java
XcodeProjectWriter.createPBXFileReference
private static PBXObjectRef createPBXFileReference(final String sourceTree, final String baseDir, final File file) { """ Create PBXFileReference. @param sourceTree source tree. @param baseDir base directory. @param file file. @return PBXFileReference object. """ final Map map = new HashMap(); map.put("isa", "PBXFileReference"); final String relPath = CUtil.toUnixPath(CUtil.getRelativePath(baseDir, file)); map.put("path", relPath); map.put("name", file.getName()); map.put("sourceTree", sourceTree); return new PBXObjectRef(map); }
java
private static PBXObjectRef createPBXFileReference(final String sourceTree, final String baseDir, final File file) { final Map map = new HashMap(); map.put("isa", "PBXFileReference"); final String relPath = CUtil.toUnixPath(CUtil.getRelativePath(baseDir, file)); map.put("path", relPath); map.put("name", file.getName()); map.put("sourceTree", sourceTree); return new PBXObjectRef(map); }
[ "private", "static", "PBXObjectRef", "createPBXFileReference", "(", "final", "String", "sourceTree", ",", "final", "String", "baseDir", ",", "final", "File", "file", ")", "{", "final", "Map", "map", "=", "new", "HashMap", "(", ")", ";", "map", ".", "put", "(", "\"isa\"", ",", "\"PBXFileReference\"", ")", ";", "final", "String", "relPath", "=", "CUtil", ".", "toUnixPath", "(", "CUtil", ".", "getRelativePath", "(", "baseDir", ",", "file", ")", ")", ";", "map", ".", "put", "(", "\"path\"", ",", "relPath", ")", ";", "map", ".", "put", "(", "\"name\"", ",", "file", ".", "getName", "(", ")", ")", ";", "map", ".", "put", "(", "\"sourceTree\"", ",", "sourceTree", ")", ";", "return", "new", "PBXObjectRef", "(", "map", ")", ";", "}" ]
Create PBXFileReference. @param sourceTree source tree. @param baseDir base directory. @param file file. @return PBXFileReference object.
[ "Create", "PBXFileReference", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java#L202-L211
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreException.java
FirestoreException.serverRejected
static FirestoreException serverRejected(Status status, String message, Object... params) { """ Creates a FirestoreException with the provided GRPC Status code and message in a nested exception. @return The FirestoreException """ return new FirestoreException(String.format(message, params), status); }
java
static FirestoreException serverRejected(Status status, String message, Object... params) { return new FirestoreException(String.format(message, params), status); }
[ "static", "FirestoreException", "serverRejected", "(", "Status", "status", ",", "String", "message", ",", "Object", "...", "params", ")", "{", "return", "new", "FirestoreException", "(", "String", ".", "format", "(", "message", ",", "params", ")", ",", "status", ")", ";", "}" ]
Creates a FirestoreException with the provided GRPC Status code and message in a nested exception. @return The FirestoreException
[ "Creates", "a", "FirestoreException", "with", "the", "provided", "GRPC", "Status", "code", "and", "message", "in", "a", "nested", "exception", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreException.java#L60-L62
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/HierarchicalUriComponents.java
HierarchicalUriComponents.encodeUriComponent
static String encodeUriComponent(String source, String encoding, Type type) throws UnsupportedEncodingException { """ Encode the given source into an encoded String using the rules specified by the given component and with the given options. @param source the source string @param encoding the encoding of the source string @param type the URI component for the source @return the encoded URI @throws IllegalArgumentException when the given uri parameter is not a valid URI """ if (source == null) { return null; } Misc.checkNotNull(encoding, "Encoding"); Misc.checkArgument(!encoding.isEmpty(), "Encoding must not be empty"); byte[] bytes = encodeBytes(source.getBytes(encoding), type); return new String(bytes, "US-ASCII"); }
java
static String encodeUriComponent(String source, String encoding, Type type) throws UnsupportedEncodingException { if (source == null) { return null; } Misc.checkNotNull(encoding, "Encoding"); Misc.checkArgument(!encoding.isEmpty(), "Encoding must not be empty"); byte[] bytes = encodeBytes(source.getBytes(encoding), type); return new String(bytes, "US-ASCII"); }
[ "static", "String", "encodeUriComponent", "(", "String", "source", ",", "String", "encoding", ",", "Type", "type", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "Misc", ".", "checkNotNull", "(", "encoding", ",", "\"Encoding\"", ")", ";", "Misc", ".", "checkArgument", "(", "!", "encoding", ".", "isEmpty", "(", ")", ",", "\"Encoding must not be empty\"", ")", ";", "byte", "[", "]", "bytes", "=", "encodeBytes", "(", "source", ".", "getBytes", "(", "encoding", ")", ",", "type", ")", ";", "return", "new", "String", "(", "bytes", ",", "\"US-ASCII\"", ")", ";", "}" ]
Encode the given source into an encoded String using the rules specified by the given component and with the given options. @param source the source string @param encoding the encoding of the source string @param type the URI component for the source @return the encoded URI @throws IllegalArgumentException when the given uri parameter is not a valid URI
[ "Encode", "the", "given", "source", "into", "an", "encoded", "String", "using", "the", "rules", "specified", "by", "the", "given", "component", "and", "with", "the", "given", "options", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/HierarchicalUriComponents.java#L42-L52
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.newWriter
public static BufferedWriter newWriter(File file, String charset) throws IOException { """ Creates a buffered writer for this file, writing data without writing a BOM, using a specified encoding. @param file a File @param charset the name of the encoding used to write in this file @return a BufferedWriter @throws IOException if an IOException occurs. @since 1.0 """ return newWriter(file, charset, false); }
java
public static BufferedWriter newWriter(File file, String charset) throws IOException { return newWriter(file, charset, false); }
[ "public", "static", "BufferedWriter", "newWriter", "(", "File", "file", ",", "String", "charset", ")", "throws", "IOException", "{", "return", "newWriter", "(", "file", ",", "charset", ",", "false", ")", ";", "}" ]
Creates a buffered writer for this file, writing data without writing a BOM, using a specified encoding. @param file a File @param charset the name of the encoding used to write in this file @return a BufferedWriter @throws IOException if an IOException occurs. @since 1.0
[ "Creates", "a", "buffered", "writer", "for", "this", "file", "writing", "data", "without", "writing", "a", "BOM", "using", "a", "specified", "encoding", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1972-L1974
micronaut-projects/micronaut-core
http-server-netty/src/main/java/io/micronaut/http/server/netty/jackson/JsonViewMediaTypeCodecFactory.java
JsonViewMediaTypeCodecFactory.resolveJsonViewCodec
@Override public @Nonnull JsonMediaTypeCodec resolveJsonViewCodec(@Nonnull Class<?> viewClass) { """ Creates a {@link JsonMediaTypeCodec} for the view class (specified as the JsonView annotation value). @param viewClass The view class @return The codec """ ArgumentUtils.requireNonNull("viewClass", viewClass); JsonMediaTypeCodec codec = jsonViewCodecs.get(viewClass); if (codec == null) { ObjectMapper viewMapper = objectMapper.copy(); viewMapper.setConfig(viewMapper.getSerializationConfig().withView(viewClass)); codec = new JsonMediaTypeCodec(viewMapper, applicationConfiguration, codecConfiguration); jsonViewCodecs.put(viewClass, codec); } return codec; }
java
@Override public @Nonnull JsonMediaTypeCodec resolveJsonViewCodec(@Nonnull Class<?> viewClass) { ArgumentUtils.requireNonNull("viewClass", viewClass); JsonMediaTypeCodec codec = jsonViewCodecs.get(viewClass); if (codec == null) { ObjectMapper viewMapper = objectMapper.copy(); viewMapper.setConfig(viewMapper.getSerializationConfig().withView(viewClass)); codec = new JsonMediaTypeCodec(viewMapper, applicationConfiguration, codecConfiguration); jsonViewCodecs.put(viewClass, codec); } return codec; }
[ "@", "Override", "public", "@", "Nonnull", "JsonMediaTypeCodec", "resolveJsonViewCodec", "(", "@", "Nonnull", "Class", "<", "?", ">", "viewClass", ")", "{", "ArgumentUtils", ".", "requireNonNull", "(", "\"viewClass\"", ",", "viewClass", ")", ";", "JsonMediaTypeCodec", "codec", "=", "jsonViewCodecs", ".", "get", "(", "viewClass", ")", ";", "if", "(", "codec", "==", "null", ")", "{", "ObjectMapper", "viewMapper", "=", "objectMapper", ".", "copy", "(", ")", ";", "viewMapper", ".", "setConfig", "(", "viewMapper", ".", "getSerializationConfig", "(", ")", ".", "withView", "(", "viewClass", ")", ")", ";", "codec", "=", "new", "JsonMediaTypeCodec", "(", "viewMapper", ",", "applicationConfiguration", ",", "codecConfiguration", ")", ";", "jsonViewCodecs", ".", "put", "(", "viewClass", ",", "codec", ")", ";", "}", "return", "codec", ";", "}" ]
Creates a {@link JsonMediaTypeCodec} for the view class (specified as the JsonView annotation value). @param viewClass The view class @return The codec
[ "Creates", "a", "{" ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-server-netty/src/main/java/io/micronaut/http/server/netty/jackson/JsonViewMediaTypeCodecFactory.java#L76-L88
hal/core
gui/src/main/java/org/jboss/as/console/client/v3/dmr/ResourceDescription.java
ResourceDescription.getChildDescription
public ResourceDescription getChildDescription(String resourceName, String instanceName) { """ Looks for the description of a specific child resource. @param resourceName The name of the child resource @param instanceName The name of the instance @return the description of the specific child resource or {@link #EMPTY} if no such resource exists. """ if (hasChildren()) { List<Property> children = get("children").asPropertyList(); for (Property child : children) { if (resourceName.equals(child.getName()) && child.getValue().hasDefined(MODEL_DESCRIPTION)) { List<Property> modelDescriptions = child.getValue().get(MODEL_DESCRIPTION).asPropertyList(); for (Property modelDescription : modelDescriptions) { if (instanceName.equals(modelDescription.getName())) { return new ResourceDescription(modelDescription.getValue()); } } } } } return EMPTY; }
java
public ResourceDescription getChildDescription(String resourceName, String instanceName) { if (hasChildren()) { List<Property> children = get("children").asPropertyList(); for (Property child : children) { if (resourceName.equals(child.getName()) && child.getValue().hasDefined(MODEL_DESCRIPTION)) { List<Property> modelDescriptions = child.getValue().get(MODEL_DESCRIPTION).asPropertyList(); for (Property modelDescription : modelDescriptions) { if (instanceName.equals(modelDescription.getName())) { return new ResourceDescription(modelDescription.getValue()); } } } } } return EMPTY; }
[ "public", "ResourceDescription", "getChildDescription", "(", "String", "resourceName", ",", "String", "instanceName", ")", "{", "if", "(", "hasChildren", "(", ")", ")", "{", "List", "<", "Property", ">", "children", "=", "get", "(", "\"children\"", ")", ".", "asPropertyList", "(", ")", ";", "for", "(", "Property", "child", ":", "children", ")", "{", "if", "(", "resourceName", ".", "equals", "(", "child", ".", "getName", "(", ")", ")", "&&", "child", ".", "getValue", "(", ")", ".", "hasDefined", "(", "MODEL_DESCRIPTION", ")", ")", "{", "List", "<", "Property", ">", "modelDescriptions", "=", "child", ".", "getValue", "(", ")", ".", "get", "(", "MODEL_DESCRIPTION", ")", ".", "asPropertyList", "(", ")", ";", "for", "(", "Property", "modelDescription", ":", "modelDescriptions", ")", "{", "if", "(", "instanceName", ".", "equals", "(", "modelDescription", ".", "getName", "(", ")", ")", ")", "{", "return", "new", "ResourceDescription", "(", "modelDescription", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "}", "}", "return", "EMPTY", ";", "}" ]
Looks for the description of a specific child resource. @param resourceName The name of the child resource @param instanceName The name of the instance @return the description of the specific child resource or {@link #EMPTY} if no such resource exists.
[ "Looks", "for", "the", "description", "of", "a", "specific", "child", "resource", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/dmr/ResourceDescription.java#L85-L100
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java
TreeUtil.getComponentWithId
public static WComponent getComponentWithId(final WComponent root, final String id) { """ Retrieves the component with the given Id. <p> Searches visible and not visible components. </p> @param root the root component to search from. @param id the id to search for. @return the component with the given id, or null if not found. """ return getComponentWithId(root, id, false); }
java
public static WComponent getComponentWithId(final WComponent root, final String id) { return getComponentWithId(root, id, false); }
[ "public", "static", "WComponent", "getComponentWithId", "(", "final", "WComponent", "root", ",", "final", "String", "id", ")", "{", "return", "getComponentWithId", "(", "root", ",", "id", ",", "false", ")", ";", "}" ]
Retrieves the component with the given Id. <p> Searches visible and not visible components. </p> @param root the root component to search from. @param id the id to search for. @return the component with the given id, or null if not found.
[ "Retrieves", "the", "component", "with", "the", "given", "Id", ".", "<p", ">", "Searches", "visible", "and", "not", "visible", "components", ".", "<", "/", "p", ">" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java#L127-L129
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java
PipelineBuilder.addInstanceOfExpr
public void addInstanceOfExpr(final INodeReadTrx mTransaction, final SequenceType mSequenceType) { """ Adds a instance of expression to the pipeline. @param mTransaction Transaction to operate with. @param mSequenceType sequence type the context item should match. """ assert getPipeStack().size() >= 1; final AbsAxis candidate = getPipeStack().pop().getExpr(); final AbsAxis axis = new InstanceOfExpr(mTransaction, candidate, mSequenceType); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(axis); }
java
public void addInstanceOfExpr(final INodeReadTrx mTransaction, final SequenceType mSequenceType) { assert getPipeStack().size() >= 1; final AbsAxis candidate = getPipeStack().pop().getExpr(); final AbsAxis axis = new InstanceOfExpr(mTransaction, candidate, mSequenceType); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(axis); }
[ "public", "void", "addInstanceOfExpr", "(", "final", "INodeReadTrx", "mTransaction", ",", "final", "SequenceType", "mSequenceType", ")", "{", "assert", "getPipeStack", "(", ")", ".", "size", "(", ")", ">=", "1", ";", "final", "AbsAxis", "candidate", "=", "getPipeStack", "(", ")", ".", "pop", "(", ")", ".", "getExpr", "(", ")", ";", "final", "AbsAxis", "axis", "=", "new", "InstanceOfExpr", "(", "mTransaction", ",", "candidate", ",", "mSequenceType", ")", ";", "if", "(", "getPipeStack", "(", ")", ".", "empty", "(", ")", "||", "getExpression", "(", ")", ".", "getSize", "(", ")", "!=", "0", ")", "{", "addExpressionSingle", "(", ")", ";", "}", "getExpression", "(", ")", ".", "add", "(", "axis", ")", ";", "}" ]
Adds a instance of expression to the pipeline. @param mTransaction Transaction to operate with. @param mSequenceType sequence type the context item should match.
[ "Adds", "a", "instance", "of", "expression", "to", "the", "pipeline", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L668-L680
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.createOrUpdateAsync
public Observable<IotHubDescriptionInner> createOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { """ Create or update the metadata of an IoT hub. Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param iotHubDescription The IoT hub metadata and security metadata. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).map(new Func1<ServiceResponse<IotHubDescriptionInner>, IotHubDescriptionInner>() { @Override public IotHubDescriptionInner call(ServiceResponse<IotHubDescriptionInner> response) { return response.body(); } }); }
java
public Observable<IotHubDescriptionInner> createOrUpdateAsync(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription).map(new Func1<ServiceResponse<IotHubDescriptionInner>, IotHubDescriptionInner>() { @Override public IotHubDescriptionInner call(ServiceResponse<IotHubDescriptionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IotHubDescriptionInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "IotHubDescriptionInner", "iotHubDescription", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "iotHubDescription", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "IotHubDescriptionInner", ">", ",", "IotHubDescriptionInner", ">", "(", ")", "{", "@", "Override", "public", "IotHubDescriptionInner", "call", "(", "ServiceResponse", "<", "IotHubDescriptionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update the metadata of an IoT hub. Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param iotHubDescription The IoT hub metadata and security metadata. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "update", "the", "metadata", "of", "an", "IoT", "hub", ".", "Create", "or", "update", "the", "metadata", "of", "an", "Iot", "hub", ".", "The", "usual", "pattern", "to", "modify", "a", "property", "is", "to", "retrieve", "the", "IoT", "hub", "metadata", "and", "security", "metadata", "and", "then", "combine", "them", "with", "the", "modified", "values", "in", "a", "new", "body", "to", "update", "the", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L347-L354
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Searches.java
Searches.findOne
public static <E> E findOne(E[] array, Predicate<E> predicate) { """ Searches the only matching element returning it. @param <E> the element type parameter @param array the array to be searched @param predicate the predicate to be applied to each element @throws IllegalStateException if more than one element is found @throws IllegalArgumentException if no element matches @return the found element """ final Iterator<E> filtered = Filtering.filter(new ArrayIterator<E>(array), predicate); return new OneElement<E>().apply(filtered); }
java
public static <E> E findOne(E[] array, Predicate<E> predicate) { final Iterator<E> filtered = Filtering.filter(new ArrayIterator<E>(array), predicate); return new OneElement<E>().apply(filtered); }
[ "public", "static", "<", "E", ">", "E", "findOne", "(", "E", "[", "]", "array", ",", "Predicate", "<", "E", ">", "predicate", ")", "{", "final", "Iterator", "<", "E", ">", "filtered", "=", "Filtering", ".", "filter", "(", "new", "ArrayIterator", "<", "E", ">", "(", "array", ")", ",", "predicate", ")", ";", "return", "new", "OneElement", "<", "E", ">", "(", ")", ".", "apply", "(", "filtered", ")", ";", "}" ]
Searches the only matching element returning it. @param <E> the element type parameter @param array the array to be searched @param predicate the predicate to be applied to each element @throws IllegalStateException if more than one element is found @throws IllegalArgumentException if no element matches @return the found element
[ "Searches", "the", "only", "matching", "element", "returning", "it", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L541-L544
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeRegistry.java
NotificationHandlerNodeRegistry.registerEntry
void registerEntry(ListIterator<PathElement> iterator, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { """ Register the entry here (if the registry is the leaf node) or continue to traverse the tree """ if (!iterator.hasNext()) { // leaf node, register the entry here entries.add(entry); return; } PathElement element = iterator.next(); NotificationHandlerNodeSubregistry subregistry = getOrCreateSubregistry(element.getKey()); subregistry.registerEntry(iterator, element.getValue(), entry); }
java
void registerEntry(ListIterator<PathElement> iterator, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { if (!iterator.hasNext()) { // leaf node, register the entry here entries.add(entry); return; } PathElement element = iterator.next(); NotificationHandlerNodeSubregistry subregistry = getOrCreateSubregistry(element.getKey()); subregistry.registerEntry(iterator, element.getValue(), entry); }
[ "void", "registerEntry", "(", "ListIterator", "<", "PathElement", ">", "iterator", ",", "ConcreteNotificationHandlerRegistration", ".", "NotificationHandlerEntry", "entry", ")", "{", "if", "(", "!", "iterator", ".", "hasNext", "(", ")", ")", "{", "// leaf node, register the entry here", "entries", ".", "add", "(", "entry", ")", ";", "return", ";", "}", "PathElement", "element", "=", "iterator", ".", "next", "(", ")", ";", "NotificationHandlerNodeSubregistry", "subregistry", "=", "getOrCreateSubregistry", "(", "element", ".", "getKey", "(", ")", ")", ";", "subregistry", ".", "registerEntry", "(", "iterator", ",", "element", ".", "getValue", "(", ")", ",", "entry", ")", ";", "}" ]
Register the entry here (if the registry is the leaf node) or continue to traverse the tree
[ "Register", "the", "entry", "here", "(", "if", "the", "registry", "is", "the", "leaf", "node", ")", "or", "continue", "to", "traverse", "the", "tree" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeRegistry.java#L71-L80
spockframework/spock
spock-core/src/main/java/spock/util/concurrent/PollingConditions.java
PollingConditions.within
@ConditionBlock public void within(double seconds, Closure<?> conditions) throws InterruptedException { """ Repeatedly evaluates the specified conditions until they are satisfied or the specified timeout (in seconds) has elapsed. @param conditions the conditions to evaluate @throws InterruptedException if evaluation is interrupted """ long timeoutMillis = toMillis(seconds); long start = System.currentTimeMillis(); long lastAttempt = 0; Thread.sleep(toMillis(initialDelay)); long currDelay = toMillis(delay); int attempts = 0; while(true) { try { attempts++; lastAttempt = System.currentTimeMillis(); GroovyRuntimeUtil.invokeClosure(conditions); return; } catch (Throwable e) { long elapsedTime = lastAttempt - start; if (elapsedTime >= timeoutMillis) { String msg = String.format("Condition not satisfied after %1.2f seconds and %d attempts", elapsedTime / 1000d, attempts); throw new SpockTimeoutError(seconds, msg, e); } final long timeout = Math.min(currDelay, start + timeoutMillis - System.currentTimeMillis()); if (timeout > 0) { Thread.sleep(timeout); } currDelay *= factor; } } }
java
@ConditionBlock public void within(double seconds, Closure<?> conditions) throws InterruptedException { long timeoutMillis = toMillis(seconds); long start = System.currentTimeMillis(); long lastAttempt = 0; Thread.sleep(toMillis(initialDelay)); long currDelay = toMillis(delay); int attempts = 0; while(true) { try { attempts++; lastAttempt = System.currentTimeMillis(); GroovyRuntimeUtil.invokeClosure(conditions); return; } catch (Throwable e) { long elapsedTime = lastAttempt - start; if (elapsedTime >= timeoutMillis) { String msg = String.format("Condition not satisfied after %1.2f seconds and %d attempts", elapsedTime / 1000d, attempts); throw new SpockTimeoutError(seconds, msg, e); } final long timeout = Math.min(currDelay, start + timeoutMillis - System.currentTimeMillis()); if (timeout > 0) { Thread.sleep(timeout); } currDelay *= factor; } } }
[ "@", "ConditionBlock", "public", "void", "within", "(", "double", "seconds", ",", "Closure", "<", "?", ">", "conditions", ")", "throws", "InterruptedException", "{", "long", "timeoutMillis", "=", "toMillis", "(", "seconds", ")", ";", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "lastAttempt", "=", "0", ";", "Thread", ".", "sleep", "(", "toMillis", "(", "initialDelay", ")", ")", ";", "long", "currDelay", "=", "toMillis", "(", "delay", ")", ";", "int", "attempts", "=", "0", ";", "while", "(", "true", ")", "{", "try", "{", "attempts", "++", ";", "lastAttempt", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "GroovyRuntimeUtil", ".", "invokeClosure", "(", "conditions", ")", ";", "return", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "long", "elapsedTime", "=", "lastAttempt", "-", "start", ";", "if", "(", "elapsedTime", ">=", "timeoutMillis", ")", "{", "String", "msg", "=", "String", ".", "format", "(", "\"Condition not satisfied after %1.2f seconds and %d attempts\"", ",", "elapsedTime", "/", "1000d", ",", "attempts", ")", ";", "throw", "new", "SpockTimeoutError", "(", "seconds", ",", "msg", ",", "e", ")", ";", "}", "final", "long", "timeout", "=", "Math", ".", "min", "(", "currDelay", ",", "start", "+", "timeoutMillis", "-", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "if", "(", "timeout", ">", "0", ")", "{", "Thread", ".", "sleep", "(", "timeout", ")", ";", "}", "currDelay", "*=", "factor", ";", "}", "}", "}" ]
Repeatedly evaluates the specified conditions until they are satisfied or the specified timeout (in seconds) has elapsed. @param conditions the conditions to evaluate @throws InterruptedException if evaluation is interrupted
[ "Repeatedly", "evaluates", "the", "specified", "conditions", "until", "they", "are", "satisfied", "or", "the", "specified", "timeout", "(", "in", "seconds", ")", "has", "elapsed", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/util/concurrent/PollingConditions.java#L144-L173
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenFullAwt.java
ScreenFullAwt.initFullscreen
private void initFullscreen(Resolution output, int depth) { """ Prepare fullscreen mode. @param output The output resolution @param depth The bit depth color. @throws LionEngineException If unsupported resolution. """ final java.awt.Window window = new java.awt.Window(frame, conf); window.setBackground(Color.BLACK); window.setIgnoreRepaint(true); window.setPreferredSize(new Dimension(output.getWidth(), output.getHeight())); dev.setFullScreenWindow(window); final DisplayMode disp = isSupported(new DisplayMode(output.getWidth(), output.getHeight(), depth, output.getRate())); if (disp == null) { throw new LionEngineException(ScreenFullAwt.ERROR_UNSUPPORTED_FULLSCREEN + formatResolution(output, depth) + getSupportedResolutions()); } if (!dev.isDisplayChangeSupported()) { throw new LionEngineException(ScreenFullAwt.ERROR_SWITCH); } dev.setDisplayMode(disp); window.validate(); ToolsAwt.createBufferStrategy(window, conf); buf = window.getBufferStrategy(); // Set input listeners componentForKeyboard = frame; componentForMouse = window; componentForCursor = window; frame.validate(); }
java
private void initFullscreen(Resolution output, int depth) { final java.awt.Window window = new java.awt.Window(frame, conf); window.setBackground(Color.BLACK); window.setIgnoreRepaint(true); window.setPreferredSize(new Dimension(output.getWidth(), output.getHeight())); dev.setFullScreenWindow(window); final DisplayMode disp = isSupported(new DisplayMode(output.getWidth(), output.getHeight(), depth, output.getRate())); if (disp == null) { throw new LionEngineException(ScreenFullAwt.ERROR_UNSUPPORTED_FULLSCREEN + formatResolution(output, depth) + getSupportedResolutions()); } if (!dev.isDisplayChangeSupported()) { throw new LionEngineException(ScreenFullAwt.ERROR_SWITCH); } dev.setDisplayMode(disp); window.validate(); ToolsAwt.createBufferStrategy(window, conf); buf = window.getBufferStrategy(); // Set input listeners componentForKeyboard = frame; componentForMouse = window; componentForCursor = window; frame.validate(); }
[ "private", "void", "initFullscreen", "(", "Resolution", "output", ",", "int", "depth", ")", "{", "final", "java", ".", "awt", ".", "Window", "window", "=", "new", "java", ".", "awt", ".", "Window", "(", "frame", ",", "conf", ")", ";", "window", ".", "setBackground", "(", "Color", ".", "BLACK", ")", ";", "window", ".", "setIgnoreRepaint", "(", "true", ")", ";", "window", ".", "setPreferredSize", "(", "new", "Dimension", "(", "output", ".", "getWidth", "(", ")", ",", "output", ".", "getHeight", "(", ")", ")", ")", ";", "dev", ".", "setFullScreenWindow", "(", "window", ")", ";", "final", "DisplayMode", "disp", "=", "isSupported", "(", "new", "DisplayMode", "(", "output", ".", "getWidth", "(", ")", ",", "output", ".", "getHeight", "(", ")", ",", "depth", ",", "output", ".", "getRate", "(", ")", ")", ")", ";", "if", "(", "disp", "==", "null", ")", "{", "throw", "new", "LionEngineException", "(", "ScreenFullAwt", ".", "ERROR_UNSUPPORTED_FULLSCREEN", "+", "formatResolution", "(", "output", ",", "depth", ")", "+", "getSupportedResolutions", "(", ")", ")", ";", "}", "if", "(", "!", "dev", ".", "isDisplayChangeSupported", "(", ")", ")", "{", "throw", "new", "LionEngineException", "(", "ScreenFullAwt", ".", "ERROR_SWITCH", ")", ";", "}", "dev", ".", "setDisplayMode", "(", "disp", ")", ";", "window", ".", "validate", "(", ")", ";", "ToolsAwt", ".", "createBufferStrategy", "(", "window", ",", "conf", ")", ";", "buf", "=", "window", ".", "getBufferStrategy", "(", ")", ";", "// Set input listeners", "componentForKeyboard", "=", "frame", ";", "componentForMouse", "=", "window", ";", "componentForCursor", "=", "window", ";", "frame", ".", "validate", "(", ")", ";", "}" ]
Prepare fullscreen mode. @param output The output resolution @param depth The bit depth color. @throws LionEngineException If unsupported resolution.
[ "Prepare", "fullscreen", "mode", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ScreenFullAwt.java#L88-L121
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.developmentDefault
public static ThrottledApiHandler developmentDefault(Shard shard, String token) { """ Returns a throttled api handler with the current development request limits, which is 10 requests per 10 seconds and 500 requests per 10 minutes @param shard The target server @param token The api key @return The api handler """ return new ThrottledApiHandler(shard, token, new Limit(10, 10, TimeUnit.SECONDS), new Limit(500, 10, TimeUnit.MINUTES)); }
java
public static ThrottledApiHandler developmentDefault(Shard shard, String token) { return new ThrottledApiHandler(shard, token, new Limit(10, 10, TimeUnit.SECONDS), new Limit(500, 10, TimeUnit.MINUTES)); }
[ "public", "static", "ThrottledApiHandler", "developmentDefault", "(", "Shard", "shard", ",", "String", "token", ")", "{", "return", "new", "ThrottledApiHandler", "(", "shard", ",", "token", ",", "new", "Limit", "(", "10", ",", "10", ",", "TimeUnit", ".", "SECONDS", ")", ",", "new", "Limit", "(", "500", ",", "10", ",", "TimeUnit", ".", "MINUTES", ")", ")", ";", "}" ]
Returns a throttled api handler with the current development request limits, which is 10 requests per 10 seconds and 500 requests per 10 minutes @param shard The target server @param token The api key @return The api handler
[ "Returns", "a", "throttled", "api", "handler", "with", "the", "current", "development", "request", "limits", "which", "is", "10", "requests", "per", "10", "seconds", "and", "500", "requests", "per", "10", "minutes" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1379-L1383
vRallev/ECC-25519
ECC-25519-Java/src/main/java/djb/Curve25519.java
Curve25519.keygen
public static final void keygen(byte[] P, byte[] s, byte[] k) { """ /* Key-pair generation P [out] your public key s [out] your private key for signing k [out] your private key for key agreement k [in] 32 random bytes s may be NULL if you don't care WARNING: if s is not NULL, this function has data-dependent timing """ clamp(k); core(P, s, k, null); }
java
public static final void keygen(byte[] P, byte[] s, byte[] k) { clamp(k); core(P, s, k, null); }
[ "public", "static", "final", "void", "keygen", "(", "byte", "[", "]", "P", ",", "byte", "[", "]", "s", ",", "byte", "[", "]", "k", ")", "{", "clamp", "(", "k", ")", ";", "core", "(", "P", ",", "s", ",", "k", ",", "null", ")", ";", "}" ]
/* Key-pair generation P [out] your public key s [out] your private key for signing k [out] your private key for key agreement k [in] 32 random bytes s may be NULL if you don't care WARNING: if s is not NULL, this function has data-dependent timing
[ "/", "*", "Key", "-", "pair", "generation", "P", "[", "out", "]", "your", "public", "key", "s", "[", "out", "]", "your", "private", "key", "for", "signing", "k", "[", "out", "]", "your", "private", "key", "for", "key", "agreement", "k", "[", "in", "]", "32", "random", "bytes", "s", "may", "be", "NULL", "if", "you", "don", "t", "care" ]
train
https://github.com/vRallev/ECC-25519/blob/5c4297933aabfa4fbe7675e36d6d923ffd22e2cb/ECC-25519-Java/src/main/java/djb/Curve25519.java#L67-L70
sangupta/jerry-web
src/main/java/com/sangupta/jerry/web/filters/LeverageBrowserCacheFilter.java
LeverageBrowserCacheFilter.doFilter
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { """ Execute the filter by appending the <b>Expires</b> and <b>Cache-Control</b> response headers. @param servletRequest the incoming {@link ServletRequest} instance @param servletResponse the outgoing {@link ServletResponse} instance @param filterChain the {@link FilterChain} being executed @throws IOException if something fails @throws ServletException if something fails @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) """ HttpServletRequest request = (HttpServletRequest) servletRequest; String uri = request.getRequestURI(); // check if this is a servletRequest to a static resource, like images/css/js // if yes, add the servletResponse header boolean staticResource = isStaticResource(uri); filterChain.doFilter(servletRequest, servletResponse); // if static resources if(staticResource) { LOGGER.debug("Marking URI: {} as a static resource", uri); HttpServletResponse response = (HttpServletResponse) servletResponse; response.addDateHeader("Expires", System.currentTimeMillis() + DateUtils.ONE_YEAR); response.addHeader("Cache-Control", "public, max-age=" + ONE_YEAR_AS_SECONDS); // turn the line below to check if a resource was cached due to this filter // response.addHeader("X-Filter", "LeverageBrowserCache"); } }
java
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; String uri = request.getRequestURI(); // check if this is a servletRequest to a static resource, like images/css/js // if yes, add the servletResponse header boolean staticResource = isStaticResource(uri); filterChain.doFilter(servletRequest, servletResponse); // if static resources if(staticResource) { LOGGER.debug("Marking URI: {} as a static resource", uri); HttpServletResponse response = (HttpServletResponse) servletResponse; response.addDateHeader("Expires", System.currentTimeMillis() + DateUtils.ONE_YEAR); response.addHeader("Cache-Control", "public, max-age=" + ONE_YEAR_AS_SECONDS); // turn the line below to check if a resource was cached due to this filter // response.addHeader("X-Filter", "LeverageBrowserCache"); } }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "servletRequest", ",", "ServletResponse", "servletResponse", ",", "FilterChain", "filterChain", ")", "throws", "IOException", ",", "ServletException", "{", "HttpServletRequest", "request", "=", "(", "HttpServletRequest", ")", "servletRequest", ";", "String", "uri", "=", "request", ".", "getRequestURI", "(", ")", ";", "// check if this is a servletRequest to a static resource, like images/css/js", "// if yes, add the servletResponse header", "boolean", "staticResource", "=", "isStaticResource", "(", "uri", ")", ";", "filterChain", ".", "doFilter", "(", "servletRequest", ",", "servletResponse", ")", ";", "// if static resources", "if", "(", "staticResource", ")", "{", "LOGGER", ".", "debug", "(", "\"Marking URI: {} as a static resource\"", ",", "uri", ")", ";", "HttpServletResponse", "response", "=", "(", "HttpServletResponse", ")", "servletResponse", ";", "response", ".", "addDateHeader", "(", "\"Expires\"", ",", "System", ".", "currentTimeMillis", "(", ")", "+", "DateUtils", ".", "ONE_YEAR", ")", ";", "response", ".", "addHeader", "(", "\"Cache-Control\"", ",", "\"public, max-age=\"", "+", "ONE_YEAR_AS_SECONDS", ")", ";", "// turn the line below to check if a resource was cached due to this filter", "// response.addHeader(\"X-Filter\", \"LeverageBrowserCache\");", "}", "}" ]
Execute the filter by appending the <b>Expires</b> and <b>Cache-Control</b> response headers. @param servletRequest the incoming {@link ServletRequest} instance @param servletResponse the outgoing {@link ServletResponse} instance @param filterChain the {@link FilterChain} being executed @throws IOException if something fails @throws ServletException if something fails @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
[ "Execute", "the", "filter", "by", "appending", "the", "<b", ">", "Expires<", "/", "b", ">", "and", "<b", ">", "Cache", "-", "Control<", "/", "b", ">", "response", "headers", "." ]
train
https://github.com/sangupta/jerry-web/blob/f0d02a5d6e7d1c15292509ce588caf52a4ddb895/src/main/java/com/sangupta/jerry/web/filters/LeverageBrowserCacheFilter.java#L126-L148
liyiorg/weixin-popular
src/main/java/weixin/popular/api/DataCubeAPI.java
DataCubeAPI.getCardBizuinInfo
public static BizuinInfoResult getCardBizuinInfo(String access_token, BizuinInfo bizuinCube) { """ 拉取卡券概况数据<br> 1. 查询时间区间需&lt;=62天,否则报错; <br> 2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;<br> 3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br> @param access_token access_token @param bizuinCube bizuinCube @return result """ return getCardBizuinInfo(access_token, JsonUtil.toJSONString(bizuinCube)); }
java
public static BizuinInfoResult getCardBizuinInfo(String access_token, BizuinInfo bizuinCube) { return getCardBizuinInfo(access_token, JsonUtil.toJSONString(bizuinCube)); }
[ "public", "static", "BizuinInfoResult", "getCardBizuinInfo", "(", "String", "access_token", ",", "BizuinInfo", "bizuinCube", ")", "{", "return", "getCardBizuinInfo", "(", "access_token", ",", "JsonUtil", ".", "toJSONString", "(", "bizuinCube", ")", ")", ";", "}" ]
拉取卡券概况数据<br> 1. 查询时间区间需&lt;=62天,否则报错; <br> 2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;<br> 3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br> @param access_token access_token @param bizuinCube bizuinCube @return result
[ "拉取卡券概况数据<br", ">", "1", ".", "查询时间区间需&lt", ";", "=", "62天,否则报错", ";", "<br", ">", "2", ".", "传入时间格式需严格参照示例填写如”2015", "-", "06", "-", "15”,否则报错;<br", ">", "3", ".", "该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br", ">" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/DataCubeAPI.java#L47-L49
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/base/CliClassContainer.java
CliClassContainer.addMode
private void addMode(CliMode mode, Class<?> annotatedClass) { """ This method adds the given {@link CliMode}. @param mode is the {@link CliMode} to add. @param annotatedClass is the Class where the {@link CliMode} was annotated. """ CliModeContainer container = new CliModeContainer(mode, annotatedClass); addMode(container); }
java
private void addMode(CliMode mode, Class<?> annotatedClass) { CliModeContainer container = new CliModeContainer(mode, annotatedClass); addMode(container); }
[ "private", "void", "addMode", "(", "CliMode", "mode", ",", "Class", "<", "?", ">", "annotatedClass", ")", "{", "CliModeContainer", "container", "=", "new", "CliModeContainer", "(", "mode", ",", "annotatedClass", ")", ";", "addMode", "(", "container", ")", ";", "}" ]
This method adds the given {@link CliMode}. @param mode is the {@link CliMode} to add. @param annotatedClass is the Class where the {@link CliMode} was annotated.
[ "This", "method", "adds", "the", "given", "{", "@link", "CliMode", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliClassContainer.java#L158-L162
h2oai/h2o-3
h2o-core/src/main/java/jsr166y/CountedCompleter.java
CountedCompleter.__tryComplete
public final void __tryComplete(CountedCompleter caller) { """ H2O Hack to get distributed FJ behavior closer to the behavior on local node. It allows us to continue in "completion propagation" interrupted by remote task. Should *not* be called by anyone outside of RPC mechanism. In standard FJ, tryComplete is always called by the task itself and the task is thus it's own caller. Afterwards, the FJ framework will start propagating the completion up the task tree, walking up the list of completers(parents) each time calling onCompletion of the parent with the current node (the child which triggered the completion) being passed as the "caller" argument. When there is a distributed task in the chain, the sequence is broken as the task is completed on a remote node. We want to be able to continue the completion chain, i.e. the remote task should now call onCompletion of its parent with itself passed as the caller argument. We can not call tryComplete on the task, since it has already been called on the remote. Instead, we explicitly set the caller argument in this overloaded tryComplete calls Example: new RPC(node,task).addCompletor(f(x) {...}) When we receive the reponse, we want to pass task as x to f. We call f.__tryComplete(task) @param caller - The child task completing this """ CountedCompleter a = this, s = caller; for (int c;;) { if((c = a.pending) == 0) { a.onCompletion(s); if ((a = (s = a).completer) == null) { s.quietlyComplete(); return; } } else if (U.compareAndSwapInt(a, PENDING, c, c - 1)) return; } }
java
public final void __tryComplete(CountedCompleter caller) { CountedCompleter a = this, s = caller; for (int c;;) { if((c = a.pending) == 0) { a.onCompletion(s); if ((a = (s = a).completer) == null) { s.quietlyComplete(); return; } } else if (U.compareAndSwapInt(a, PENDING, c, c - 1)) return; } }
[ "public", "final", "void", "__tryComplete", "(", "CountedCompleter", "caller", ")", "{", "CountedCompleter", "a", "=", "this", ",", "s", "=", "caller", ";", "for", "(", "int", "c", ";", ";", ")", "{", "if", "(", "(", "c", "=", "a", ".", "pending", ")", "==", "0", ")", "{", "a", ".", "onCompletion", "(", "s", ")", ";", "if", "(", "(", "a", "=", "(", "s", "=", "a", ")", ".", "completer", ")", "==", "null", ")", "{", "s", ".", "quietlyComplete", "(", ")", ";", "return", ";", "}", "}", "else", "if", "(", "U", ".", "compareAndSwapInt", "(", "a", ",", "PENDING", ",", "c", ",", "c", "-", "1", ")", ")", "return", ";", "}", "}" ]
H2O Hack to get distributed FJ behavior closer to the behavior on local node. It allows us to continue in "completion propagation" interrupted by remote task. Should *not* be called by anyone outside of RPC mechanism. In standard FJ, tryComplete is always called by the task itself and the task is thus it's own caller. Afterwards, the FJ framework will start propagating the completion up the task tree, walking up the list of completers(parents) each time calling onCompletion of the parent with the current node (the child which triggered the completion) being passed as the "caller" argument. When there is a distributed task in the chain, the sequence is broken as the task is completed on a remote node. We want to be able to continue the completion chain, i.e. the remote task should now call onCompletion of its parent with itself passed as the caller argument. We can not call tryComplete on the task, since it has already been called on the remote. Instead, we explicitly set the caller argument in this overloaded tryComplete calls Example: new RPC(node,task).addCompletor(f(x) {...}) When we receive the reponse, we want to pass task as x to f. We call f.__tryComplete(task) @param caller - The child task completing this
[ "H2O", "Hack", "to", "get", "distributed", "FJ", "behavior", "closer", "to", "the", "behavior", "on", "local", "node", ".", "It", "allows", "us", "to", "continue", "in", "completion", "propagation", "interrupted", "by", "remote", "task", ".", "Should", "*", "not", "*", "be", "called", "by", "anyone", "outside", "of", "RPC", "mechanism", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/CountedCompleter.java#L421-L434
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java
RaftNodeImpl.invalidateFuturesFrom
public void invalidateFuturesFrom(long entryIndex) { """ Invalidates futures registered with indexes {@code >= entryIndex}. Note that {@code entryIndex} is inclusive. {@link LeaderDemotedException} is set a result to futures. """ int count = 0; Iterator<Entry<Long, SimpleCompletableFuture>> iterator = futures.entrySet().iterator(); while (iterator.hasNext()) { Entry<Long, SimpleCompletableFuture> entry = iterator.next(); long index = entry.getKey(); if (index >= entryIndex) { entry.getValue().setResult(new LeaderDemotedException(localMember, state.leader())); iterator.remove(); count++; } } if (count > 0) { logger.warning("Invalidated " + count + " futures from log index: " + entryIndex); } }
java
public void invalidateFuturesFrom(long entryIndex) { int count = 0; Iterator<Entry<Long, SimpleCompletableFuture>> iterator = futures.entrySet().iterator(); while (iterator.hasNext()) { Entry<Long, SimpleCompletableFuture> entry = iterator.next(); long index = entry.getKey(); if (index >= entryIndex) { entry.getValue().setResult(new LeaderDemotedException(localMember, state.leader())); iterator.remove(); count++; } } if (count > 0) { logger.warning("Invalidated " + count + " futures from log index: " + entryIndex); } }
[ "public", "void", "invalidateFuturesFrom", "(", "long", "entryIndex", ")", "{", "int", "count", "=", "0", ";", "Iterator", "<", "Entry", "<", "Long", ",", "SimpleCompletableFuture", ">", ">", "iterator", "=", "futures", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Entry", "<", "Long", ",", "SimpleCompletableFuture", ">", "entry", "=", "iterator", ".", "next", "(", ")", ";", "long", "index", "=", "entry", ".", "getKey", "(", ")", ";", "if", "(", "index", ">=", "entryIndex", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setResult", "(", "new", "LeaderDemotedException", "(", "localMember", ",", "state", ".", "leader", "(", ")", ")", ")", ";", "iterator", ".", "remove", "(", ")", ";", "count", "++", ";", "}", "}", "if", "(", "count", ">", "0", ")", "{", "logger", ".", "warning", "(", "\"Invalidated \"", "+", "count", "+", "\" futures from log index: \"", "+", "entryIndex", ")", ";", "}", "}" ]
Invalidates futures registered with indexes {@code >= entryIndex}. Note that {@code entryIndex} is inclusive. {@link LeaderDemotedException} is set a result to futures.
[ "Invalidates", "futures", "registered", "with", "indexes", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/RaftNodeImpl.java#L685-L701
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.initializeTimeout
@SuppressWarnings( { """ Parse a timeout value set using adb shell. There are two options to set the timeout. Set it using adb shell (requires root access): <br><br> 'adb shell setprop solo_large_timeout milliseconds' <br> 'adb shell setprop solo_small_timeout milliseconds' <br> Example: adb shell setprop solo_small_timeout 10000 <br><br> Set the values directly using setLargeTimeout() and setSmallTimeout @param property name of the property to read the timeout from @param defaultValue default value for the timeout @return timeout in milliseconds """ "rawtypes", "unchecked" }) private static int initializeTimeout(String property, int defaultValue) { try { Class clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String value = (String) method.invoke(null, property); return Integer.parseInt(value); } catch (Exception e) { return defaultValue; } }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) private static int initializeTimeout(String property, int defaultValue) { try { Class clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String value = (String) method.invoke(null, property); return Integer.parseInt(value); } catch (Exception e) { return defaultValue; } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "static", "int", "initializeTimeout", "(", "String", "property", ",", "int", "defaultValue", ")", "{", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "\"android.os.SystemProperties\"", ")", ";", "Method", "method", "=", "clazz", ".", "getDeclaredMethod", "(", "\"get\"", ",", "String", ".", "class", ")", ";", "String", "value", "=", "(", "String", ")", "method", ".", "invoke", "(", "null", ",", "property", ")", ";", "return", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Parse a timeout value set using adb shell. There are two options to set the timeout. Set it using adb shell (requires root access): <br><br> 'adb shell setprop solo_large_timeout milliseconds' <br> 'adb shell setprop solo_small_timeout milliseconds' <br> Example: adb shell setprop solo_small_timeout 10000 <br><br> Set the values directly using setLargeTimeout() and setSmallTimeout @param property name of the property to read the timeout from @param defaultValue default value for the timeout @return timeout in milliseconds
[ "Parse", "a", "timeout", "value", "set", "using", "adb", "shell", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3989-L4000
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.importKey
public KeyBundle importKey(String vaultBaseUrl, String keyName, JsonWebKey key) { """ Imports an externally created key, stores it, and returns key parameters and attributes to the client. The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName Name for the imported key. @param key The Json web key @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful. """ return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key).toBlocking().single().body(); }
java
public KeyBundle importKey(String vaultBaseUrl, String keyName, JsonWebKey key) { return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key).toBlocking().single().body(); }
[ "public", "KeyBundle", "importKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "JsonWebKey", "key", ")", "{", "return", "importKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "key", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Imports an externally created key, stores it, and returns key parameters and attributes to the client. The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName Name for the imported key. @param key The Json web key @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful.
[ "Imports", "an", "externally", "created", "key", "stores", "it", "and", "returns", "key", "parameters", "and", "attributes", "to", "the", "client", ".", "The", "import", "key", "operation", "may", "be", "used", "to", "import", "any", "key", "type", "into", "an", "Azure", "Key", "Vault", ".", "If", "the", "named", "key", "already", "exists", "Azure", "Key", "Vault", "creates", "a", "new", "version", "of", "the", "key", ".", "This", "operation", "requires", "the", "keys", "/", "import", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L876-L878
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.appendElement
public Element appendElement(String tagName) { """ Create a new element by tag name, and add it as the last child. @param tagName the name of the tag (e.g. {@code div}). @return the new element, to allow you to add content to it, e.g.: {@code parent.appendElement("h1").attr("id", "header").text("Welcome");} """ Element child = new Element(Tag.valueOf(tagName, NodeUtils.parser(this).settings()), baseUri()); appendChild(child); return child; }
java
public Element appendElement(String tagName) { Element child = new Element(Tag.valueOf(tagName, NodeUtils.parser(this).settings()), baseUri()); appendChild(child); return child; }
[ "public", "Element", "appendElement", "(", "String", "tagName", ")", "{", "Element", "child", "=", "new", "Element", "(", "Tag", ".", "valueOf", "(", "tagName", ",", "NodeUtils", ".", "parser", "(", "this", ")", ".", "settings", "(", ")", ")", ",", "baseUri", "(", ")", ")", ";", "appendChild", "(", "child", ")", ";", "return", "child", ";", "}" ]
Create a new element by tag name, and add it as the last child. @param tagName the name of the tag (e.g. {@code div}). @return the new element, to allow you to add content to it, e.g.: {@code parent.appendElement("h1").attr("id", "header").text("Welcome");}
[ "Create", "a", "new", "element", "by", "tag", "name", "and", "add", "it", "as", "the", "last", "child", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L494-L498
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java
ActivationCodeGen.writeMef
private void writeMef(Definition def, Writer out, int indent) throws IOException { """ Output message endpoint factory method @param def definition @param out Writer @param indent space number @throws IOException ioException """ writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get message endpoint factory\n"); writeWithIndent(out, indent, " * @return Message endpoint factory\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public MessageEndpointFactory getMessageEndpointFactory()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return endpointFactory;"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeMef(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get message endpoint factory\n"); writeWithIndent(out, indent, " * @return Message endpoint factory\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public MessageEndpointFactory getMessageEndpointFactory()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return endpointFactory;"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeMef", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * Get message endpoint factory\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @return Message endpoint factory\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"public MessageEndpointFactory getMessageEndpointFactory()\"", ")", ";", "writeLeftCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeWithIndent", "(", "out", ",", "indent", "+", "1", ",", "\"return endpointFactory;\"", ")", ";", "writeRightCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeEol", "(", "out", ")", ";", "}" ]
Output message endpoint factory method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "message", "endpoint", "factory", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java#L159-L172
samskivert/samskivert
src/main/java/com/samskivert/servlet/user/UserRepository.java
UserRepository.refreshSession
public boolean refreshSession (String sessionKey, int expireDays) throws PersistenceException { """ Validates that the supplied session key is still valid and if so, refreshes it for the specified number of days. @return true if the session was located and refreshed, false if it no longer exists. """ Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, expireDays); Date expires = new Date(cal.getTime().getTime()); // attempt to update an existing session row, returning true if we found and updated it return (update("update sessions set expires = '" + expires + "' " + "where authcode = " + JDBCUtil.escape(sessionKey)) == 1); }
java
public boolean refreshSession (String sessionKey, int expireDays) throws PersistenceException { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, expireDays); Date expires = new Date(cal.getTime().getTime()); // attempt to update an existing session row, returning true if we found and updated it return (update("update sessions set expires = '" + expires + "' " + "where authcode = " + JDBCUtil.escape(sessionKey)) == 1); }
[ "public", "boolean", "refreshSession", "(", "String", "sessionKey", ",", "int", "expireDays", ")", "throws", "PersistenceException", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "DATE", ",", "expireDays", ")", ";", "Date", "expires", "=", "new", "Date", "(", "cal", ".", "getTime", "(", ")", ".", "getTime", "(", ")", ")", ";", "// attempt to update an existing session row, returning true if we found and updated it", "return", "(", "update", "(", "\"update sessions set expires = '\"", "+", "expires", "+", "\"' \"", "+", "\"where authcode = \"", "+", "JDBCUtil", ".", "escape", "(", "sessionKey", ")", ")", "==", "1", ")", ";", "}" ]
Validates that the supplied session key is still valid and if so, refreshes it for the specified number of days. @return true if the session was located and refreshed, false if it no longer exists.
[ "Validates", "that", "the", "supplied", "session", "key", "is", "still", "valid", "and", "if", "so", "refreshes", "it", "for", "the", "specified", "number", "of", "days", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/user/UserRepository.java#L297-L307
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.replaceModuleFromDefault
public void replaceModuleFromDefault(String moduleName, String importFile) throws Exception { """ Replaces a module with another revision.<p> @param moduleName the name of the module to delete @param importFile the name of the import file @throws Exception if something goes wrong """ if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModuleFromDefault(importFile); }
java
public void replaceModuleFromDefault(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModuleFromDefault(importFile); }
[ "public", "void", "replaceModuleFromDefault", "(", "String", "moduleName", ",", "String", "importFile", ")", "throws", "Exception", "{", "if", "(", "OpenCms", ".", "getModuleManager", "(", ")", ".", "getModule", "(", "moduleName", ")", "!=", "null", ")", "{", "OpenCms", ".", "getModuleManager", "(", ")", ".", "deleteModule", "(", "m_cms", ",", "moduleName", ",", "true", ",", "new", "CmsShellReport", "(", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ")", ";", "}", "importModuleFromDefault", "(", "importFile", ")", ";", "}" ]
Replaces a module with another revision.<p> @param moduleName the name of the module to delete @param importFile the name of the import file @throws Exception if something goes wrong
[ "Replaces", "a", "module", "with", "another", "revision", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1449-L1460
apache/groovy
src/main/java/org/codehaus/groovy/classgen/ExtendedVerifier.java
ExtendedVerifier.visitAnnotation
private AnnotationNode visitAnnotation(AnnotationNode unvisited) { """ Resolve metadata and details of the annotation. @param unvisited the node to visit @return the visited node """ ErrorCollector errorCollector = new ErrorCollector(this.source.getConfiguration()); AnnotationVisitor visitor = new AnnotationVisitor(this.source, errorCollector); AnnotationNode visited = visitor.visit(unvisited); this.source.getErrorCollector().addCollectorContents(errorCollector); return visited; }
java
private AnnotationNode visitAnnotation(AnnotationNode unvisited) { ErrorCollector errorCollector = new ErrorCollector(this.source.getConfiguration()); AnnotationVisitor visitor = new AnnotationVisitor(this.source, errorCollector); AnnotationNode visited = visitor.visit(unvisited); this.source.getErrorCollector().addCollectorContents(errorCollector); return visited; }
[ "private", "AnnotationNode", "visitAnnotation", "(", "AnnotationNode", "unvisited", ")", "{", "ErrorCollector", "errorCollector", "=", "new", "ErrorCollector", "(", "this", ".", "source", ".", "getConfiguration", "(", ")", ")", ";", "AnnotationVisitor", "visitor", "=", "new", "AnnotationVisitor", "(", "this", ".", "source", ",", "errorCollector", ")", ";", "AnnotationNode", "visited", "=", "visitor", ".", "visit", "(", "unvisited", ")", ";", "this", ".", "source", ".", "getErrorCollector", "(", ")", ".", "addCollectorContents", "(", "errorCollector", ")", ";", "return", "visited", ";", "}" ]
Resolve metadata and details of the annotation. @param unvisited the node to visit @return the visited node
[ "Resolve", "metadata", "and", "details", "of", "the", "annotation", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/ExtendedVerifier.java#L323-L329
Nexmo/nexmo-java
src/main/java/com/nexmo/client/auth/AuthCollection.java
AuthCollection.getAuth
public <T extends AuthMethod> T getAuth(Class<T> type) throws NexmoUnacceptableAuthException { """ Obtain an AuthMethod of type T, if one is contained in this collection. @param type The type of AuthMethod to be located @param <T> The type of AuthMethod which will be returned @return An AuthMethod subclass matching type @throws NexmoUnacceptableAuthException if no matching AuthMethod is found. """ for (AuthMethod availableAuthMethod : this.authList) { if (type.isInstance(availableAuthMethod)) { return (T) availableAuthMethod; } } throw new NexmoUnacceptableAuthException(this.authList, new HashSet<>(Arrays.asList(new Class[]{type}))); }
java
public <T extends AuthMethod> T getAuth(Class<T> type) throws NexmoUnacceptableAuthException { for (AuthMethod availableAuthMethod : this.authList) { if (type.isInstance(availableAuthMethod)) { return (T) availableAuthMethod; } } throw new NexmoUnacceptableAuthException(this.authList, new HashSet<>(Arrays.asList(new Class[]{type}))); }
[ "public", "<", "T", "extends", "AuthMethod", ">", "T", "getAuth", "(", "Class", "<", "T", ">", "type", ")", "throws", "NexmoUnacceptableAuthException", "{", "for", "(", "AuthMethod", "availableAuthMethod", ":", "this", ".", "authList", ")", "{", "if", "(", "type", ".", "isInstance", "(", "availableAuthMethod", ")", ")", "{", "return", "(", "T", ")", "availableAuthMethod", ";", "}", "}", "throw", "new", "NexmoUnacceptableAuthException", "(", "this", ".", "authList", ",", "new", "HashSet", "<>", "(", "Arrays", ".", "asList", "(", "new", "Class", "[", "]", "{", "type", "}", ")", ")", ")", ";", "}" ]
Obtain an AuthMethod of type T, if one is contained in this collection. @param type The type of AuthMethod to be located @param <T> The type of AuthMethod which will be returned @return An AuthMethod subclass matching type @throws NexmoUnacceptableAuthException if no matching AuthMethod is found.
[ "Obtain", "an", "AuthMethod", "of", "type", "T", "if", "one", "is", "contained", "in", "this", "collection", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/auth/AuthCollection.java#L72-L79
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.sendMessage
private void sendMessage(BeanMessageID type, Buffer payload) { """ Send a message to Bean with a payload. @param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} for the message @param payload The message payload to send """ Buffer buffer = new Buffer(); buffer.writeByte((type.getRawValue() >> 8) & 0xff); buffer.writeByte(type.getRawValue() & 0xff); if (payload != null) { try { buffer.writeAll(payload); } catch (IOException e) { throw new RuntimeException(e); } } GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray()); gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer()); }
java
private void sendMessage(BeanMessageID type, Buffer payload) { Buffer buffer = new Buffer(); buffer.writeByte((type.getRawValue() >> 8) & 0xff); buffer.writeByte(type.getRawValue() & 0xff); if (payload != null) { try { buffer.writeAll(payload); } catch (IOException e) { throw new RuntimeException(e); } } GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray()); gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer()); }
[ "private", "void", "sendMessage", "(", "BeanMessageID", "type", ",", "Buffer", "payload", ")", "{", "Buffer", "buffer", "=", "new", "Buffer", "(", ")", ";", "buffer", ".", "writeByte", "(", "(", "type", ".", "getRawValue", "(", ")", ">>", "8", ")", "&", "0xff", ")", ";", "buffer", ".", "writeByte", "(", "type", ".", "getRawValue", "(", ")", "&", "0xff", ")", ";", "if", "(", "payload", "!=", "null", ")", "{", "try", "{", "buffer", ".", "writeAll", "(", "payload", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "GattSerialMessage", "serialMessage", "=", "GattSerialMessage", ".", "fromPayload", "(", "buffer", ".", "readByteArray", "(", ")", ")", ";", "gattClient", ".", "getSerialProfile", "(", ")", ".", "sendMessage", "(", "serialMessage", ".", "getBuffer", "(", ")", ")", ";", "}" ]
Send a message to Bean with a payload. @param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} for the message @param payload The message payload to send
[ "Send", "a", "message", "to", "Bean", "with", "a", "payload", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L730-L743
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java
RouteFilterRulesInner.listByRouteFilterWithServiceResponseAsync
public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> listByRouteFilterWithServiceResponseAsync(final String resourceGroupName, final String routeFilterName) { """ Gets all RouteFilterRules in a route filter. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RouteFilterRuleInner&gt; object """ return listByRouteFilterSinglePageAsync(resourceGroupName, routeFilterName) .concatMap(new Func1<ServiceResponse<Page<RouteFilterRuleInner>>, Observable<ServiceResponse<Page<RouteFilterRuleInner>>>>() { @Override public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> call(ServiceResponse<Page<RouteFilterRuleInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByRouteFilterNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> listByRouteFilterWithServiceResponseAsync(final String resourceGroupName, final String routeFilterName) { return listByRouteFilterSinglePageAsync(resourceGroupName, routeFilterName) .concatMap(new Func1<ServiceResponse<Page<RouteFilterRuleInner>>, Observable<ServiceResponse<Page<RouteFilterRuleInner>>>>() { @Override public Observable<ServiceResponse<Page<RouteFilterRuleInner>>> call(ServiceResponse<Page<RouteFilterRuleInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByRouteFilterNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "RouteFilterRuleInner", ">", ">", ">", "listByRouteFilterWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "routeFilterName", ")", "{", "return", "listByRouteFilterSinglePageAsync", "(", "resourceGroupName", ",", "routeFilterName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "RouteFilterRuleInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "RouteFilterRuleInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "RouteFilterRuleInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "RouteFilterRuleInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listByRouteFilterNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Gets all RouteFilterRules in a route filter. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RouteFilterRuleInner&gt; object
[ "Gets", "all", "RouteFilterRules", "in", "a", "route", "filter", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java#L790-L802
ACRA/acra
acra-core/src/main/java/org/acra/builder/ReportExecutor.java
ReportExecutor.saveCrashReportFile
private void saveCrashReportFile(@NonNull File file, @NonNull CrashReportData crashData) { """ Store a report @param file the file to store in @param crashData the content """ try { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Writing crash report file " + file); final CrashReportPersister persister = new CrashReportPersister(); persister.store(crashData, file); } catch (Exception e) { ACRA.log.e(LOG_TAG, "An error occurred while writing the report file...", e); } }
java
private void saveCrashReportFile(@NonNull File file, @NonNull CrashReportData crashData) { try { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Writing crash report file " + file); final CrashReportPersister persister = new CrashReportPersister(); persister.store(crashData, file); } catch (Exception e) { ACRA.log.e(LOG_TAG, "An error occurred while writing the report file...", e); } }
[ "private", "void", "saveCrashReportFile", "(", "@", "NonNull", "File", "file", ",", "@", "NonNull", "CrashReportData", "crashData", ")", "{", "try", "{", "if", "(", "ACRA", ".", "DEV_LOGGING", ")", "ACRA", ".", "log", ".", "d", "(", "LOG_TAG", ",", "\"Writing crash report file \"", "+", "file", ")", ";", "final", "CrashReportPersister", "persister", "=", "new", "CrashReportPersister", "(", ")", ";", "persister", ".", "store", "(", "crashData", ",", "file", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ACRA", ".", "log", ".", "e", "(", "LOG_TAG", ",", "\"An error occurred while writing the report file...\"", ",", "e", ")", ";", "}", "}" ]
Store a report @param file the file to store in @param crashData the content
[ "Store", "a", "report" ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/builder/ReportExecutor.java#L269-L277
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.formatPluralCurrency
public static String formatPluralCurrency(final Number value, final Locale locale) { """ <p> Same as {@link #formatPluralCurrency(Number) formatPluralCurrency} for the specified locale. </p> @param value Number to be formatted @param locale Target locale @return String representing the monetary amount """ return withinLocale(new Callable<String>() { public String call() throws Exception { return formatPluralCurrency(value); } }, locale); }
java
public static String formatPluralCurrency(final Number value, final Locale locale) { return withinLocale(new Callable<String>() { public String call() throws Exception { return formatPluralCurrency(value); } }, locale); }
[ "public", "static", "String", "formatPluralCurrency", "(", "final", "Number", "value", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "String", ">", "(", ")", "{", "public", "String", "call", "(", ")", "throws", "Exception", "{", "return", "formatPluralCurrency", "(", "value", ")", ";", "}", "}", ",", "locale", ")", ";", "}" ]
<p> Same as {@link #formatPluralCurrency(Number) formatPluralCurrency} for the specified locale. </p> @param value Number to be formatted @param locale Target locale @return String representing the monetary amount
[ "<p", ">", "Same", "as", "{", "@link", "#formatPluralCurrency", "(", "Number", ")", "formatPluralCurrency", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L983-L992
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addBooleanValue
protected void addBooleanValue(Document doc, String fieldName, Object internalValue) { """ Adds the string representation of the boolean value to the document as the named field. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document. """ doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.BOOLEAN)); }
java
protected void addBooleanValue(Document doc, String fieldName, Object internalValue) { doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.BOOLEAN)); }
[ "protected", "void", "addBooleanValue", "(", "Document", "doc", ",", "String", "fieldName", ",", "Object", "internalValue", ")", "{", "doc", ".", "add", "(", "createFieldWithoutNorms", "(", "fieldName", ",", "internalValue", ".", "toString", "(", ")", ",", "PropertyType", ".", "BOOLEAN", ")", ")", ";", "}" ]
Adds the string representation of the boolean value to the document as the named field. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document.
[ "Adds", "the", "string", "representation", "of", "the", "boolean", "value", "to", "the", "document", "as", "the", "named", "field", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L695-L698
bramp/ffmpeg-cli-wrapper
src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilder.java
AbstractFFmpegStreamBuilder.setStartOffset
public T setStartOffset(long offset, TimeUnit units) { """ Decodes but discards input until the offset. @param offset The offset @param units The units the offset is in @return this """ checkNotNull(units); this.startOffset = units.toMillis(offset); return getThis(); }
java
public T setStartOffset(long offset, TimeUnit units) { checkNotNull(units); this.startOffset = units.toMillis(offset); return getThis(); }
[ "public", "T", "setStartOffset", "(", "long", "offset", ",", "TimeUnit", "units", ")", "{", "checkNotNull", "(", "units", ")", ";", "this", ".", "startOffset", "=", "units", ".", "toMillis", "(", "offset", ")", ";", "return", "getThis", "(", ")", ";", "}" ]
Decodes but discards input until the offset. @param offset The offset @param units The units the offset is in @return this
[ "Decodes", "but", "discards", "input", "until", "the", "offset", "." ]
train
https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilder.java#L432-L438
undertow-io/undertow
core/src/main/java/io/undertow/Handlers.java
Handlers.jvmRoute
public static JvmRouteHandler jvmRoute(final String sessionCookieName, final String jvmRoute, HttpHandler next) { """ Handler that appends the JVM route to the session cookie @param sessionCookieName The session cookie name @param jvmRoute The JVM route to append @param next The next handler @return The handler """ return new JvmRouteHandler(next, sessionCookieName, jvmRoute); }
java
public static JvmRouteHandler jvmRoute(final String sessionCookieName, final String jvmRoute, HttpHandler next) { return new JvmRouteHandler(next, sessionCookieName, jvmRoute); }
[ "public", "static", "JvmRouteHandler", "jvmRoute", "(", "final", "String", "sessionCookieName", ",", "final", "String", "jvmRoute", ",", "HttpHandler", "next", ")", "{", "return", "new", "JvmRouteHandler", "(", "next", ",", "sessionCookieName", ",", "jvmRoute", ")", ";", "}" ]
Handler that appends the JVM route to the session cookie @param sessionCookieName The session cookie name @param jvmRoute The JVM route to append @param next The next handler @return The handler
[ "Handler", "that", "appends", "the", "JVM", "route", "to", "the", "session", "cookie" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/Handlers.java#L453-L455
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcher.java
NavigationViewEventDispatcher.initializeListeners
void initializeListeners(NavigationViewOptions navigationViewOptions, NavigationViewModel navigationViewModel) { """ Initializes the listeners in the dispatcher, as well as the listeners in the {@link MapboxNavigation} @param navigationViewOptions that contains all listeners to attach """ assignFeedbackListener(navigationViewOptions.feedbackListener()); assignNavigationListener(navigationViewOptions.navigationListener(), navigationViewModel); assignRouteListener(navigationViewOptions.routeListener()); assignBottomSheetCallback(navigationViewOptions.bottomSheetCallback()); MapboxNavigation navigation = navigationViewModel.retrieveNavigation(); assignProgressChangeListener(navigationViewOptions, navigation); assignMilestoneEventListener(navigationViewOptions, navigation); assignInstructionListListener(navigationViewOptions.instructionListListener()); assignSpeechAnnouncementListener(navigationViewOptions.speechAnnouncementListener()); assignBannerInstructionsListener(navigationViewOptions.bannerInstructionsListener()); }
java
void initializeListeners(NavigationViewOptions navigationViewOptions, NavigationViewModel navigationViewModel) { assignFeedbackListener(navigationViewOptions.feedbackListener()); assignNavigationListener(navigationViewOptions.navigationListener(), navigationViewModel); assignRouteListener(navigationViewOptions.routeListener()); assignBottomSheetCallback(navigationViewOptions.bottomSheetCallback()); MapboxNavigation navigation = navigationViewModel.retrieveNavigation(); assignProgressChangeListener(navigationViewOptions, navigation); assignMilestoneEventListener(navigationViewOptions, navigation); assignInstructionListListener(navigationViewOptions.instructionListListener()); assignSpeechAnnouncementListener(navigationViewOptions.speechAnnouncementListener()); assignBannerInstructionsListener(navigationViewOptions.bannerInstructionsListener()); }
[ "void", "initializeListeners", "(", "NavigationViewOptions", "navigationViewOptions", ",", "NavigationViewModel", "navigationViewModel", ")", "{", "assignFeedbackListener", "(", "navigationViewOptions", ".", "feedbackListener", "(", ")", ")", ";", "assignNavigationListener", "(", "navigationViewOptions", ".", "navigationListener", "(", ")", ",", "navigationViewModel", ")", ";", "assignRouteListener", "(", "navigationViewOptions", ".", "routeListener", "(", ")", ")", ";", "assignBottomSheetCallback", "(", "navigationViewOptions", ".", "bottomSheetCallback", "(", ")", ")", ";", "MapboxNavigation", "navigation", "=", "navigationViewModel", ".", "retrieveNavigation", "(", ")", ";", "assignProgressChangeListener", "(", "navigationViewOptions", ",", "navigation", ")", ";", "assignMilestoneEventListener", "(", "navigationViewOptions", ",", "navigation", ")", ";", "assignInstructionListListener", "(", "navigationViewOptions", ".", "instructionListListener", "(", ")", ")", ";", "assignSpeechAnnouncementListener", "(", "navigationViewOptions", ".", "speechAnnouncementListener", "(", ")", ")", ";", "assignBannerInstructionsListener", "(", "navigationViewOptions", ".", "bannerInstructionsListener", "(", ")", ")", ";", "}" ]
Initializes the listeners in the dispatcher, as well as the listeners in the {@link MapboxNavigation} @param navigationViewOptions that contains all listeners to attach
[ "Initializes", "the", "listeners", "in", "the", "dispatcher", "as", "well", "as", "the", "listeners", "in", "the", "{", "@link", "MapboxNavigation", "}" ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationViewEventDispatcher.java#L45-L56
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/data/bayesnet/BayesNetReader.java
BayesNetReader.parseVar
private static Var parseVar(String varLine) { """ Reads a variable from a line containing the variable name, a space, then a comma-separated list of the values it can take. """ String[] ws = whitespace.split(varLine); String name = ws[0]; List<String> stateNames = Arrays.asList(comma.split(ws[1])); int numStates = stateNames.size(); return new Var(VarType.PREDICTED, numStates, name, stateNames); }
java
private static Var parseVar(String varLine) { String[] ws = whitespace.split(varLine); String name = ws[0]; List<String> stateNames = Arrays.asList(comma.split(ws[1])); int numStates = stateNames.size(); return new Var(VarType.PREDICTED, numStates, name, stateNames); }
[ "private", "static", "Var", "parseVar", "(", "String", "varLine", ")", "{", "String", "[", "]", "ws", "=", "whitespace", ".", "split", "(", "varLine", ")", ";", "String", "name", "=", "ws", "[", "0", "]", ";", "List", "<", "String", ">", "stateNames", "=", "Arrays", ".", "asList", "(", "comma", ".", "split", "(", "ws", "[", "1", "]", ")", ")", ";", "int", "numStates", "=", "stateNames", ".", "size", "(", ")", ";", "return", "new", "Var", "(", "VarType", ".", "PREDICTED", ",", "numStates", ",", "name", ",", "stateNames", ")", ";", "}" ]
Reads a variable from a line containing the variable name, a space, then a comma-separated list of the values it can take.
[ "Reads", "a", "variable", "from", "a", "line", "containing", "the", "variable", "name", "a", "space", "then", "a", "comma", "-", "separated", "list", "of", "the", "values", "it", "can", "take", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/data/bayesnet/BayesNetReader.java#L116-L122
alkacon/opencms-core
src/org/opencms/staticexport/CmsStaticExportManager.java
CmsStaticExportManager.getVfsName
public String getVfsName(CmsObject cms, String rfsName) { """ Returns the VFS name for the given RFS name, being the exact reverse of <code>{@link #getRfsName(CmsObject, String)}</code>.<p> Returns <code>null</code> if no matching VFS resource can be found for the given RFS name.<p> @param cms the current users OpenCms context @param rfsName the RFS name to get the VFS name for @return the VFS name for the given RFS name, or <code>null</code> if the RFS name does not match to the VFS @see #getRfsName(CmsObject, String) """ CmsStaticExportData data = getRfsExportData(cms, rfsName); if (data != null) { String result = data.getVfsName(); if ((result != null) && result.startsWith(cms.getRequestContext().getSiteRoot())) { result = result.substring(cms.getRequestContext().getSiteRoot().length()); } return result; } return null; }
java
public String getVfsName(CmsObject cms, String rfsName) { CmsStaticExportData data = getRfsExportData(cms, rfsName); if (data != null) { String result = data.getVfsName(); if ((result != null) && result.startsWith(cms.getRequestContext().getSiteRoot())) { result = result.substring(cms.getRequestContext().getSiteRoot().length()); } return result; } return null; }
[ "public", "String", "getVfsName", "(", "CmsObject", "cms", ",", "String", "rfsName", ")", "{", "CmsStaticExportData", "data", "=", "getRfsExportData", "(", "cms", ",", "rfsName", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "String", "result", "=", "data", ".", "getVfsName", "(", ")", ";", "if", "(", "(", "result", "!=", "null", ")", "&&", "result", ".", "startsWith", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ")", ")", "{", "result", "=", "result", ".", "substring", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ".", "length", "(", ")", ")", ";", "}", "return", "result", ";", "}", "return", "null", ";", "}" ]
Returns the VFS name for the given RFS name, being the exact reverse of <code>{@link #getRfsName(CmsObject, String)}</code>.<p> Returns <code>null</code> if no matching VFS resource can be found for the given RFS name.<p> @param cms the current users OpenCms context @param rfsName the RFS name to get the VFS name for @return the VFS name for the given RFS name, or <code>null</code> if the RFS name does not match to the VFS @see #getRfsName(CmsObject, String)
[ "Returns", "the", "VFS", "name", "for", "the", "given", "RFS", "name", "being", "the", "exact", "reverse", "of", "<code", ">", "{", "@link", "#getRfsName", "(", "CmsObject", "String", ")", "}", "<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L1528-L1539
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java
SetUserIDHandler.init
public void init(Record thisFile, String userIdFieldName, boolean bFirstTimeOnly) { """ Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()). @param iFieldSeq Sequence of the user id field. @param iFirstTimeOnly Set it on the first time only? """ super.init(thisFile); this.userIdFieldName = userIdFieldName; m_bFirstTimeOnly = bFirstTimeOnly; }
java
public void init(Record thisFile, String userIdFieldName, boolean bFirstTimeOnly) { super.init(thisFile); this.userIdFieldName = userIdFieldName; m_bFirstTimeOnly = bFirstTimeOnly; }
[ "public", "void", "init", "(", "Record", "thisFile", ",", "String", "userIdFieldName", ",", "boolean", "bFirstTimeOnly", ")", "{", "super", ".", "init", "(", "thisFile", ")", ";", "this", ".", "userIdFieldName", "=", "userIdFieldName", ";", "m_bFirstTimeOnly", "=", "bFirstTimeOnly", ";", "}" ]
Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()). @param iFieldSeq Sequence of the user id field. @param iFirstTimeOnly Set it on the first time only?
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java#L56-L61
calimero-project/calimero-core
src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java
KNXNetworkLinkIP.newSecureRoutingLink
public static KNXNetworkLinkIP newSecureRoutingLink(final NetworkInterface netif, final InetAddress mcGroup, final byte[] groupKey, final Duration latencyTolerance, final KNXMediumSettings settings) throws KNXException { """ Creates a new secure network link using the KNX IP Secure Routing protocol. @param netif local network interface used to join the multicast group and for sending @param mcGroup address of the multicast group to join, use {@link #DefaultMulticast} for the default KNX IP multicast address @param groupKey KNX IP Secure group key (backbone key), <code>groupKey.length == 16</code> @param latencyTolerance time window for accepting secure multicasts, depending on max. end-to-end network latency (typically 500 ms to 5000 ms), <code>0 &lt; latencyTolerance.toMillis() &le; 8000</code> @param settings medium settings defining device and medium specifics needed for communication @return the network link in open state @throws KNXException on failure establishing link using the KNXnet/IP connection """ return new KNXNetworkLinkIP(ROUTING, SecureConnection.newRouting(netif, mcGroup, groupKey, latencyTolerance), settings); }
java
public static KNXNetworkLinkIP newSecureRoutingLink(final NetworkInterface netif, final InetAddress mcGroup, final byte[] groupKey, final Duration latencyTolerance, final KNXMediumSettings settings) throws KNXException { return new KNXNetworkLinkIP(ROUTING, SecureConnection.newRouting(netif, mcGroup, groupKey, latencyTolerance), settings); }
[ "public", "static", "KNXNetworkLinkIP", "newSecureRoutingLink", "(", "final", "NetworkInterface", "netif", ",", "final", "InetAddress", "mcGroup", ",", "final", "byte", "[", "]", "groupKey", ",", "final", "Duration", "latencyTolerance", ",", "final", "KNXMediumSettings", "settings", ")", "throws", "KNXException", "{", "return", "new", "KNXNetworkLinkIP", "(", "ROUTING", ",", "SecureConnection", ".", "newRouting", "(", "netif", ",", "mcGroup", ",", "groupKey", ",", "latencyTolerance", ")", ",", "settings", ")", ";", "}" ]
Creates a new secure network link using the KNX IP Secure Routing protocol. @param netif local network interface used to join the multicast group and for sending @param mcGroup address of the multicast group to join, use {@link #DefaultMulticast} for the default KNX IP multicast address @param groupKey KNX IP Secure group key (backbone key), <code>groupKey.length == 16</code> @param latencyTolerance time window for accepting secure multicasts, depending on max. end-to-end network latency (typically 500 ms to 5000 ms), <code>0 &lt; latencyTolerance.toMillis() &le; 8000</code> @param settings medium settings defining device and medium specifics needed for communication @return the network link in open state @throws KNXException on failure establishing link using the KNXnet/IP connection
[ "Creates", "a", "new", "secure", "network", "link", "using", "the", "KNX", "IP", "Secure", "Routing", "protocol", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java#L197-L201
nutzam/nutzboot
nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java
TioWebsocketMsgHandler.onAfterHandshaked
@Override public void onAfterHandshaked(HttpRequest httpRequest, HttpResponse httpResponse, ChannelContext channelContext) throws Exception { """ afterHandshaked @param httpRequest httpRequest @param httpResponse httpResponse @param channelContext channelContext @throws Exception e """ log.debug("onAfterHandshaked"); TioWebsocketMethodMapper onAfterHandshaked = methods.getOnAfterHandshaked(); if (onAfterHandshaked != null) { onAfterHandshaked.getMethod().invoke(onAfterHandshaked.getInstance(), httpRequest, httpResponse, channelContext); } }
java
@Override public void onAfterHandshaked(HttpRequest httpRequest, HttpResponse httpResponse, ChannelContext channelContext) throws Exception { log.debug("onAfterHandshaked"); TioWebsocketMethodMapper onAfterHandshaked = methods.getOnAfterHandshaked(); if (onAfterHandshaked != null) { onAfterHandshaked.getMethod().invoke(onAfterHandshaked.getInstance(), httpRequest, httpResponse, channelContext); } }
[ "@", "Override", "public", "void", "onAfterHandshaked", "(", "HttpRequest", "httpRequest", ",", "HttpResponse", "httpResponse", ",", "ChannelContext", "channelContext", ")", "throws", "Exception", "{", "log", ".", "debug", "(", "\"onAfterHandshaked\"", ")", ";", "TioWebsocketMethodMapper", "onAfterHandshaked", "=", "methods", ".", "getOnAfterHandshaked", "(", ")", ";", "if", "(", "onAfterHandshaked", "!=", "null", ")", "{", "onAfterHandshaked", ".", "getMethod", "(", ")", ".", "invoke", "(", "onAfterHandshaked", ".", "getInstance", "(", ")", ",", "httpRequest", ",", "httpResponse", ",", "channelContext", ")", ";", "}", "}" ]
afterHandshaked @param httpRequest httpRequest @param httpResponse httpResponse @param channelContext channelContext @throws Exception e
[ "afterHandshaked" ]
train
https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java#L56-L63
aws/aws-sdk-java
aws-java-sdk-elasticloadbalancingv2/src/main/java/com/amazonaws/services/elasticloadbalancingv2/model/AuthenticateOidcActionConfig.java
AuthenticateOidcActionConfig.withAuthenticationRequestExtraParams
public AuthenticateOidcActionConfig withAuthenticationRequestExtraParams(java.util.Map<String, String> authenticationRequestExtraParams) { """ <p> The query parameters (up to 10) to include in the redirect request to the authorization endpoint. </p> @param authenticationRequestExtraParams The query parameters (up to 10) to include in the redirect request to the authorization endpoint. @return Returns a reference to this object so that method calls can be chained together. """ setAuthenticationRequestExtraParams(authenticationRequestExtraParams); return this; }
java
public AuthenticateOidcActionConfig withAuthenticationRequestExtraParams(java.util.Map<String, String> authenticationRequestExtraParams) { setAuthenticationRequestExtraParams(authenticationRequestExtraParams); return this; }
[ "public", "AuthenticateOidcActionConfig", "withAuthenticationRequestExtraParams", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "authenticationRequestExtraParams", ")", "{", "setAuthenticationRequestExtraParams", "(", "authenticationRequestExtraParams", ")", ";", "return", "this", ";", "}" ]
<p> The query parameters (up to 10) to include in the redirect request to the authorization endpoint. </p> @param authenticationRequestExtraParams The query parameters (up to 10) to include in the redirect request to the authorization endpoint. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "query", "parameters", "(", "up", "to", "10", ")", "to", "include", "in", "the", "redirect", "request", "to", "the", "authorization", "endpoint", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticloadbalancingv2/src/main/java/com/amazonaws/services/elasticloadbalancingv2/model/AuthenticateOidcActionConfig.java#L572-L575
beanshell/beanshell
src/main/java/bsh/engine/BshScriptEngine.java
BshScriptEngine.getInterface
@Override public <T> T getInterface(Object thiz, Class<T> clasz) { """ Returns an implementation of an interface using member functions of a scripting object compiled in the interpreter. The methods of the interface may be implemented using invoke(Object, String, Object...) method. @param thiz The scripting object whose member functions are used to implement the methods of the interface. @param clasz The {@code Class} object of the interface to return. @return An instance of requested interface - null if the requested interface is unavailable, i. e. if compiled methods in the {@code ScriptEngine} cannot be found matching the ones in the requested interface. @throws IllegalArgumentException if the specified {@code Class} object does not exist or is not an interface, or if the specified Object is null or does not represent a scripting object. """ if (!(thiz instanceof bsh.This)) { throw new IllegalArgumentException("Illegal object type: " + (null == thiz ? "null" : thiz.getClass())); } bsh.This bshThis = (bsh.This) thiz; return clasz.cast(bshThis.getInterface(clasz)); }
java
@Override public <T> T getInterface(Object thiz, Class<T> clasz) { if (!(thiz instanceof bsh.This)) { throw new IllegalArgumentException("Illegal object type: " + (null == thiz ? "null" : thiz.getClass())); } bsh.This bshThis = (bsh.This) thiz; return clasz.cast(bshThis.getInterface(clasz)); }
[ "@", "Override", "public", "<", "T", ">", "T", "getInterface", "(", "Object", "thiz", ",", "Class", "<", "T", ">", "clasz", ")", "{", "if", "(", "!", "(", "thiz", "instanceof", "bsh", ".", "This", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal object type: \"", "+", "(", "null", "==", "thiz", "?", "\"null\"", ":", "thiz", ".", "getClass", "(", ")", ")", ")", ";", "}", "bsh", ".", "This", "bshThis", "=", "(", "bsh", ".", "This", ")", "thiz", ";", "return", "clasz", ".", "cast", "(", "bshThis", ".", "getInterface", "(", "clasz", ")", ")", ";", "}" ]
Returns an implementation of an interface using member functions of a scripting object compiled in the interpreter. The methods of the interface may be implemented using invoke(Object, String, Object...) method. @param thiz The scripting object whose member functions are used to implement the methods of the interface. @param clasz The {@code Class} object of the interface to return. @return An instance of requested interface - null if the requested interface is unavailable, i. e. if compiled methods in the {@code ScriptEngine} cannot be found matching the ones in the requested interface. @throws IllegalArgumentException if the specified {@code Class} object does not exist or is not an interface, or if the specified Object is null or does not represent a scripting object.
[ "Returns", "an", "implementation", "of", "an", "interface", "using", "member", "functions", "of", "a", "scripting", "object", "compiled", "in", "the", "interpreter", ".", "The", "methods", "of", "the", "interface", "may", "be", "implemented", "using", "invoke", "(", "Object", "String", "Object", "...", ")", "method", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/engine/BshScriptEngine.java#L343-L351
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/JensenShannonDistance.java
JensenShannonDistance.prepare
final public StringWrapper prepare(String s) { """ Preprocess a string by finding tokens and giving them weights W such that W is the smoothed probability of the token appearing in the document. """ BagOfTokens bag = new BagOfTokens(s, tokenizer.tokenize(s)); double totalWeight = bag.getTotalWeight(); for (Iterator i=bag.tokenIterator(); i.hasNext(); ) { Token tok = (Token)i.next(); double freq = bag.getWeight(tok); bag.setWeight( tok, smoothedProbability(tok, freq, totalWeight) ); } return bag; }
java
final public StringWrapper prepare(String s) { BagOfTokens bag = new BagOfTokens(s, tokenizer.tokenize(s)); double totalWeight = bag.getTotalWeight(); for (Iterator i=bag.tokenIterator(); i.hasNext(); ) { Token tok = (Token)i.next(); double freq = bag.getWeight(tok); bag.setWeight( tok, smoothedProbability(tok, freq, totalWeight) ); } return bag; }
[ "final", "public", "StringWrapper", "prepare", "(", "String", "s", ")", "{", "BagOfTokens", "bag", "=", "new", "BagOfTokens", "(", "s", ",", "tokenizer", ".", "tokenize", "(", "s", ")", ")", ";", "double", "totalWeight", "=", "bag", ".", "getTotalWeight", "(", ")", ";", "for", "(", "Iterator", "i", "=", "bag", ".", "tokenIterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Token", "tok", "=", "(", "Token", ")", "i", ".", "next", "(", ")", ";", "double", "freq", "=", "bag", ".", "getWeight", "(", "tok", ")", ";", "bag", ".", "setWeight", "(", "tok", ",", "smoothedProbability", "(", "tok", ",", "freq", ",", "totalWeight", ")", ")", ";", "}", "return", "bag", ";", "}" ]
Preprocess a string by finding tokens and giving them weights W such that W is the smoothed probability of the token appearing in the document.
[ "Preprocess", "a", "string", "by", "finding", "tokens", "and", "giving", "them", "weights", "W", "such", "that", "W", "is", "the", "smoothed", "probability", "of", "the", "token", "appearing", "in", "the", "document", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/JensenShannonDistance.java#L50-L59
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java
BaseTraceService.captureSystemStreams
protected void captureSystemStreams() { """ Capture the system stream. The original streams are cached/remembered when the special trace components are created. """ teeOut = new TeePrintStream(new TrOutputStream(systemOut, this), true); System.setOut(teeOut); teeErr = new TeePrintStream(new TrOutputStream(systemErr, this), true); System.setErr(teeErr); }
java
protected void captureSystemStreams() { teeOut = new TeePrintStream(new TrOutputStream(systemOut, this), true); System.setOut(teeOut); teeErr = new TeePrintStream(new TrOutputStream(systemErr, this), true); System.setErr(teeErr); }
[ "protected", "void", "captureSystemStreams", "(", ")", "{", "teeOut", "=", "new", "TeePrintStream", "(", "new", "TrOutputStream", "(", "systemOut", ",", "this", ")", ",", "true", ")", ";", "System", ".", "setOut", "(", "teeOut", ")", ";", "teeErr", "=", "new", "TeePrintStream", "(", "new", "TrOutputStream", "(", "systemErr", ",", "this", ")", ",", "true", ")", ";", "System", ".", "setErr", "(", "teeErr", ")", ";", "}" ]
Capture the system stream. The original streams are cached/remembered when the special trace components are created.
[ "Capture", "the", "system", "stream", ".", "The", "original", "streams", "are", "cached", "/", "remembered", "when", "the", "special", "trace", "components", "are", "created", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L1256-L1262
alkacon/opencms-core
src/org/opencms/i18n/CmsVfsBundleManager.java
CmsVfsBundleManager.addBundle
private void addBundle(String baseName, Locale locale, I_CmsResourceBundle bundle) { """ Internal method for adding a resource bundle to the internal cache.<p> @param baseName the base name of the resource bundle @param locale the locale of the resource bundle @param bundle the resource bundle to add """ CmsResourceBundleLoader.addBundleToCache(baseName, locale, bundle); }
java
private void addBundle(String baseName, Locale locale, I_CmsResourceBundle bundle) { CmsResourceBundleLoader.addBundleToCache(baseName, locale, bundle); }
[ "private", "void", "addBundle", "(", "String", "baseName", ",", "Locale", "locale", ",", "I_CmsResourceBundle", "bundle", ")", "{", "CmsResourceBundleLoader", ".", "addBundleToCache", "(", "baseName", ",", "locale", ",", "bundle", ")", ";", "}" ]
Internal method for adding a resource bundle to the internal cache.<p> @param baseName the base name of the resource bundle @param locale the locale of the resource bundle @param bundle the resource bundle to add
[ "Internal", "method", "for", "adding", "a", "resource", "bundle", "to", "the", "internal", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsVfsBundleManager.java#L275-L278
OpenBEL/openbel-framework
org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/utils/InvalidIdException.java
InvalidIdException.buildMessage
private static String buildMessage(final String id) { """ Build the exception's message using the <tt>id</tt> value. @param id, {@link String} the id @return the exception's message """ if (id == null) { return NULL_MESSAGE; } return format(INVALID_MSG_FMT, id); }
java
private static String buildMessage(final String id) { if (id == null) { return NULL_MESSAGE; } return format(INVALID_MSG_FMT, id); }
[ "private", "static", "String", "buildMessage", "(", "final", "String", "id", ")", "{", "if", "(", "id", "==", "null", ")", "{", "return", "NULL_MESSAGE", ";", "}", "return", "format", "(", "INVALID_MSG_FMT", ",", "id", ")", ";", "}" ]
Build the exception's message using the <tt>id</tt> value. @param id, {@link String} the id @return the exception's message
[ "Build", "the", "exception", "s", "message", "using", "the", "<tt", ">", "id<", "/", "tt", ">", "value", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/utils/InvalidIdException.java#L97-L103
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doGet
public void doGet(String url, HttpResponse response, boolean followRedirect) { """ GETs content from URL. @param url url to get from. @param response response to store url and response value in. """ doGet(url, response, null, followRedirect); }
java
public void doGet(String url, HttpResponse response, boolean followRedirect) { doGet(url, response, null, followRedirect); }
[ "public", "void", "doGet", "(", "String", "url", ",", "HttpResponse", "response", ",", "boolean", "followRedirect", ")", "{", "doGet", "(", "url", ",", "response", ",", "null", ",", "followRedirect", ")", ";", "}" ]
GETs content from URL. @param url url to get from. @param response response to store url and response value in.
[ "GETs", "content", "from", "URL", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L406-L408
grpc/grpc-java
api/src/main/java/io/grpc/Status.java
Status.withCause
public Status withCause(Throwable cause) { """ Create a derived instance of {@link Status} with the given cause. However, the cause is not transmitted from server to client. """ if (Objects.equal(this.cause, cause)) { return this; } return new Status(this.code, this.description, cause); }
java
public Status withCause(Throwable cause) { if (Objects.equal(this.cause, cause)) { return this; } return new Status(this.code, this.description, cause); }
[ "public", "Status", "withCause", "(", "Throwable", "cause", ")", "{", "if", "(", "Objects", ".", "equal", "(", "this", ".", "cause", ",", "cause", ")", ")", "{", "return", "this", ";", "}", "return", "new", "Status", "(", "this", ".", "code", ",", "this", ".", "description", ",", "cause", ")", ";", "}" ]
Create a derived instance of {@link Status} with the given cause. However, the cause is not transmitted from server to client.
[ "Create", "a", "derived", "instance", "of", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Status.java#L455-L460
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/SassRubyGenerator.java
SassRubyGenerator.buildScript
private String buildScript(String path, String content) { """ Builds the ruby script to execute @param path the resource path @param content the resource content @return the ruby script to execute """ StringBuilder script = new StringBuilder(); script.append("require 'rubygems'\n" + "require 'sass/plugin'\n" + "require 'sass/engine'\n"); content = SassRubyUtils.normalizeMultiByteString(content); script.append(String.format( "customImporter = Sass::Importers::JawrImporter.new(@jawrResolver) \n" + "name = \"%s\"\n" + "result = Sass::Engine.new(\"%s\", {:importer => customImporter, :filename => name, :syntax => :scss, :cache => false}).render", path, content.replace("\"", "\\\"").replace("#", "\\#"))); return script.toString(); }
java
private String buildScript(String path, String content) { StringBuilder script = new StringBuilder(); script.append("require 'rubygems'\n" + "require 'sass/plugin'\n" + "require 'sass/engine'\n"); content = SassRubyUtils.normalizeMultiByteString(content); script.append(String.format( "customImporter = Sass::Importers::JawrImporter.new(@jawrResolver) \n" + "name = \"%s\"\n" + "result = Sass::Engine.new(\"%s\", {:importer => customImporter, :filename => name, :syntax => :scss, :cache => false}).render", path, content.replace("\"", "\\\"").replace("#", "\\#"))); return script.toString(); }
[ "private", "String", "buildScript", "(", "String", "path", ",", "String", "content", ")", "{", "StringBuilder", "script", "=", "new", "StringBuilder", "(", ")", ";", "script", ".", "append", "(", "\"require 'rubygems'\\n\"", "+", "\"require 'sass/plugin'\\n\"", "+", "\"require 'sass/engine'\\n\"", ")", ";", "content", "=", "SassRubyUtils", ".", "normalizeMultiByteString", "(", "content", ")", ";", "script", ".", "append", "(", "String", ".", "format", "(", "\"customImporter = Sass::Importers::JawrImporter.new(@jawrResolver) \\n\"", "+", "\"name = \\\"%s\\\"\\n\"", "+", "\"result = Sass::Engine.new(\\\"%s\\\", {:importer => customImporter, :filename => name, :syntax => :scss, :cache => false}).render\"", ",", "path", ",", "content", ".", "replace", "(", "\"\\\"\"", ",", "\"\\\\\\\"\"", ")", ".", "replace", "(", "\"#\"", ",", "\"\\\\#\"", ")", ")", ")", ";", "return", "script", ".", "toString", "(", ")", ";", "}" ]
Builds the ruby script to execute @param path the resource path @param content the resource content @return the ruby script to execute
[ "Builds", "the", "ruby", "script", "to", "execute" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/SassRubyGenerator.java#L221-L234
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.paddingDp
@NonNull public IconicsDrawable paddingDp(@Dimension(unit = DP) int sizeDp) { """ Set the padding in dp for the drawable @return The current IconicsDrawable for chaining. """ return paddingPx(Utils.convertDpToPx(mContext, sizeDp)); }
java
@NonNull public IconicsDrawable paddingDp(@Dimension(unit = DP) int sizeDp) { return paddingPx(Utils.convertDpToPx(mContext, sizeDp)); }
[ "@", "NonNull", "public", "IconicsDrawable", "paddingDp", "(", "@", "Dimension", "(", "unit", "=", "DP", ")", "int", "sizeDp", ")", "{", "return", "paddingPx", "(", "Utils", ".", "convertDpToPx", "(", "mContext", ",", "sizeDp", ")", ")", ";", "}" ]
Set the padding in dp for the drawable @return The current IconicsDrawable for chaining.
[ "Set", "the", "padding", "in", "dp", "for", "the", "drawable" ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L591-L594
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/MigrateRowsBase.java
MigrateRowsBase.executePrecompiledSQL
VoltTable executePrecompiledSQL(Statement catStmt, Object[] params, boolean replicated) throws VoltAbortException { """ Execute a pre-compiled adHoc SQL statement, throw exception if not. @return Count of rows inserted or upserted. @throws VoltAbortException if any failure at all. """ // Create a SQLStmt instance on the fly // This is unusual to do, as they are typically required to be final instance variables. // This only works because the SQL text and plan is identical from the borrowed procedure. SQLStmt stmt = new SQLStmt(catStmt.getSqltext()); if (replicated) { stmt.setInCatalog(false); } m_runner.initSQLStmt(stmt, catStmt); voltQueueSQL(stmt, params); return voltExecuteSQL()[0]; }
java
VoltTable executePrecompiledSQL(Statement catStmt, Object[] params, boolean replicated) throws VoltAbortException { // Create a SQLStmt instance on the fly // This is unusual to do, as they are typically required to be final instance variables. // This only works because the SQL text and plan is identical from the borrowed procedure. SQLStmt stmt = new SQLStmt(catStmt.getSqltext()); if (replicated) { stmt.setInCatalog(false); } m_runner.initSQLStmt(stmt, catStmt); voltQueueSQL(stmt, params); return voltExecuteSQL()[0]; }
[ "VoltTable", "executePrecompiledSQL", "(", "Statement", "catStmt", ",", "Object", "[", "]", "params", ",", "boolean", "replicated", ")", "throws", "VoltAbortException", "{", "// Create a SQLStmt instance on the fly", "// This is unusual to do, as they are typically required to be final instance variables.", "// This only works because the SQL text and plan is identical from the borrowed procedure.", "SQLStmt", "stmt", "=", "new", "SQLStmt", "(", "catStmt", ".", "getSqltext", "(", ")", ")", ";", "if", "(", "replicated", ")", "{", "stmt", ".", "setInCatalog", "(", "false", ")", ";", "}", "m_runner", ".", "initSQLStmt", "(", "stmt", ",", "catStmt", ")", ";", "voltQueueSQL", "(", "stmt", ",", "params", ")", ";", "return", "voltExecuteSQL", "(", ")", "[", "0", "]", ";", "}" ]
Execute a pre-compiled adHoc SQL statement, throw exception if not. @return Count of rows inserted or upserted. @throws VoltAbortException if any failure at all.
[ "Execute", "a", "pre", "-", "compiled", "adHoc", "SQL", "statement", "throw", "exception", "if", "not", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/MigrateRowsBase.java#L65-L78
apache/incubator-druid
server/src/main/java/org/apache/druid/server/coordinator/helper/SegmentCompactorUtil.java
SegmentCompactorUtil.removeIntervalFromEnd
static Interval removeIntervalFromEnd(Interval largeInterval, Interval smallInterval) { """ Removes {@code smallInterval} from {@code largeInterval}. The end of both intervals should be same. @return an interval of {@code largeInterval} - {@code smallInterval}. """ Preconditions.checkArgument( largeInterval.getEnd().equals(smallInterval.getEnd()), "end should be same. largeInterval[%s] smallInterval[%s]", largeInterval, smallInterval ); return new Interval(largeInterval.getStart(), smallInterval.getStart()); }
java
static Interval removeIntervalFromEnd(Interval largeInterval, Interval smallInterval) { Preconditions.checkArgument( largeInterval.getEnd().equals(smallInterval.getEnd()), "end should be same. largeInterval[%s] smallInterval[%s]", largeInterval, smallInterval ); return new Interval(largeInterval.getStart(), smallInterval.getStart()); }
[ "static", "Interval", "removeIntervalFromEnd", "(", "Interval", "largeInterval", ",", "Interval", "smallInterval", ")", "{", "Preconditions", ".", "checkArgument", "(", "largeInterval", ".", "getEnd", "(", ")", ".", "equals", "(", "smallInterval", ".", "getEnd", "(", ")", ")", ",", "\"end should be same. largeInterval[%s] smallInterval[%s]\"", ",", "largeInterval", ",", "smallInterval", ")", ";", "return", "new", "Interval", "(", "largeInterval", ".", "getStart", "(", ")", ",", "smallInterval", ".", "getStart", "(", ")", ")", ";", "}" ]
Removes {@code smallInterval} from {@code largeInterval}. The end of both intervals should be same. @return an interval of {@code largeInterval} - {@code smallInterval}.
[ "Removes", "{", "@code", "smallInterval", "}", "from", "{", "@code", "largeInterval", "}", ".", "The", "end", "of", "both", "intervals", "should", "be", "same", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/helper/SegmentCompactorUtil.java#L45-L54
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/PathImpl.java
PathImpl.lookup
public PathImpl lookup(String userPath, Map<String,Object> newAttributes) { """ Returns a new path relative to the current one. <p>Path only handles scheme:xxx. Subclasses of Path will specialize the xxx. @param userPath relative or absolute path, essentially any url. @param newAttributes attributes for the new path. @return the new path or null if the scheme doesn't exist """ if (newAttributes != null) { return lookupImpl(userPath, newAttributes, true); } else if (userPath == null) { return this; } PathImpl path = getCache(userPath); if (path != null) { return path; } path = lookupImpl(userPath, null, true); if (_startTime == 0) { _startTime = System.currentTimeMillis(); putCache(userPath, path); } return path; }
java
public PathImpl lookup(String userPath, Map<String,Object> newAttributes) { if (newAttributes != null) { return lookupImpl(userPath, newAttributes, true); } else if (userPath == null) { return this; } PathImpl path = getCache(userPath); if (path != null) { return path; } path = lookupImpl(userPath, null, true); if (_startTime == 0) { _startTime = System.currentTimeMillis(); putCache(userPath, path); } return path; }
[ "public", "PathImpl", "lookup", "(", "String", "userPath", ",", "Map", "<", "String", ",", "Object", ">", "newAttributes", ")", "{", "if", "(", "newAttributes", "!=", "null", ")", "{", "return", "lookupImpl", "(", "userPath", ",", "newAttributes", ",", "true", ")", ";", "}", "else", "if", "(", "userPath", "==", "null", ")", "{", "return", "this", ";", "}", "PathImpl", "path", "=", "getCache", "(", "userPath", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "return", "path", ";", "}", "path", "=", "lookupImpl", "(", "userPath", ",", "null", ",", "true", ")", ";", "if", "(", "_startTime", "==", "0", ")", "{", "_startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "putCache", "(", "userPath", ",", "path", ")", ";", "}", "return", "path", ";", "}" ]
Returns a new path relative to the current one. <p>Path only handles scheme:xxx. Subclasses of Path will specialize the xxx. @param userPath relative or absolute path, essentially any url. @param newAttributes attributes for the new path. @return the new path or null if the scheme doesn't exist
[ "Returns", "a", "new", "path", "relative", "to", "the", "current", "one", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L184-L208
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/DoubleStream.java
DoubleStream.mapToInt
@NotNull public IntStream mapToInt(@NotNull final DoubleToIntFunction mapper) { """ Returns an {@code IntStream} consisting of the results of applying the given function to the elements of this stream. <p> This is an intermediate operation. @param mapper the mapper function used to apply to each element @return the new {@code IntStream} """ return new IntStream(params, new DoubleMapToInt(iterator, mapper)); }
java
@NotNull public IntStream mapToInt(@NotNull final DoubleToIntFunction mapper) { return new IntStream(params, new DoubleMapToInt(iterator, mapper)); }
[ "@", "NotNull", "public", "IntStream", "mapToInt", "(", "@", "NotNull", "final", "DoubleToIntFunction", "mapper", ")", "{", "return", "new", "IntStream", "(", "params", ",", "new", "DoubleMapToInt", "(", "iterator", ",", "mapper", ")", ")", ";", "}" ]
Returns an {@code IntStream} consisting of the results of applying the given function to the elements of this stream. <p> This is an intermediate operation. @param mapper the mapper function used to apply to each element @return the new {@code IntStream}
[ "Returns", "an", "{", "@code", "IntStream", "}", "consisting", "of", "the", "results", "of", "applying", "the", "given", "function", "to", "the", "elements", "of", "this", "stream", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L490-L493
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_network_private_networkId_subnet_subnetId_DELETE
public void project_serviceName_network_private_networkId_subnet_subnetId_DELETE(String serviceName, String networkId, String subnetId) throws IOException { """ Delete a network subnet REST: DELETE /cloud/project/{serviceName}/network/private/{networkId}/subnet/{subnetId} @param networkId [required] Network id @param serviceName [required] Project id @param subnetId [required] Subnet id """ String qPath = "/cloud/project/{serviceName}/network/private/{networkId}/subnet/{subnetId}"; StringBuilder sb = path(qPath, serviceName, networkId, subnetId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void project_serviceName_network_private_networkId_subnet_subnetId_DELETE(String serviceName, String networkId, String subnetId) throws IOException { String qPath = "/cloud/project/{serviceName}/network/private/{networkId}/subnet/{subnetId}"; StringBuilder sb = path(qPath, serviceName, networkId, subnetId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "project_serviceName_network_private_networkId_subnet_subnetId_DELETE", "(", "String", "serviceName", ",", "String", "networkId", ",", "String", "subnetId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/network/private/{networkId}/subnet/{subnetId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "networkId", ",", "subnetId", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete a network subnet REST: DELETE /cloud/project/{serviceName}/network/private/{networkId}/subnet/{subnetId} @param networkId [required] Network id @param serviceName [required] Project id @param subnetId [required] Subnet id
[ "Delete", "a", "network", "subnet" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L713-L717
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.domainName
public static Validator<CharSequence> domainName(@NonNull final Context context, @StringRes final int resourceId) { """ Creates and returns a validator, which allows to validate texts to ensure, that they represent valid domain names. 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 DomainNameValidator(context, resourceId); }
java
public static Validator<CharSequence> domainName(@NonNull final Context context, @StringRes final int resourceId) { return new DomainNameValidator(context, resourceId); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "domainName", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "return", "new", "DomainNameValidator", "(", "context", ",", "resourceId", ")", ";", "}" ]
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid domain names. 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", "represent", "valid", "domain", "names", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L998-L1001
Azure/azure-sdk-for-java
sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java
ManagedInstanceVulnerabilityAssessmentsInner.getAsync
public Observable<ManagedInstanceVulnerabilityAssessmentInner> getAsync(String resourceGroupName, String managedInstanceName) { """ Gets the managed instance's vulnerability assessment. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object """ return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner>, ManagedInstanceVulnerabilityAssessmentInner>() { @Override public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner> response) { return response.body(); } }); }
java
public Observable<ManagedInstanceVulnerabilityAssessmentInner> getAsync(String resourceGroupName, String managedInstanceName) { return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner>, ManagedInstanceVulnerabilityAssessmentInner>() { @Override public ManagedInstanceVulnerabilityAssessmentInner call(ServiceResponse<ManagedInstanceVulnerabilityAssessmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", ",", "ManagedInstanceVulnerabilityAssessmentInner", ">", "(", ")", "{", "@", "Override", "public", "ManagedInstanceVulnerabilityAssessmentInner", "call", "(", "ServiceResponse", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the managed instance's vulnerability assessment. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedInstanceVulnerabilityAssessmentInner object
[ "Gets", "the", "managed", "instance", "s", "vulnerability", "assessment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java#L122-L129