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
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.createOrUpdateAsync
public Observable<AppServiceCertificateOrderInner> createOrUpdateAsync(String resourceGroupName, String certificateOrderName, AppServiceCertificateOrderInner certificateDistinguishedName) { """ Create or update a certificate purchase order. Create or update a certificate purchase order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param certificateDistinguishedName Distinguished name to to use for the certificate order. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, certificateOrderName, certificateDistinguishedName).map(new Func1<ServiceResponse<AppServiceCertificateOrderInner>, AppServiceCertificateOrderInner>() { @Override public AppServiceCertificateOrderInner call(ServiceResponse<AppServiceCertificateOrderInner> response) { return response.body(); } }); }
java
public Observable<AppServiceCertificateOrderInner> createOrUpdateAsync(String resourceGroupName, String certificateOrderName, AppServiceCertificateOrderInner certificateDistinguishedName) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, certificateOrderName, certificateDistinguishedName).map(new Func1<ServiceResponse<AppServiceCertificateOrderInner>, AppServiceCertificateOrderInner>() { @Override public AppServiceCertificateOrderInner call(ServiceResponse<AppServiceCertificateOrderInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppServiceCertificateOrderInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "AppServiceCertificateOrderInner", "certificateDistinguishedName", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ",", "certificateDistinguishedName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "AppServiceCertificateOrderInner", ">", ",", "AppServiceCertificateOrderInner", ">", "(", ")", "{", "@", "Override", "public", "AppServiceCertificateOrderInner", "call", "(", "ServiceResponse", "<", "AppServiceCertificateOrderInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update a certificate purchase order. Create or update a certificate purchase order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param certificateDistinguishedName Distinguished name to to use for the certificate order. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "update", "a", "certificate", "purchase", "order", ".", "Create", "or", "update", "a", "certificate", "purchase", "order", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L623-L630
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/simple/SimpleBase.java
SimpleBase.plus
public T plus( double beta , T B ) { """ <p> Performs a matrix addition and scale operation.<br> <br> c = a + &beta;*b <br> <br> where c is the returned matrix, a is this matrix, and b is the passed in matrix. </p> @see CommonOps_DDRM#add( DMatrixD1, double , DMatrixD1, DMatrixD1) @param B m by n matrix. Not modified. @return A matrix that contains the results. """ convertType.specify(this,B); T A = convertType.convert(this); B = convertType.convert(B); T ret = A.createLike(); A.ops.plus(A.mat,beta,B.mat,ret.mat); return ret; }
java
public T plus( double beta , T B ) { convertType.specify(this,B); T A = convertType.convert(this); B = convertType.convert(B); T ret = A.createLike(); A.ops.plus(A.mat,beta,B.mat,ret.mat); return ret; }
[ "public", "T", "plus", "(", "double", "beta", ",", "T", "B", ")", "{", "convertType", ".", "specify", "(", "this", ",", "B", ")", ";", "T", "A", "=", "convertType", ".", "convert", "(", "this", ")", ";", "B", "=", "convertType", ".", "convert", "(", "B", ")", ";", "T", "ret", "=", "A", ".", "createLike", "(", ")", ";", "A", ".", "ops", ".", "plus", "(", "A", ".", "mat", ",", "beta", ",", "B", ".", "mat", ",", "ret", ".", "mat", ")", ";", "return", "ret", ";", "}" ]
<p> Performs a matrix addition and scale operation.<br> <br> c = a + &beta;*b <br> <br> where c is the returned matrix, a is this matrix, and b is the passed in matrix. </p> @see CommonOps_DDRM#add( DMatrixD1, double , DMatrixD1, DMatrixD1) @param B m by n matrix. Not modified. @return A matrix that contains the results.
[ "<p", ">", "Performs", "a", "matrix", "addition", "and", "scale", "operation", ".", "<br", ">", "<br", ">", "c", "=", "a", "+", "&beta", ";", "*", "b", "<br", ">", "<br", ">", "where", "c", "is", "the", "returned", "matrix", "a", "is", "this", "matrix", "and", "b", "is", "the", "passed", "in", "matrix", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L318-L326
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/variant/VariantUtils.java
VariantUtils.getVariantKey
public static String getVariantKey(Map<String, String> variants) { """ Returns the variant key from the variants given in parameter @param variants the variants @return the variant key """ String variantKey = ""; if (variants != null) { variantKey = getVariantKey(variants, variants.keySet()); } return variantKey; }
java
public static String getVariantKey(Map<String, String> variants) { String variantKey = ""; if (variants != null) { variantKey = getVariantKey(variants, variants.keySet()); } return variantKey; }
[ "public", "static", "String", "getVariantKey", "(", "Map", "<", "String", ",", "String", ">", "variants", ")", "{", "String", "variantKey", "=", "\"\"", ";", "if", "(", "variants", "!=", "null", ")", "{", "variantKey", "=", "getVariantKey", "(", "variants", ",", "variants", ".", "keySet", "(", ")", ")", ";", "}", "return", "variantKey", ";", "}" ]
Returns the variant key from the variants given in parameter @param variants the variants @return the variant key
[ "Returns", "the", "variant", "key", "from", "the", "variants", "given", "in", "parameter" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/variant/VariantUtils.java#L191-L199
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.findOneByField
public static <T> T findOneByField(Iterable<T> collection, final String fieldName, final Object fieldValue) { """ 查找第一个匹配元素对象<br> 如果集合元素是Map,则比对键和值是否相同,相同则返回<br> 如果为普通Bean,则通过反射比对元素字段名对应的字段值是否相同,相同则返回<br> 如果给定字段值参数是{@code null} 且元素对象中的字段值也为{@code null}则认为相同 @param <T> 集合元素类型 @param collection 集合,集合元素可以是Bean或者Map @param fieldName 集合元素对象的字段名或map的键 @param fieldValue 集合元素对象的字段值或map的值 @return 满足条件的第一个元素 @since 3.1.0 """ return findOne(collection, new Filter<T>() { @Override public boolean accept(T t) { if (t instanceof Map) { final Map<?, ?> map = (Map<?, ?>) t; final Object value = map.get(fieldName); return ObjectUtil.equal(value, fieldValue); } // 普通Bean final Object value = ReflectUtil.getFieldValue(t, fieldName); return ObjectUtil.equal(value, fieldValue); } }); }
java
public static <T> T findOneByField(Iterable<T> collection, final String fieldName, final Object fieldValue) { return findOne(collection, new Filter<T>() { @Override public boolean accept(T t) { if (t instanceof Map) { final Map<?, ?> map = (Map<?, ?>) t; final Object value = map.get(fieldName); return ObjectUtil.equal(value, fieldValue); } // 普通Bean final Object value = ReflectUtil.getFieldValue(t, fieldName); return ObjectUtil.equal(value, fieldValue); } }); }
[ "public", "static", "<", "T", ">", "T", "findOneByField", "(", "Iterable", "<", "T", ">", "collection", ",", "final", "String", "fieldName", ",", "final", "Object", "fieldValue", ")", "{", "return", "findOne", "(", "collection", ",", "new", "Filter", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "T", "t", ")", "{", "if", "(", "t", "instanceof", "Map", ")", "{", "final", "Map", "<", "?", ",", "?", ">", "map", "=", "(", "Map", "<", "?", ",", "?", ">", ")", "t", ";", "final", "Object", "value", "=", "map", ".", "get", "(", "fieldName", ")", ";", "return", "ObjectUtil", ".", "equal", "(", "value", ",", "fieldValue", ")", ";", "}", "// 普通Bean\r", "final", "Object", "value", "=", "ReflectUtil", ".", "getFieldValue", "(", "t", ",", "fieldName", ")", ";", "return", "ObjectUtil", ".", "equal", "(", "value", ",", "fieldValue", ")", ";", "}", "}", ")", ";", "}" ]
查找第一个匹配元素对象<br> 如果集合元素是Map,则比对键和值是否相同,相同则返回<br> 如果为普通Bean,则通过反射比对元素字段名对应的字段值是否相同,相同则返回<br> 如果给定字段值参数是{@code null} 且元素对象中的字段值也为{@code null}则认为相同 @param <T> 集合元素类型 @param collection 集合,集合元素可以是Bean或者Map @param fieldName 集合元素对象的字段名或map的键 @param fieldValue 集合元素对象的字段值或map的值 @return 满足条件的第一个元素 @since 3.1.0
[ "查找第一个匹配元素对象<br", ">", "如果集合元素是Map,则比对键和值是否相同,相同则返回<br", ">", "如果为普通Bean,则通过反射比对元素字段名对应的字段值是否相同,相同则返回<br", ">", "如果给定字段值参数是", "{", "@code", "null", "}", "且元素对象中的字段值也为", "{", "@code", "null", "}", "则认为相同" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1235-L1250
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getFormBeanName
public static String getFormBeanName( Class formBeanClass, HttpServletRequest request ) { """ Get the name for an ActionForm type. Use a name looked up from the current Struts module, or, if none is found, create one. @param formBeanClass the ActionForm-derived class whose type will determine the name. @param request the current HttpServletRequest, which contains a reference to the current Struts module. @return the name found in the Struts module, or, if none is found, a name that is either: <ul> <li>a camel-cased version of the base class name (minus any package or outer-class qualifiers, or, if that name is already taken,</li> <li>the full class name, with '.' and '$' replaced by '_'.</li> </ul> """ ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request ); List/*< String >*/ names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig ); if ( names != null ) { assert names.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list return ( String ) names.get( 0 ); } return generateFormBeanName( formBeanClass, request ); }
java
public static String getFormBeanName( Class formBeanClass, HttpServletRequest request ) { ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request ); List/*< String >*/ names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig ); if ( names != null ) { assert names.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list return ( String ) names.get( 0 ); } return generateFormBeanName( formBeanClass, request ); }
[ "public", "static", "String", "getFormBeanName", "(", "Class", "formBeanClass", ",", "HttpServletRequest", "request", ")", "{", "ModuleConfig", "moduleConfig", "=", "RequestUtils", ".", "getRequestModuleConfig", "(", "request", ")", ";", "List", "/*< String >*/", "names", "=", "getFormNamesFromModuleConfig", "(", "formBeanClass", ".", "getName", "(", ")", ",", "moduleConfig", ")", ";", "if", "(", "names", "!=", "null", ")", "{", "assert", "names", ".", "size", "(", ")", ">", "0", ";", "// getFormNamesFromModuleConfig returns null or a nonempty list", "return", "(", "String", ")", "names", ".", "get", "(", "0", ")", ";", "}", "return", "generateFormBeanName", "(", "formBeanClass", ",", "request", ")", ";", "}" ]
Get the name for an ActionForm type. Use a name looked up from the current Struts module, or, if none is found, create one. @param formBeanClass the ActionForm-derived class whose type will determine the name. @param request the current HttpServletRequest, which contains a reference to the current Struts module. @return the name found in the Struts module, or, if none is found, a name that is either: <ul> <li>a camel-cased version of the base class name (minus any package or outer-class qualifiers, or, if that name is already taken,</li> <li>the full class name, with '.' and '$' replaced by '_'.</li> </ul>
[ "Get", "the", "name", "for", "an", "ActionForm", "type", ".", "Use", "a", "name", "looked", "up", "from", "the", "current", "Struts", "module", "or", "if", "none", "is", "found", "create", "one", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L733-L745
apereo/cas
support/cas-server-support-oauth-uma-core/src/main/java/org/apereo/cas/uma/web/controllers/BaseUmaEndpointController.java
BaseUmaEndpointController.getAuthenticatedProfile
protected CommonProfile getAuthenticatedProfile(final HttpServletRequest request, final HttpServletResponse response, final String requiredPermission) { """ Gets authenticated profile. @param request the request @param response the response @param requiredPermission the required permission @return the authenticated profile """ val context = new J2EContext(request, response, getUmaConfigurationContext().getSessionStore()); val manager = new ProfileManager<>(context, context.getSessionStore()); val profile = manager.get(true).orElse(null); if (profile == null) { throw new AuthenticationException("Unable to locate authenticated profile"); } if (!profile.getPermissions().contains(requiredPermission)) { throw new AuthenticationException("Authenticated profile does not carry the UMA protection scope"); } return profile; }
java
protected CommonProfile getAuthenticatedProfile(final HttpServletRequest request, final HttpServletResponse response, final String requiredPermission) { val context = new J2EContext(request, response, getUmaConfigurationContext().getSessionStore()); val manager = new ProfileManager<>(context, context.getSessionStore()); val profile = manager.get(true).orElse(null); if (profile == null) { throw new AuthenticationException("Unable to locate authenticated profile"); } if (!profile.getPermissions().contains(requiredPermission)) { throw new AuthenticationException("Authenticated profile does not carry the UMA protection scope"); } return profile; }
[ "protected", "CommonProfile", "getAuthenticatedProfile", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ",", "final", "String", "requiredPermission", ")", "{", "val", "context", "=", "new", "J2EContext", "(", "request", ",", "response", ",", "getUmaConfigurationContext", "(", ")", ".", "getSessionStore", "(", ")", ")", ";", "val", "manager", "=", "new", "ProfileManager", "<>", "(", "context", ",", "context", ".", "getSessionStore", "(", ")", ")", ";", "val", "profile", "=", "manager", ".", "get", "(", "true", ")", ".", "orElse", "(", "null", ")", ";", "if", "(", "profile", "==", "null", ")", "{", "throw", "new", "AuthenticationException", "(", "\"Unable to locate authenticated profile\"", ")", ";", "}", "if", "(", "!", "profile", ".", "getPermissions", "(", ")", ".", "contains", "(", "requiredPermission", ")", ")", "{", "throw", "new", "AuthenticationException", "(", "\"Authenticated profile does not carry the UMA protection scope\"", ")", ";", "}", "return", "profile", ";", "}" ]
Gets authenticated profile. @param request the request @param response the response @param requiredPermission the required permission @return the authenticated profile
[ "Gets", "authenticated", "profile", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-uma-core/src/main/java/org/apereo/cas/uma/web/controllers/BaseUmaEndpointController.java#L47-L60
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java
SchemaBuilder.createType
@NonNull public static CreateTypeStart createType( @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier typeName) { """ Starts a CREATE TYPE query with the given type name for the given keyspace name. """ return new DefaultCreateType(keyspace, typeName); }
java
@NonNull public static CreateTypeStart createType( @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier typeName) { return new DefaultCreateType(keyspace, typeName); }
[ "@", "NonNull", "public", "static", "CreateTypeStart", "createType", "(", "@", "Nullable", "CqlIdentifier", "keyspace", ",", "@", "NonNull", "CqlIdentifier", "typeName", ")", "{", "return", "new", "DefaultCreateType", "(", "keyspace", ",", "typeName", ")", ";", "}" ]
Starts a CREATE TYPE query with the given type name for the given keyspace name.
[ "Starts", "a", "CREATE", "TYPE", "query", "with", "the", "given", "type", "name", "for", "the", "given", "keyspace", "name", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L330-L334
overturetool/overture
core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java
SyntaxReader.lastNameToken
protected LexNameToken lastNameToken() throws LexException, ParserException { """ Return the last token, converted to a {@link LexNameToken}. If the last token is not a name token, or an identifier token that can be converted to a name, an exception is thrown with the message passed in. @return The last token as a LexIdentifierToken. @throws LexException @throws ParserException """ LexToken tok = reader.getLast(); if (tok instanceof LexNameToken) { LexNameToken name = (LexNameToken) tok; if (name.old) { throwMessage(2295, "Can't use old name here", tok); } return name; } else if (tok instanceof LexIdentifierToken) { LexIdentifierToken id = (LexIdentifierToken) tok; if (id.isOld()) { throwMessage(2295, "Can't use old name here", tok); } return new LexNameToken(reader.currentModule, id); } throwMessage(2059, "Expecting a name"); return null; }
java
protected LexNameToken lastNameToken() throws LexException, ParserException { LexToken tok = reader.getLast(); if (tok instanceof LexNameToken) { LexNameToken name = (LexNameToken) tok; if (name.old) { throwMessage(2295, "Can't use old name here", tok); } return name; } else if (tok instanceof LexIdentifierToken) { LexIdentifierToken id = (LexIdentifierToken) tok; if (id.isOld()) { throwMessage(2295, "Can't use old name here", tok); } return new LexNameToken(reader.currentModule, id); } throwMessage(2059, "Expecting a name"); return null; }
[ "protected", "LexNameToken", "lastNameToken", "(", ")", "throws", "LexException", ",", "ParserException", "{", "LexToken", "tok", "=", "reader", ".", "getLast", "(", ")", ";", "if", "(", "tok", "instanceof", "LexNameToken", ")", "{", "LexNameToken", "name", "=", "(", "LexNameToken", ")", "tok", ";", "if", "(", "name", ".", "old", ")", "{", "throwMessage", "(", "2295", ",", "\"Can't use old name here\"", ",", "tok", ")", ";", "}", "return", "name", ";", "}", "else", "if", "(", "tok", "instanceof", "LexIdentifierToken", ")", "{", "LexIdentifierToken", "id", "=", "(", "LexIdentifierToken", ")", "tok", ";", "if", "(", "id", ".", "isOld", "(", ")", ")", "{", "throwMessage", "(", "2295", ",", "\"Can't use old name here\"", ",", "tok", ")", ";", "}", "return", "new", "LexNameToken", "(", "reader", ".", "currentModule", ",", "id", ")", ";", "}", "throwMessage", "(", "2059", ",", "\"Expecting a name\"", ")", ";", "return", "null", ";", "}" ]
Return the last token, converted to a {@link LexNameToken}. If the last token is not a name token, or an identifier token that can be converted to a name, an exception is thrown with the message passed in. @return The last token as a LexIdentifierToken. @throws LexException @throws ParserException
[ "Return", "the", "last", "token", "converted", "to", "a", "{", "@link", "LexNameToken", "}", ".", "If", "the", "last", "token", "is", "not", "a", "name", "token", "or", "an", "identifier", "token", "that", "can", "be", "converted", "to", "a", "name", "an", "exception", "is", "thrown", "with", "the", "message", "passed", "in", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java#L211-L239
HubSpot/Singularity
SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java
SingularityClient.deleteSingularityRequest
public Optional<SingularityRequest> deleteSingularityRequest(String requestId, Optional<SingularityDeleteRequestRequest> deleteRequest) { """ Delete a singularity request. If the deletion is successful the singularity request is moved to a DELETING state and is returned. If the request to be deleted is not found {code Optional.absent()} is returned If an error occurs during deletion an exception is returned @param requestId the id of the singularity request to delete @return the singularity request that has been moved to deleting """ final Function<String, String> requestUri = (host) -> String.format(REQUEST_DELETE_ACTIVE_FORMAT, getApiBase(host), requestId); return delete(requestUri, "active request", requestId, deleteRequest, Optional.of(SingularityRequest.class)); }
java
public Optional<SingularityRequest> deleteSingularityRequest(String requestId, Optional<SingularityDeleteRequestRequest> deleteRequest) { final Function<String, String> requestUri = (host) -> String.format(REQUEST_DELETE_ACTIVE_FORMAT, getApiBase(host), requestId); return delete(requestUri, "active request", requestId, deleteRequest, Optional.of(SingularityRequest.class)); }
[ "public", "Optional", "<", "SingularityRequest", ">", "deleteSingularityRequest", "(", "String", "requestId", ",", "Optional", "<", "SingularityDeleteRequestRequest", ">", "deleteRequest", ")", "{", "final", "Function", "<", "String", ",", "String", ">", "requestUri", "=", "(", "host", ")", "-", ">", "String", ".", "format", "(", "REQUEST_DELETE_ACTIVE_FORMAT", ",", "getApiBase", "(", "host", ")", ",", "requestId", ")", ";", "return", "delete", "(", "requestUri", ",", "\"active request\"", ",", "requestId", ",", "deleteRequest", ",", "Optional", ".", "of", "(", "SingularityRequest", ".", "class", ")", ")", ";", "}" ]
Delete a singularity request. If the deletion is successful the singularity request is moved to a DELETING state and is returned. If the request to be deleted is not found {code Optional.absent()} is returned If an error occurs during deletion an exception is returned @param requestId the id of the singularity request to delete @return the singularity request that has been moved to deleting
[ "Delete", "a", "singularity", "request", ".", "If", "the", "deletion", "is", "successful", "the", "singularity", "request", "is", "moved", "to", "a", "DELETING", "state", "and", "is", "returned", ".", "If", "the", "request", "to", "be", "deleted", "is", "not", "found", "{", "code", "Optional", ".", "absent", "()", "}", "is", "returned", "If", "an", "error", "occurs", "during", "deletion", "an", "exception", "is", "returned" ]
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L619-L623
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.normalSheet2Excel
public void normalSheet2Excel(List<NormalSheetWrapper> sheetWrappers, String templatePath, String targetPath) throws Excel4JException { """ 基于Excel模板与注解{@link com.github.crab2died.annotation.ExcelField}导出多sheet的Excel @param sheetWrappers sheet包装类 @param templatePath Excel模板路径 @param targetPath 导出Excel文件路径 @throws Excel4JException 异常 """ try (SheetTemplate sheetTemplate = exportExcelByModuleHandler(templatePath, sheetWrappers)) { sheetTemplate.write2File(targetPath); } catch (IOException e) { throw new Excel4JException(e); } }
java
public void normalSheet2Excel(List<NormalSheetWrapper> sheetWrappers, String templatePath, String targetPath) throws Excel4JException { try (SheetTemplate sheetTemplate = exportExcelByModuleHandler(templatePath, sheetWrappers)) { sheetTemplate.write2File(targetPath); } catch (IOException e) { throw new Excel4JException(e); } }
[ "public", "void", "normalSheet2Excel", "(", "List", "<", "NormalSheetWrapper", ">", "sheetWrappers", ",", "String", "templatePath", ",", "String", "targetPath", ")", "throws", "Excel4JException", "{", "try", "(", "SheetTemplate", "sheetTemplate", "=", "exportExcelByModuleHandler", "(", "templatePath", ",", "sheetWrappers", ")", ")", "{", "sheetTemplate", ".", "write2File", "(", "targetPath", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "Excel4JException", "(", "e", ")", ";", "}", "}" ]
基于Excel模板与注解{@link com.github.crab2died.annotation.ExcelField}导出多sheet的Excel @param sheetWrappers sheet包装类 @param templatePath Excel模板路径 @param targetPath 导出Excel文件路径 @throws Excel4JException 异常
[ "基于Excel模板与注解", "{", "@link", "com", ".", "github", ".", "crab2died", ".", "annotation", ".", "ExcelField", "}", "导出多sheet的Excel" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L634-L642
ujmp/universal-java-matrix-package
ujmp-core/src/main/java/org/ujmp/core/util/EuclidianDistance.java
EuclidianDistance.getDistance
public double getDistance(double[] sample1, double[] sample2) throws IllegalArgumentException { """ Get the distance between two data samples. @param sample1 the first sample of <code>double</code> values @param sample2 the second sample of <code>double</code> values @return the distance between <code>sample1</code> and <code>sample2</code> @throws IllegalArgumentException if the two samples contain different amounts of values """ int n = sample1.length; if (n != sample2.length || n < 1) throw new IllegalArgumentException("Input arrays must have the same length."); double sumOfSquares = 0; for (int i = 0; i < n; i++) { if (Double.isNaN(sample1[i]) || Double.isNaN(sample2[i])) continue; sumOfSquares += (sample1[i] - sample2[i]) * (sample1[i] - sample2[i]); } return Math.sqrt(sumOfSquares); }
java
public double getDistance(double[] sample1, double[] sample2) throws IllegalArgumentException { int n = sample1.length; if (n != sample2.length || n < 1) throw new IllegalArgumentException("Input arrays must have the same length."); double sumOfSquares = 0; for (int i = 0; i < n; i++) { if (Double.isNaN(sample1[i]) || Double.isNaN(sample2[i])) continue; sumOfSquares += (sample1[i] - sample2[i]) * (sample1[i] - sample2[i]); } return Math.sqrt(sumOfSquares); }
[ "public", "double", "getDistance", "(", "double", "[", "]", "sample1", ",", "double", "[", "]", "sample2", ")", "throws", "IllegalArgumentException", "{", "int", "n", "=", "sample1", ".", "length", ";", "if", "(", "n", "!=", "sample2", ".", "length", "||", "n", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Input arrays must have the same length.\"", ")", ";", "double", "sumOfSquares", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "sample1", "[", "i", "]", ")", "||", "Double", ".", "isNaN", "(", "sample2", "[", "i", "]", ")", ")", "continue", ";", "sumOfSquares", "+=", "(", "sample1", "[", "i", "]", "-", "sample2", "[", "i", "]", ")", "*", "(", "sample1", "[", "i", "]", "-", "sample2", "[", "i", "]", ")", ";", "}", "return", "Math", ".", "sqrt", "(", "sumOfSquares", ")", ";", "}" ]
Get the distance between two data samples. @param sample1 the first sample of <code>double</code> values @param sample2 the second sample of <code>double</code> values @return the distance between <code>sample1</code> and <code>sample2</code> @throws IllegalArgumentException if the two samples contain different amounts of values
[ "Get", "the", "distance", "between", "two", "data", "samples", "." ]
train
https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/util/EuclidianDistance.java#L44-L59
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
ExtendedMessageFormat.parseFormatDescription
private String parseFormatDescription(final String pattern, final ParsePosition pos) { """ Parse the format component of a format element. @param pattern string to parse @param pos current parse position @return Format description String """ final int start = pos.getIndex(); seekNonWs(pattern, pos); final int text = pos.getIndex(); int depth = 1; for (; pos.getIndex() < pattern.length(); next(pos)) { switch (pattern.charAt(pos.getIndex())) { case START_FE: depth++; break; case END_FE: depth--; if (depth == 0) { return pattern.substring(text, pos.getIndex()); } break; case QUOTE: getQuotedString(pattern, pos); break; default: break; } } throw new IllegalArgumentException( "Unterminated format element at position " + start); }
java
private String parseFormatDescription(final String pattern, final ParsePosition pos) { final int start = pos.getIndex(); seekNonWs(pattern, pos); final int text = pos.getIndex(); int depth = 1; for (; pos.getIndex() < pattern.length(); next(pos)) { switch (pattern.charAt(pos.getIndex())) { case START_FE: depth++; break; case END_FE: depth--; if (depth == 0) { return pattern.substring(text, pos.getIndex()); } break; case QUOTE: getQuotedString(pattern, pos); break; default: break; } } throw new IllegalArgumentException( "Unterminated format element at position " + start); }
[ "private", "String", "parseFormatDescription", "(", "final", "String", "pattern", ",", "final", "ParsePosition", "pos", ")", "{", "final", "int", "start", "=", "pos", ".", "getIndex", "(", ")", ";", "seekNonWs", "(", "pattern", ",", "pos", ")", ";", "final", "int", "text", "=", "pos", ".", "getIndex", "(", ")", ";", "int", "depth", "=", "1", ";", "for", "(", ";", "pos", ".", "getIndex", "(", ")", "<", "pattern", ".", "length", "(", ")", ";", "next", "(", "pos", ")", ")", "{", "switch", "(", "pattern", ".", "charAt", "(", "pos", ".", "getIndex", "(", ")", ")", ")", "{", "case", "START_FE", ":", "depth", "++", ";", "break", ";", "case", "END_FE", ":", "depth", "--", ";", "if", "(", "depth", "==", "0", ")", "{", "return", "pattern", ".", "substring", "(", "text", ",", "pos", ".", "getIndex", "(", ")", ")", ";", "}", "break", ";", "case", "QUOTE", ":", "getQuotedString", "(", "pattern", ",", "pos", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "\"Unterminated format element at position \"", "+", "start", ")", ";", "}" ]
Parse the format component of a format element. @param pattern string to parse @param pos current parse position @return Format description String
[ "Parse", "the", "format", "component", "of", "a", "format", "element", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java#L372-L397
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java
Whitebox.setInternalStateFromContext
public static void setInternalStateFromContext(Object instance, Object context, Object... additionalContexts) { """ Set the values of multiple instance fields defined in a context using reflection. The values in the context will be assigned to values on the {@code instance}. This method will traverse the class hierarchy when searching for the fields. Example usage: <p> Given: <pre> public class MyContext { private String myString = &quot;myString&quot;; protected int myInt = 9; } public class MyInstance { private String myInstanceString; private int myInstanceInt; } </pre> then <pre> Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext()); </pre> will set the instance variables of {@code myInstance} to the values specified in {@code MyContext}. <p> By default the {@link FieldMatchingStrategy#MATCHING} strategy is used which means that the fields defined in the context but not found in the <code>classOrInstance</code> are silently ignored. @param instance the object whose fields to modify. @param context The context where the fields are defined. @param additionalContexts Optionally more additional contexts. """ WhiteboxImpl.setInternalStateFromContext(instance, context, additionalContexts); }
java
public static void setInternalStateFromContext(Object instance, Object context, Object... additionalContexts) { WhiteboxImpl.setInternalStateFromContext(instance, context, additionalContexts); }
[ "public", "static", "void", "setInternalStateFromContext", "(", "Object", "instance", ",", "Object", "context", ",", "Object", "...", "additionalContexts", ")", "{", "WhiteboxImpl", ".", "setInternalStateFromContext", "(", "instance", ",", "context", ",", "additionalContexts", ")", ";", "}" ]
Set the values of multiple instance fields defined in a context using reflection. The values in the context will be assigned to values on the {@code instance}. This method will traverse the class hierarchy when searching for the fields. Example usage: <p> Given: <pre> public class MyContext { private String myString = &quot;myString&quot;; protected int myInt = 9; } public class MyInstance { private String myInstanceString; private int myInstanceInt; } </pre> then <pre> Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext()); </pre> will set the instance variables of {@code myInstance} to the values specified in {@code MyContext}. <p> By default the {@link FieldMatchingStrategy#MATCHING} strategy is used which means that the fields defined in the context but not found in the <code>classOrInstance</code> are silently ignored. @param instance the object whose fields to modify. @param context The context where the fields are defined. @param additionalContexts Optionally more additional contexts.
[ "Set", "the", "values", "of", "multiple", "instance", "fields", "defined", "in", "a", "context", "using", "reflection", ".", "The", "values", "in", "the", "context", "will", "be", "assigned", "to", "values", "on", "the", "{", "@code", "instance", "}", ".", "This", "method", "will", "traverse", "the", "class", "hierarchy", "when", "searching", "for", "the", "fields", ".", "Example", "usage", ":", "<p", ">", "Given", ":" ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L733-L735
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java
br_broker.force_reboot
public static br_broker force_reboot(nitro_service client, br_broker resource) throws Exception { """ Use this operation to force reboot Unified Repeater Instance. """ return ((br_broker[]) resource.perform_operation(client, "force_reboot"))[0]; }
java
public static br_broker force_reboot(nitro_service client, br_broker resource) throws Exception { return ((br_broker[]) resource.perform_operation(client, "force_reboot"))[0]; }
[ "public", "static", "br_broker", "force_reboot", "(", "nitro_service", "client", ",", "br_broker", "resource", ")", "throws", "Exception", "{", "return", "(", "(", "br_broker", "[", "]", ")", "resource", ".", "perform_operation", "(", "client", ",", "\"force_reboot\"", ")", ")", "[", "0", "]", ";", "}" ]
Use this operation to force reboot Unified Repeater Instance.
[ "Use", "this", "operation", "to", "force", "reboot", "Unified", "Repeater", "Instance", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L411-L414
jenkinsci/jenkins
core/src/main/java/hudson/Util.java
Util.deleteRecursive
@Restricted(NoExternalUse.class) public static void deleteRecursive(@Nonnull Path dir, @Nonnull PathRemover.PathChecker pathChecker) throws IOException { """ Deletes the given directory and contents recursively using a filter. @param dir a directory to delete @param pathChecker a security check to validate a path before deleting @throws IOException if the operation fails """ newPathRemover(pathChecker).forceRemoveRecursive(dir); }
java
@Restricted(NoExternalUse.class) public static void deleteRecursive(@Nonnull Path dir, @Nonnull PathRemover.PathChecker pathChecker) throws IOException { newPathRemover(pathChecker).forceRemoveRecursive(dir); }
[ "@", "Restricted", "(", "NoExternalUse", ".", "class", ")", "public", "static", "void", "deleteRecursive", "(", "@", "Nonnull", "Path", "dir", ",", "@", "Nonnull", "PathRemover", ".", "PathChecker", "pathChecker", ")", "throws", "IOException", "{", "newPathRemover", "(", "pathChecker", ")", ".", "forceRemoveRecursive", "(", "dir", ")", ";", "}" ]
Deletes the given directory and contents recursively using a filter. @param dir a directory to delete @param pathChecker a security check to validate a path before deleting @throws IOException if the operation fails
[ "Deletes", "the", "given", "directory", "and", "contents", "recursively", "using", "a", "filter", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L291-L294
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/DistributionUtils.java
DistributionUtils.checkSuccess
private static boolean checkSuccess(HttpResponse response, boolean dryRun, TaskListener listener) { """ Checks the status of promotion response and return true on success @param response @param dryRun @param listener @return """ StatusLine status = response.getStatusLine(); String content = ""; try { content = ExtractorUtils.entityToString(response.getEntity()); ExtractorUtils.validateStringNotBlank(content); JSONObject json = JSONObject.fromObject(content); String message = json.getString("message"); if (assertResponseStatus(dryRun, listener, status, message)) { listener.getLogger().println(message); return true; } } catch (IOException e) { String parsingErrorStr = "Failed parsing distribution response"; if (StringUtils.isNotBlank(content)) { parsingErrorStr = ": " + content; } e.printStackTrace(listener.error(parsingErrorStr)); } return false; }
java
private static boolean checkSuccess(HttpResponse response, boolean dryRun, TaskListener listener) { StatusLine status = response.getStatusLine(); String content = ""; try { content = ExtractorUtils.entityToString(response.getEntity()); ExtractorUtils.validateStringNotBlank(content); JSONObject json = JSONObject.fromObject(content); String message = json.getString("message"); if (assertResponseStatus(dryRun, listener, status, message)) { listener.getLogger().println(message); return true; } } catch (IOException e) { String parsingErrorStr = "Failed parsing distribution response"; if (StringUtils.isNotBlank(content)) { parsingErrorStr = ": " + content; } e.printStackTrace(listener.error(parsingErrorStr)); } return false; }
[ "private", "static", "boolean", "checkSuccess", "(", "HttpResponse", "response", ",", "boolean", "dryRun", ",", "TaskListener", "listener", ")", "{", "StatusLine", "status", "=", "response", ".", "getStatusLine", "(", ")", ";", "String", "content", "=", "\"\"", ";", "try", "{", "content", "=", "ExtractorUtils", ".", "entityToString", "(", "response", ".", "getEntity", "(", ")", ")", ";", "ExtractorUtils", ".", "validateStringNotBlank", "(", "content", ")", ";", "JSONObject", "json", "=", "JSONObject", ".", "fromObject", "(", "content", ")", ";", "String", "message", "=", "json", ".", "getString", "(", "\"message\"", ")", ";", "if", "(", "assertResponseStatus", "(", "dryRun", ",", "listener", ",", "status", ",", "message", ")", ")", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "message", ")", ";", "return", "true", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "String", "parsingErrorStr", "=", "\"Failed parsing distribution response\"", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "content", ")", ")", "{", "parsingErrorStr", "=", "\": \"", "+", "content", ";", "}", "e", ".", "printStackTrace", "(", "listener", ".", "error", "(", "parsingErrorStr", ")", ")", ";", "}", "return", "false", ";", "}" ]
Checks the status of promotion response and return true on success @param response @param dryRun @param listener @return
[ "Checks", "the", "status", "of", "promotion", "response", "and", "return", "true", "on", "success" ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/DistributionUtils.java#L61-L81
VoltDB/voltdb
src/frontend/org/voltdb/jni/ExecutionEngine.java
ExecutionEngine.endStatsCollection
protected void endStatsCollection(long cacheSize, CacheUse cacheUse) { """ Finalize collected statistics (stops timer and supplies cache statistics). @param cacheSize size of cache @param cacheUse where the plan came from """ if (m_plannerStats != null) { m_plannerStats.endStatsCollection(cacheSize, 0, cacheUse, m_partitionId); } }
java
protected void endStatsCollection(long cacheSize, CacheUse cacheUse) { if (m_plannerStats != null) { m_plannerStats.endStatsCollection(cacheSize, 0, cacheUse, m_partitionId); } }
[ "protected", "void", "endStatsCollection", "(", "long", "cacheSize", ",", "CacheUse", "cacheUse", ")", "{", "if", "(", "m_plannerStats", "!=", "null", ")", "{", "m_plannerStats", ".", "endStatsCollection", "(", "cacheSize", ",", "0", ",", "cacheUse", ",", "m_partitionId", ")", ";", "}", "}" ]
Finalize collected statistics (stops timer and supplies cache statistics). @param cacheSize size of cache @param cacheUse where the plan came from
[ "Finalize", "collected", "statistics", "(", "stops", "timer", "and", "supplies", "cache", "statistics", ")", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jni/ExecutionEngine.java#L1253-L1257
johnkil/Android-RobotoTextView
robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java
RobotoTypefaces.setUpTypeface
public static void setUpTypeface(@NonNull Paint paint, @NonNull Typeface typeface) { """ Set up typeface for Paint. Wrapper over {@link Paint#setTypeface(Typeface)} for making the font anti-aliased. @param paint The paint @param typeface The specify typeface """ paint.setFlags(paint.getFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); paint.setTypeface(typeface); }
java
public static void setUpTypeface(@NonNull Paint paint, @NonNull Typeface typeface) { paint.setFlags(paint.getFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); paint.setTypeface(typeface); }
[ "public", "static", "void", "setUpTypeface", "(", "@", "NonNull", "Paint", "paint", ",", "@", "NonNull", "Typeface", "typeface", ")", "{", "paint", ".", "setFlags", "(", "paint", ".", "getFlags", "(", ")", "|", "Paint", ".", "ANTI_ALIAS_FLAG", "|", "Paint", ".", "SUBPIXEL_TEXT_FLAG", ")", ";", "paint", ".", "setTypeface", "(", "typeface", ")", ";", "}" ]
Set up typeface for Paint. Wrapper over {@link Paint#setTypeface(Typeface)} for making the font anti-aliased. @param paint The paint @param typeface The specify typeface
[ "Set", "up", "typeface", "for", "Paint", ".", "Wrapper", "over", "{", "@link", "Paint#setTypeface", "(", "Typeface", ")", "}", "for", "making", "the", "font", "anti", "-", "aliased", "." ]
train
https://github.com/johnkil/Android-RobotoTextView/blob/1341602f16c08057dddd193411e7dab96f963b77/robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java#L561-L564
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/LPAAddParameter.java
LPAAddParameter.addParameterChild
static void addParameterChild(Element node, String name, String value) { """ Performs parameter child element creation in the passed in Element. @param node the parent node in which to create the parameter. @param name the name of the parameter to be created. @param value the value of the parameter to be created. """ if (node != null) { Document doc = node.getOwnerDocument(); Element parm = doc.createElement(Constants.ELM_PARAMETER); parm.setAttribute(Constants.ATT_NAME, name); parm.setAttribute(Constants.ATT_VALUE, value); /* * Set the override attribute to 'yes'. This isn't persisted since * this is determined upon loading the layout based upon the * channel definition. But for code that references this in-memory * value like ChannelStaticData it needs to be set. */ parm.setAttribute(Constants.ATT_OVERRIDE, Constants.CAN_OVERRIDE); node.appendChild(parm); } }
java
static void addParameterChild(Element node, String name, String value) { if (node != null) { Document doc = node.getOwnerDocument(); Element parm = doc.createElement(Constants.ELM_PARAMETER); parm.setAttribute(Constants.ATT_NAME, name); parm.setAttribute(Constants.ATT_VALUE, value); /* * Set the override attribute to 'yes'. This isn't persisted since * this is determined upon loading the layout based upon the * channel definition. But for code that references this in-memory * value like ChannelStaticData it needs to be set. */ parm.setAttribute(Constants.ATT_OVERRIDE, Constants.CAN_OVERRIDE); node.appendChild(parm); } }
[ "static", "void", "addParameterChild", "(", "Element", "node", ",", "String", "name", ",", "String", "value", ")", "{", "if", "(", "node", "!=", "null", ")", "{", "Document", "doc", "=", "node", ".", "getOwnerDocument", "(", ")", ";", "Element", "parm", "=", "doc", ".", "createElement", "(", "Constants", ".", "ELM_PARAMETER", ")", ";", "parm", ".", "setAttribute", "(", "Constants", ".", "ATT_NAME", ",", "name", ")", ";", "parm", ".", "setAttribute", "(", "Constants", ".", "ATT_VALUE", ",", "value", ")", ";", "/*\n * Set the override attribute to 'yes'. This isn't persisted since\n * this is determined upon loading the layout based upon the\n * channel definition. But for code that references this in-memory\n * value like ChannelStaticData it needs to be set.\n */", "parm", ".", "setAttribute", "(", "Constants", ".", "ATT_OVERRIDE", ",", "Constants", ".", "CAN_OVERRIDE", ")", ";", "node", ".", "appendChild", "(", "parm", ")", ";", "}", "}" ]
Performs parameter child element creation in the passed in Element. @param node the parent node in which to create the parameter. @param name the name of the parameter to be created. @param value the value of the parameter to be created.
[ "Performs", "parameter", "child", "element", "creation", "in", "the", "passed", "in", "Element", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/LPAAddParameter.java#L65-L80
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/io/AccumuloPageSink.java
AccumuloPageSink.toMutation
public static Mutation toMutation(Row row, int rowIdOrdinal, List<AccumuloColumnHandle> columns, AccumuloRowSerializer serializer) { """ Converts a {@link Row} to an Accumulo mutation. @param row Row object @param rowIdOrdinal Ordinal in the list of columns that is the row ID. This isn't checked at all, so I hope you're right. Also, it is expected that the list of column handles is sorted in ordinal order. This is a very demanding function. @param columns All column handles for the Row, sorted by ordinal. @param serializer Instance of {@link AccumuloRowSerializer} used to encode the values of the row to the Mutation @return Mutation """ // Set our value to the row ID Text value = new Text(); Field rowField = row.getField(rowIdOrdinal); if (rowField.isNull()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Column mapped as the Accumulo row ID cannot be null"); } setText(rowField, value, serializer); // Iterate through all the column handles, setting the Mutation's columns Mutation mutation = new Mutation(value); // Store row ID in a special column mutation.put(ROW_ID_COLUMN, ROW_ID_COLUMN, new Value(value.copyBytes())); for (AccumuloColumnHandle columnHandle : columns) { // Skip the row ID ordinal if (columnHandle.getOrdinal() == rowIdOrdinal) { continue; } // If the value of the field is not null if (!row.getField(columnHandle.getOrdinal()).isNull()) { // Serialize the value to the text setText(row.getField(columnHandle.getOrdinal()), value, serializer); // And add the bytes to the Mutation mutation.put(columnHandle.getFamily().get(), columnHandle.getQualifier().get(), new Value(value.copyBytes())); } } return mutation; }
java
public static Mutation toMutation(Row row, int rowIdOrdinal, List<AccumuloColumnHandle> columns, AccumuloRowSerializer serializer) { // Set our value to the row ID Text value = new Text(); Field rowField = row.getField(rowIdOrdinal); if (rowField.isNull()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Column mapped as the Accumulo row ID cannot be null"); } setText(rowField, value, serializer); // Iterate through all the column handles, setting the Mutation's columns Mutation mutation = new Mutation(value); // Store row ID in a special column mutation.put(ROW_ID_COLUMN, ROW_ID_COLUMN, new Value(value.copyBytes())); for (AccumuloColumnHandle columnHandle : columns) { // Skip the row ID ordinal if (columnHandle.getOrdinal() == rowIdOrdinal) { continue; } // If the value of the field is not null if (!row.getField(columnHandle.getOrdinal()).isNull()) { // Serialize the value to the text setText(row.getField(columnHandle.getOrdinal()), value, serializer); // And add the bytes to the Mutation mutation.put(columnHandle.getFamily().get(), columnHandle.getQualifier().get(), new Value(value.copyBytes())); } } return mutation; }
[ "public", "static", "Mutation", "toMutation", "(", "Row", "row", ",", "int", "rowIdOrdinal", ",", "List", "<", "AccumuloColumnHandle", ">", "columns", ",", "AccumuloRowSerializer", "serializer", ")", "{", "// Set our value to the row ID", "Text", "value", "=", "new", "Text", "(", ")", ";", "Field", "rowField", "=", "row", ".", "getField", "(", "rowIdOrdinal", ")", ";", "if", "(", "rowField", ".", "isNull", "(", ")", ")", "{", "throw", "new", "PrestoException", "(", "INVALID_FUNCTION_ARGUMENT", ",", "\"Column mapped as the Accumulo row ID cannot be null\"", ")", ";", "}", "setText", "(", "rowField", ",", "value", ",", "serializer", ")", ";", "// Iterate through all the column handles, setting the Mutation's columns", "Mutation", "mutation", "=", "new", "Mutation", "(", "value", ")", ";", "// Store row ID in a special column", "mutation", ".", "put", "(", "ROW_ID_COLUMN", ",", "ROW_ID_COLUMN", ",", "new", "Value", "(", "value", ".", "copyBytes", "(", ")", ")", ")", ";", "for", "(", "AccumuloColumnHandle", "columnHandle", ":", "columns", ")", "{", "// Skip the row ID ordinal", "if", "(", "columnHandle", ".", "getOrdinal", "(", ")", "==", "rowIdOrdinal", ")", "{", "continue", ";", "}", "// If the value of the field is not null", "if", "(", "!", "row", ".", "getField", "(", "columnHandle", ".", "getOrdinal", "(", ")", ")", ".", "isNull", "(", ")", ")", "{", "// Serialize the value to the text", "setText", "(", "row", ".", "getField", "(", "columnHandle", ".", "getOrdinal", "(", ")", ")", ",", "value", ",", "serializer", ")", ";", "// And add the bytes to the Mutation", "mutation", ".", "put", "(", "columnHandle", ".", "getFamily", "(", ")", ".", "get", "(", ")", ",", "columnHandle", ".", "getQualifier", "(", ")", ".", "get", "(", ")", ",", "new", "Value", "(", "value", ".", "copyBytes", "(", ")", ")", ")", ";", "}", "}", "return", "mutation", ";", "}" ]
Converts a {@link Row} to an Accumulo mutation. @param row Row object @param rowIdOrdinal Ordinal in the list of columns that is the row ID. This isn't checked at all, so I hope you're right. Also, it is expected that the list of column handles is sorted in ordinal order. This is a very demanding function. @param columns All column handles for the Row, sorted by ordinal. @param serializer Instance of {@link AccumuloRowSerializer} used to encode the values of the row to the Mutation @return Mutation
[ "Converts", "a", "{", "@link", "Row", "}", "to", "an", "Accumulo", "mutation", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/io/AccumuloPageSink.java#L142-L175
grpc/grpc-java
api/src/main/java/io/grpc/ClientInterceptors.java
ClientInterceptors.wrapClientInterceptor
static <WReqT, WRespT> ClientInterceptor wrapClientInterceptor( final ClientInterceptor interceptor, final Marshaller<WReqT> reqMarshaller, final Marshaller<WRespT> respMarshaller) { """ Creates a new ClientInterceptor that transforms requests into {@code WReqT} and responses into {@code WRespT} before passing them into the {@code interceptor}. """ return new ClientInterceptor() { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall( final MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { final MethodDescriptor<WReqT, WRespT> wrappedMethod = method.toBuilder(reqMarshaller, respMarshaller).build(); final ClientCall<WReqT, WRespT> wrappedCall = interceptor.interceptCall(wrappedMethod, callOptions, next); return new PartialForwardingClientCall<ReqT, RespT>() { @Override public void start(final Listener<RespT> responseListener, Metadata headers) { wrappedCall.start(new PartialForwardingClientCallListener<WRespT>() { @Override public void onMessage(WRespT wMessage) { InputStream bytes = respMarshaller.stream(wMessage); RespT message = method.getResponseMarshaller().parse(bytes); responseListener.onMessage(message); } @Override protected Listener<?> delegate() { return responseListener; } }, headers); } @Override public void sendMessage(ReqT message) { InputStream bytes = method.getRequestMarshaller().stream(message); WReqT wReq = reqMarshaller.parse(bytes); wrappedCall.sendMessage(wReq); } @Override protected ClientCall<?, ?> delegate() { return wrappedCall; } }; } }; }
java
static <WReqT, WRespT> ClientInterceptor wrapClientInterceptor( final ClientInterceptor interceptor, final Marshaller<WReqT> reqMarshaller, final Marshaller<WRespT> respMarshaller) { return new ClientInterceptor() { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall( final MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { final MethodDescriptor<WReqT, WRespT> wrappedMethod = method.toBuilder(reqMarshaller, respMarshaller).build(); final ClientCall<WReqT, WRespT> wrappedCall = interceptor.interceptCall(wrappedMethod, callOptions, next); return new PartialForwardingClientCall<ReqT, RespT>() { @Override public void start(final Listener<RespT> responseListener, Metadata headers) { wrappedCall.start(new PartialForwardingClientCallListener<WRespT>() { @Override public void onMessage(WRespT wMessage) { InputStream bytes = respMarshaller.stream(wMessage); RespT message = method.getResponseMarshaller().parse(bytes); responseListener.onMessage(message); } @Override protected Listener<?> delegate() { return responseListener; } }, headers); } @Override public void sendMessage(ReqT message) { InputStream bytes = method.getRequestMarshaller().stream(message); WReqT wReq = reqMarshaller.parse(bytes); wrappedCall.sendMessage(wReq); } @Override protected ClientCall<?, ?> delegate() { return wrappedCall; } }; } }; }
[ "static", "<", "WReqT", ",", "WRespT", ">", "ClientInterceptor", "wrapClientInterceptor", "(", "final", "ClientInterceptor", "interceptor", ",", "final", "Marshaller", "<", "WReqT", ">", "reqMarshaller", ",", "final", "Marshaller", "<", "WRespT", ">", "respMarshaller", ")", "{", "return", "new", "ClientInterceptor", "(", ")", "{", "@", "Override", "public", "<", "ReqT", ",", "RespT", ">", "ClientCall", "<", "ReqT", ",", "RespT", ">", "interceptCall", "(", "final", "MethodDescriptor", "<", "ReqT", ",", "RespT", ">", "method", ",", "CallOptions", "callOptions", ",", "Channel", "next", ")", "{", "final", "MethodDescriptor", "<", "WReqT", ",", "WRespT", ">", "wrappedMethod", "=", "method", ".", "toBuilder", "(", "reqMarshaller", ",", "respMarshaller", ")", ".", "build", "(", ")", ";", "final", "ClientCall", "<", "WReqT", ",", "WRespT", ">", "wrappedCall", "=", "interceptor", ".", "interceptCall", "(", "wrappedMethod", ",", "callOptions", ",", "next", ")", ";", "return", "new", "PartialForwardingClientCall", "<", "ReqT", ",", "RespT", ">", "(", ")", "{", "@", "Override", "public", "void", "start", "(", "final", "Listener", "<", "RespT", ">", "responseListener", ",", "Metadata", "headers", ")", "{", "wrappedCall", ".", "start", "(", "new", "PartialForwardingClientCallListener", "<", "WRespT", ">", "(", ")", "{", "@", "Override", "public", "void", "onMessage", "(", "WRespT", "wMessage", ")", "{", "InputStream", "bytes", "=", "respMarshaller", ".", "stream", "(", "wMessage", ")", ";", "RespT", "message", "=", "method", ".", "getResponseMarshaller", "(", ")", ".", "parse", "(", "bytes", ")", ";", "responseListener", ".", "onMessage", "(", "message", ")", ";", "}", "@", "Override", "protected", "Listener", "<", "?", ">", "delegate", "(", ")", "{", "return", "responseListener", ";", "}", "}", ",", "headers", ")", ";", "}", "@", "Override", "public", "void", "sendMessage", "(", "ReqT", "message", ")", "{", "InputStream", "bytes", "=", "method", ".", "getRequestMarshaller", "(", ")", ".", "stream", "(", "message", ")", ";", "WReqT", "wReq", "=", "reqMarshaller", ".", "parse", "(", "bytes", ")", ";", "wrappedCall", ".", "sendMessage", "(", "wReq", ")", ";", "}", "@", "Override", "protected", "ClientCall", "<", "?", ",", "?", ">", "delegate", "(", ")", "{", "return", "wrappedCall", ";", "}", "}", ";", "}", "}", ";", "}" ]
Creates a new ClientInterceptor that transforms requests into {@code WReqT} and responses into {@code WRespT} before passing them into the {@code interceptor}.
[ "Creates", "a", "new", "ClientInterceptor", "that", "transforms", "requests", "into", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ClientInterceptors.java#L98-L142
UrielCh/ovh-java-sdk
ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java
ApiOvhEmailpro.service_account_email_sendAs_allowedAccountId_GET
public OvhAccountSendAs service_account_email_sendAs_allowedAccountId_GET(String service, String email, Long allowedAccountId) throws IOException { """ Get this object properties REST: GET /email/pro/{service}/account/{email}/sendAs/{allowedAccountId} @param service [required] The internal name of your pro organization @param email [required] Default email for this mailbox @param allowedAccountId [required] Account id to give send as API beta """ String qPath = "/email/pro/{service}/account/{email}/sendAs/{allowedAccountId}"; StringBuilder sb = path(qPath, service, email, allowedAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAccountSendAs.class); }
java
public OvhAccountSendAs service_account_email_sendAs_allowedAccountId_GET(String service, String email, Long allowedAccountId) throws IOException { String qPath = "/email/pro/{service}/account/{email}/sendAs/{allowedAccountId}"; StringBuilder sb = path(qPath, service, email, allowedAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAccountSendAs.class); }
[ "public", "OvhAccountSendAs", "service_account_email_sendAs_allowedAccountId_GET", "(", "String", "service", ",", "String", "email", ",", "Long", "allowedAccountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/pro/{service}/account/{email}/sendAs/{allowedAccountId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "service", ",", "email", ",", "allowedAccountId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhAccountSendAs", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/pro/{service}/account/{email}/sendAs/{allowedAccountId} @param service [required] The internal name of your pro organization @param email [required] Default email for this mailbox @param allowedAccountId [required] Account id to give send as API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L679-L684
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java
FeatureSearchServiceImpl.searchById
public void searchById(final FeaturesSupported layer, final String[] ids, final FeatureArrayCallback callback) { """ Search features within a certain layer, using the feature IDs. @param layer The features supported layer wherein to search. @param ids The unique IDs of the feature within the layer. @param callback Call-back method executed on return (when the feature has been found). """ Layer<?> gwtLayer = map.getMapWidget().getMapModel().getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { VectorLayer vLayer = (VectorLayer) gwtLayer; SearchCriterion[] criteria = new SearchCriterion[ids.length]; for (int i = 0; i < ids.length; i++) { criteria[i] = new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", ids[i]); } SearchFeatureRequest request = new SearchFeatureRequest(); request.setBooleanOperator("OR"); request.setCrs(map.getMapWidget().getMapModel().getCrs()); request.setLayerId(vLayer.getServerLayerId()); request.setMax(ids.length); request.setFilter(layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); request.setCriteria(criteria); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { if (response.getFeatures() != null && response.getFeatures().length > 0) { Feature[] features = new Feature[response.getFeatures().length]; for (int i = 0; i < response.getFeatures().length; i++) { features[i] = new FeatureImpl(response.getFeatures()[i], layer); } callback.execute(new FeatureArrayHolder(features)); } } }); } }
java
public void searchById(final FeaturesSupported layer, final String[] ids, final FeatureArrayCallback callback) { Layer<?> gwtLayer = map.getMapWidget().getMapModel().getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { VectorLayer vLayer = (VectorLayer) gwtLayer; SearchCriterion[] criteria = new SearchCriterion[ids.length]; for (int i = 0; i < ids.length; i++) { criteria[i] = new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", ids[i]); } SearchFeatureRequest request = new SearchFeatureRequest(); request.setBooleanOperator("OR"); request.setCrs(map.getMapWidget().getMapModel().getCrs()); request.setLayerId(vLayer.getServerLayerId()); request.setMax(ids.length); request.setFilter(layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); request.setCriteria(criteria); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { if (response.getFeatures() != null && response.getFeatures().length > 0) { Feature[] features = new Feature[response.getFeatures().length]; for (int i = 0; i < response.getFeatures().length; i++) { features[i] = new FeatureImpl(response.getFeatures()[i], layer); } callback.execute(new FeatureArrayHolder(features)); } } }); } }
[ "public", "void", "searchById", "(", "final", "FeaturesSupported", "layer", ",", "final", "String", "[", "]", "ids", ",", "final", "FeatureArrayCallback", "callback", ")", "{", "Layer", "<", "?", ">", "gwtLayer", "=", "map", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ".", "getLayer", "(", "layer", ".", "getId", "(", ")", ")", ";", "if", "(", "gwtLayer", "!=", "null", "&&", "gwtLayer", "instanceof", "VectorLayer", ")", "{", "VectorLayer", "vLayer", "=", "(", "VectorLayer", ")", "gwtLayer", ";", "SearchCriterion", "[", "]", "criteria", "=", "new", "SearchCriterion", "[", "ids", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ids", ".", "length", ";", "i", "++", ")", "{", "criteria", "[", "i", "]", "=", "new", "SearchCriterion", "(", "SearchFeatureRequest", ".", "ID_ATTRIBUTE", ",", "\"=\"", ",", "ids", "[", "i", "]", ")", ";", "}", "SearchFeatureRequest", "request", "=", "new", "SearchFeatureRequest", "(", ")", ";", "request", ".", "setBooleanOperator", "(", "\"OR\"", ")", ";", "request", ".", "setCrs", "(", "map", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(", ")", ".", "getCrs", "(", ")", ")", ";", "request", ".", "setLayerId", "(", "vLayer", ".", "getServerLayerId", "(", ")", ")", ";", "request", ".", "setMax", "(", "ids", ".", "length", ")", ";", "request", ".", "setFilter", "(", "layer", ".", "getFilter", "(", ")", ")", ";", "request", ".", "setFeatureIncludes", "(", "GeomajasConstant", ".", "FEATURE_INCLUDE_ALL", ")", ";", "request", ".", "setCriteria", "(", "criteria", ")", ";", "GwtCommand", "command", "=", "new", "GwtCommand", "(", "SearchFeatureRequest", ".", "COMMAND", ")", ";", "command", ".", "setCommandRequest", "(", "request", ")", ";", "GwtCommandDispatcher", ".", "getInstance", "(", ")", ".", "execute", "(", "command", ",", "new", "AbstractCommandCallback", "<", "SearchFeatureResponse", ">", "(", ")", "{", "public", "void", "execute", "(", "SearchFeatureResponse", "response", ")", "{", "if", "(", "response", ".", "getFeatures", "(", ")", "!=", "null", "&&", "response", ".", "getFeatures", "(", ")", ".", "length", ">", "0", ")", "{", "Feature", "[", "]", "features", "=", "new", "Feature", "[", "response", ".", "getFeatures", "(", ")", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "response", ".", "getFeatures", "(", ")", ".", "length", ";", "i", "++", ")", "{", "features", "[", "i", "]", "=", "new", "FeatureImpl", "(", "response", ".", "getFeatures", "(", ")", "[", "i", "]", ",", "layer", ")", ";", "}", "callback", ".", "execute", "(", "new", "FeatureArrayHolder", "(", "features", ")", ")", ";", "}", "}", "}", ")", ";", "}", "}" ]
Search features within a certain layer, using the feature IDs. @param layer The features supported layer wherein to search. @param ids The unique IDs of the feature within the layer. @param callback Call-back method executed on return (when the feature has been found).
[ "Search", "features", "within", "a", "certain", "layer", "using", "the", "feature", "IDs", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java#L71-L104
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java
BigtableClusterUtilities.setClusterSize
public void setClusterSize(String clusterId, String zoneId, int newSize) throws InterruptedException { """ Sets a cluster size to a specific size. @param clusterId @param zoneId @param newSize @throws InterruptedException if the cluster is in the middle of updating, and an interrupt was received """ setClusterSize(instanceName.toClusterName(clusterId).getClusterName(), newSize); }
java
public void setClusterSize(String clusterId, String zoneId, int newSize) throws InterruptedException { setClusterSize(instanceName.toClusterName(clusterId).getClusterName(), newSize); }
[ "public", "void", "setClusterSize", "(", "String", "clusterId", ",", "String", "zoneId", ",", "int", "newSize", ")", "throws", "InterruptedException", "{", "setClusterSize", "(", "instanceName", ".", "toClusterName", "(", "clusterId", ")", ".", "getClusterName", "(", ")", ",", "newSize", ")", ";", "}" ]
Sets a cluster size to a specific size. @param clusterId @param zoneId @param newSize @throws InterruptedException if the cluster is in the middle of updating, and an interrupt was received
[ "Sets", "a", "cluster", "size", "to", "a", "specific", "size", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java#L203-L206
bazaarvoice/emodb
sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/SplitFormat.java
SplitFormat.decode
static ByteBufferRange decode(String string) { """ Parses a hex string that looks like "commonPrefix:startSuffix-endSuffix". """ int prefix = string.indexOf(':'); int sep = string.indexOf('-', prefix + 1); checkArgument(prefix >= 0 && sep >= 0, "Invalid split string: %s", string); char[] start = new char[prefix + sep - (prefix + 1)]; string.getChars(0, prefix, start, 0); string.getChars(prefix + 1, sep, start, prefix); char[] end = new char[prefix + string.length() - (sep + 1)]; string.getChars(0, prefix, end, 0); string.getChars(sep + 1, string.length(), end, prefix); byte[] startBytes, endBytes; try { startBytes = Hex.decodeHex(start); endBytes = Hex.decodeHex(end); } catch (DecoderException e) { throw new IllegalArgumentException(format("Invalid split string: %s", string)); } return new ByteBufferRangeImpl(ByteBuffer.wrap(startBytes), ByteBuffer.wrap(endBytes), -1, false); }
java
static ByteBufferRange decode(String string) { int prefix = string.indexOf(':'); int sep = string.indexOf('-', prefix + 1); checkArgument(prefix >= 0 && sep >= 0, "Invalid split string: %s", string); char[] start = new char[prefix + sep - (prefix + 1)]; string.getChars(0, prefix, start, 0); string.getChars(prefix + 1, sep, start, prefix); char[] end = new char[prefix + string.length() - (sep + 1)]; string.getChars(0, prefix, end, 0); string.getChars(sep + 1, string.length(), end, prefix); byte[] startBytes, endBytes; try { startBytes = Hex.decodeHex(start); endBytes = Hex.decodeHex(end); } catch (DecoderException e) { throw new IllegalArgumentException(format("Invalid split string: %s", string)); } return new ByteBufferRangeImpl(ByteBuffer.wrap(startBytes), ByteBuffer.wrap(endBytes), -1, false); }
[ "static", "ByteBufferRange", "decode", "(", "String", "string", ")", "{", "int", "prefix", "=", "string", ".", "indexOf", "(", "'", "'", ")", ";", "int", "sep", "=", "string", ".", "indexOf", "(", "'", "'", ",", "prefix", "+", "1", ")", ";", "checkArgument", "(", "prefix", ">=", "0", "&&", "sep", ">=", "0", ",", "\"Invalid split string: %s\"", ",", "string", ")", ";", "char", "[", "]", "start", "=", "new", "char", "[", "prefix", "+", "sep", "-", "(", "prefix", "+", "1", ")", "]", ";", "string", ".", "getChars", "(", "0", ",", "prefix", ",", "start", ",", "0", ")", ";", "string", ".", "getChars", "(", "prefix", "+", "1", ",", "sep", ",", "start", ",", "prefix", ")", ";", "char", "[", "]", "end", "=", "new", "char", "[", "prefix", "+", "string", ".", "length", "(", ")", "-", "(", "sep", "+", "1", ")", "]", ";", "string", ".", "getChars", "(", "0", ",", "prefix", ",", "end", ",", "0", ")", ";", "string", ".", "getChars", "(", "sep", "+", "1", ",", "string", ".", "length", "(", ")", ",", "end", ",", "prefix", ")", ";", "byte", "[", "]", "startBytes", ",", "endBytes", ";", "try", "{", "startBytes", "=", "Hex", ".", "decodeHex", "(", "start", ")", ";", "endBytes", "=", "Hex", ".", "decodeHex", "(", "end", ")", ";", "}", "catch", "(", "DecoderException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"Invalid split string: %s\"", ",", "string", ")", ")", ";", "}", "return", "new", "ByteBufferRangeImpl", "(", "ByteBuffer", ".", "wrap", "(", "startBytes", ")", ",", "ByteBuffer", ".", "wrap", "(", "endBytes", ")", ",", "-", "1", ",", "false", ")", ";", "}" ]
Parses a hex string that looks like "commonPrefix:startSuffix-endSuffix".
[ "Parses", "a", "hex", "string", "that", "looks", "like", "commonPrefix", ":", "startSuffix", "-", "endSuffix", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/SplitFormat.java#L31-L53
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.completeMultipartUpload
public CompleteMultipartUploadResponse completeMultipartUpload(String bucketName, String key, String uploadId, List<PartETag> partETags) { """ Completes a multipart upload by assembling previously uploaded parts. @param bucketName The name of the bucket containing the multipart upload to complete. @param key The key of the multipart upload to complete. @param uploadId The ID of the multipart upload to complete. @param partETags The list of part numbers and ETags to use when completing the multipart upload. @return A CompleteMultipartUploadResponse from Bos containing the ETag for the new object composed of the individual parts. """ return this.completeMultipartUpload(new CompleteMultipartUploadRequest(bucketName, key, uploadId, partETags)); }
java
public CompleteMultipartUploadResponse completeMultipartUpload(String bucketName, String key, String uploadId, List<PartETag> partETags) { return this.completeMultipartUpload(new CompleteMultipartUploadRequest(bucketName, key, uploadId, partETags)); }
[ "public", "CompleteMultipartUploadResponse", "completeMultipartUpload", "(", "String", "bucketName", ",", "String", "key", ",", "String", "uploadId", ",", "List", "<", "PartETag", ">", "partETags", ")", "{", "return", "this", ".", "completeMultipartUpload", "(", "new", "CompleteMultipartUploadRequest", "(", "bucketName", ",", "key", ",", "uploadId", ",", "partETags", ")", ")", ";", "}" ]
Completes a multipart upload by assembling previously uploaded parts. @param bucketName The name of the bucket containing the multipart upload to complete. @param key The key of the multipart upload to complete. @param uploadId The ID of the multipart upload to complete. @param partETags The list of part numbers and ETags to use when completing the multipart upload. @return A CompleteMultipartUploadResponse from Bos containing the ETag for the new object composed of the individual parts.
[ "Completes", "a", "multipart", "upload", "by", "assembling", "previously", "uploaded", "parts", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1223-L1226
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsm.java
XsdAsm.generateAttributes
private void generateAttributes(List<XsdAttribute> attributeVariations, String apiName) { """ Generates attribute classes based on the received {@link List} of {@link XsdAttribute}. @param attributeVariations The {@link List} of {@link XsdAttribute} objects that serve as a base to class creation. @param apiName The name of the resulting fluent interface. """ attributeVariations.forEach(attributeVariation -> generateAttribute(attributeVariation, apiName)); }
java
private void generateAttributes(List<XsdAttribute> attributeVariations, String apiName) { attributeVariations.forEach(attributeVariation -> generateAttribute(attributeVariation, apiName)); }
[ "private", "void", "generateAttributes", "(", "List", "<", "XsdAttribute", ">", "attributeVariations", ",", "String", "apiName", ")", "{", "attributeVariations", ".", "forEach", "(", "attributeVariation", "->", "generateAttribute", "(", "attributeVariation", ",", "apiName", ")", ")", ";", "}" ]
Generates attribute classes based on the received {@link List} of {@link XsdAttribute}. @param attributeVariations The {@link List} of {@link XsdAttribute} objects that serve as a base to class creation. @param apiName The name of the resulting fluent interface.
[ "Generates", "attribute", "classes", "based", "on", "the", "received", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsm.java#L65-L67
wiibaker/robotframework-rest-java
src/main/java/org/wuokko/robot/restlib/JsonPathLibrary.java
JsonPathLibrary.jsonElementShouldMatch
@RobotKeyword public boolean jsonElementShouldMatch(String source, String jsonPath, Object value, String method, String data, String contentType) throws Exception { """ Checks if the given value matches the one found by the `jsonPath` from the `source`. Source can be either URI or the actual JSON content You can add optional method (ie GET, POST, PUT), data or content type as parameters. Method defaults to GET. Example: | Json Element Should Match | http://example.com/test.json | $.element.param | hello | | Json Element Should Match | { element: { param:hello } } | $.element.param | hello | | Json Element Should Match | { element: { param:hello } } | $.element.param | hello | POST | {hello: world} | application/json | """ boolean match = false; if (value == null) { throw new IllegalArgumentException("Given value was null"); } String found = String.valueOf(findJsonElement(source, jsonPath, method, data, contentType)); if (found.equals(value)) { System.out.println("*DEBUG* The values '" + found + "' and '" + value + "' did match"); match = true; } else { System.out.println("*ERROR* The values '" + found + "' and '" + value + "' did not match"); throw new JsonNotEqualException("The found value did not match, found '" + found + "', expected '" + value + "'"); } return match; }
java
@RobotKeyword public boolean jsonElementShouldMatch(String source, String jsonPath, Object value, String method, String data, String contentType) throws Exception { boolean match = false; if (value == null) { throw new IllegalArgumentException("Given value was null"); } String found = String.valueOf(findJsonElement(source, jsonPath, method, data, contentType)); if (found.equals(value)) { System.out.println("*DEBUG* The values '" + found + "' and '" + value + "' did match"); match = true; } else { System.out.println("*ERROR* The values '" + found + "' and '" + value + "' did not match"); throw new JsonNotEqualException("The found value did not match, found '" + found + "', expected '" + value + "'"); } return match; }
[ "@", "RobotKeyword", "public", "boolean", "jsonElementShouldMatch", "(", "String", "source", ",", "String", "jsonPath", ",", "Object", "value", ",", "String", "method", ",", "String", "data", ",", "String", "contentType", ")", "throws", "Exception", "{", "boolean", "match", "=", "false", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Given value was null\"", ")", ";", "}", "String", "found", "=", "String", ".", "valueOf", "(", "findJsonElement", "(", "source", ",", "jsonPath", ",", "method", ",", "data", ",", "contentType", ")", ")", ";", "if", "(", "found", ".", "equals", "(", "value", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"*DEBUG* The values '\"", "+", "found", "+", "\"' and '\"", "+", "value", "+", "\"' did match\"", ")", ";", "match", "=", "true", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"*ERROR* The values '\"", "+", "found", "+", "\"' and '\"", "+", "value", "+", "\"' did not match\"", ")", ";", "throw", "new", "JsonNotEqualException", "(", "\"The found value did not match, found '\"", "+", "found", "+", "\"', expected '\"", "+", "value", "+", "\"'\"", ")", ";", "}", "return", "match", ";", "}" ]
Checks if the given value matches the one found by the `jsonPath` from the `source`. Source can be either URI or the actual JSON content You can add optional method (ie GET, POST, PUT), data or content type as parameters. Method defaults to GET. Example: | Json Element Should Match | http://example.com/test.json | $.element.param | hello | | Json Element Should Match | { element: { param:hello } } | $.element.param | hello | | Json Element Should Match | { element: { param:hello } } | $.element.param | hello | POST | {hello: world} | application/json |
[ "Checks", "if", "the", "given", "value", "matches", "the", "one", "found", "by", "the", "jsonPath", "from", "the", "source", "." ]
train
https://github.com/wiibaker/robotframework-rest-java/blob/e30a7e494c143b644ee4282137a5a38e75d9d97b/src/main/java/org/wuokko/robot/restlib/JsonPathLibrary.java#L108-L128
stratosphere/stratosphere
stratosphere-clients/src/main/java/eu/stratosphere/client/web/JobSubmissionServlet.java
JobSubmissionServlet.checkParameterSet
private boolean checkParameterSet(HttpServletResponse resp, String parameter, String parameterName) throws IOException { """ Checks the given parameter. If it is null, it prints the error page. @param resp The response handler. @param parameter The parameter to check. @param parameterName The name of the parameter, to describe it in the error message. @return True, if the parameter is null, false otherwise. @throws IOException Thrown, if the error page could not be printed. """ if (parameter == null) { showErrorPage(resp, "The parameter '" + parameterName + "' is not set."); return true; } else { return false; } }
java
private boolean checkParameterSet(HttpServletResponse resp, String parameter, String parameterName) throws IOException { if (parameter == null) { showErrorPage(resp, "The parameter '" + parameterName + "' is not set."); return true; } else { return false; } }
[ "private", "boolean", "checkParameterSet", "(", "HttpServletResponse", "resp", ",", "String", "parameter", ",", "String", "parameterName", ")", "throws", "IOException", "{", "if", "(", "parameter", "==", "null", ")", "{", "showErrorPage", "(", "resp", ",", "\"The parameter '\"", "+", "parameterName", "+", "\"' is not set.\"", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Checks the given parameter. If it is null, it prints the error page. @param resp The response handler. @param parameter The parameter to check. @param parameterName The name of the parameter, to describe it in the error message. @return True, if the parameter is null, false otherwise. @throws IOException Thrown, if the error page could not be printed.
[ "Checks", "the", "given", "parameter", ".", "If", "it", "is", "null", "it", "prints", "the", "error", "page", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-clients/src/main/java/eu/stratosphere/client/web/JobSubmissionServlet.java#L388-L396
awslabs/amazon-sqs-java-extended-client-lib
src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedClientBase.java
AmazonSQSExtendedClientBase.sendMessage
public SendMessageResult sendMessage(String queueUrl, String messageBody) throws AmazonServiceException, AmazonClientException { """ <p> Delivers a message to the specified queue. With Amazon SQS, you now have the ability to send large payload messages that are up to 256KB (262,144 bytes) in size. To send large payloads, you must use an AWS SDK that supports SigV4 signing. To verify whether SigV4 is supported for an AWS SDK, check the SDK release notes. </p> <p> <b>IMPORTANT:</b> The following list shows the characters (in Unicode) allowed in your message, according to the W3C XML specification. For more information, go to http://www.w3.org/TR/REC-xml/#charsets If you send any characters not included in the list, your request will be rejected. #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF] </p> @param queueUrl The URL of the Amazon SQS queue to take action on. @param messageBody The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note. @return The response from the SendMessage service method, as returned by AmazonSQS. @throws InvalidMessageContentsException @throws UnsupportedOperationException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue. """ return amazonSqsToBeExtended.sendMessage(queueUrl, messageBody); }
java
public SendMessageResult sendMessage(String queueUrl, String messageBody) throws AmazonServiceException, AmazonClientException { return amazonSqsToBeExtended.sendMessage(queueUrl, messageBody); }
[ "public", "SendMessageResult", "sendMessage", "(", "String", "queueUrl", ",", "String", "messageBody", ")", "throws", "AmazonServiceException", ",", "AmazonClientException", "{", "return", "amazonSqsToBeExtended", ".", "sendMessage", "(", "queueUrl", ",", "messageBody", ")", ";", "}" ]
<p> Delivers a message to the specified queue. With Amazon SQS, you now have the ability to send large payload messages that are up to 256KB (262,144 bytes) in size. To send large payloads, you must use an AWS SDK that supports SigV4 signing. To verify whether SigV4 is supported for an AWS SDK, check the SDK release notes. </p> <p> <b>IMPORTANT:</b> The following list shows the characters (in Unicode) allowed in your message, according to the W3C XML specification. For more information, go to http://www.w3.org/TR/REC-xml/#charsets If you send any characters not included in the list, your request will be rejected. #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF] </p> @param queueUrl The URL of the Amazon SQS queue to take action on. @param messageBody The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note. @return The response from the SendMessage service method, as returned by AmazonSQS. @throws InvalidMessageContentsException @throws UnsupportedOperationException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.
[ "<p", ">", "Delivers", "a", "message", "to", "the", "specified", "queue", ".", "With", "Amazon", "SQS", "you", "now", "have", "the", "ability", "to", "send", "large", "payload", "messages", "that", "are", "up", "to", "256KB", "(", "262", "144", "bytes", ")", "in", "size", ".", "To", "send", "large", "payloads", "you", "must", "use", "an", "AWS", "SDK", "that", "supports", "SigV4", "signing", ".", "To", "verify", "whether", "SigV4", "is", "supported", "for", "an", "AWS", "SDK", "check", "the", "SDK", "release", "notes", ".", "<", "/", "p", ">", "<p", ">", "<b", ">", "IMPORTANT", ":", "<", "/", "b", ">", "The", "following", "list", "shows", "the", "characters", "(", "in", "Unicode", ")", "allowed", "in", "your", "message", "according", "to", "the", "W3C", "XML", "specification", ".", "For", "more", "information", "go", "to", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "REC", "-", "xml", "/", "#charsets", "If", "you", "send", "any", "characters", "not", "included", "in", "the", "list", "your", "request", "will", "be", "rejected", ".", "#x9", "|", "#xA", "|", "#xD", "|", "[", "#x20", "to", "#xD7FF", "]", "|", "[", "#xE000", "to", "#xFFFD", "]", "|", "[", "#x10000", "to", "#x10FFFF", "]", "<", "/", "p", ">" ]
train
https://github.com/awslabs/amazon-sqs-java-extended-client-lib/blob/df0c6251b99e682d6179938fe784590e662b84ea/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedClientBase.java#L312-L316
EdwardRaff/JSAT
JSAT/src/jsat/io/CSV.java
CSV.readR
public static RegressionDataSet readR(int numeric_target_column, Reader reader, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException { """ Reads in a CSV dataset as a regression dataset. @param numeric_target_column the column index (starting from zero) of the feature that will be the target regression value @param reader the reader for the CSV content @param delimiter the delimiter to separate columns, usually a comma @param lines_to_skip the number of lines to skip when reading in the CSV (used to skip header information) @param comment the character used to indicate the start of a comment. Once this character is reached, anything at and after the character will be ignored. @param cat_cols a set of the indices to treat as categorical features. @return the regression dataset from the given CSV file @throws IOException """ return (RegressionDataSet) readCSV(reader, lines_to_skip, delimiter, comment, cat_cols, numeric_target_column, -1); }
java
public static RegressionDataSet readR(int numeric_target_column, Reader reader, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException { return (RegressionDataSet) readCSV(reader, lines_to_skip, delimiter, comment, cat_cols, numeric_target_column, -1); }
[ "public", "static", "RegressionDataSet", "readR", "(", "int", "numeric_target_column", ",", "Reader", "reader", ",", "char", "delimiter", ",", "int", "lines_to_skip", ",", "char", "comment", ",", "Set", "<", "Integer", ">", "cat_cols", ")", "throws", "IOException", "{", "return", "(", "RegressionDataSet", ")", "readCSV", "(", "reader", ",", "lines_to_skip", ",", "delimiter", ",", "comment", ",", "cat_cols", ",", "numeric_target_column", ",", "-", "1", ")", ";", "}" ]
Reads in a CSV dataset as a regression dataset. @param numeric_target_column the column index (starting from zero) of the feature that will be the target regression value @param reader the reader for the CSV content @param delimiter the delimiter to separate columns, usually a comma @param lines_to_skip the number of lines to skip when reading in the CSV (used to skip header information) @param comment the character used to indicate the start of a comment. Once this character is reached, anything at and after the character will be ignored. @param cat_cols a set of the indices to treat as categorical features. @return the regression dataset from the given CSV file @throws IOException
[ "Reads", "in", "a", "CSV", "dataset", "as", "a", "regression", "dataset", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/CSV.java#L136-L139
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/spout/AmBaseSpout.java
AmBaseSpout.open
@SuppressWarnings("rawtypes") @Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { """ Initialize method called after extracted for worker processes.<br> <br> Initialize task id. @param conf Storm configuration @param context Topology context @param collector SpoutOutputCollector """ super.open(conf, context, collector); this.taskId = context.getThisComponentId() + "_" + context.getThisTaskId(); if (this.reloadConfig) { if (conf.containsKey(StormConfigGenerator.INIT_CONFIG_KEY)) { String watchPath = conf.get(StormConfigGenerator.INIT_CONFIG_KEY).toString(); String logFormat = "Config reload watch start. : WatchPath={0}, Interval(Sec)={1}"; logger.info(MessageFormat.format(logFormat, watchPath, this.reloadConfigIntervalSec)); this.watcher = new ConfigFileWatcher(watchPath, this.reloadConfigIntervalSec); this.watcher.init(); } } onOpen(conf, context); }
java
@SuppressWarnings("rawtypes") @Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { super.open(conf, context, collector); this.taskId = context.getThisComponentId() + "_" + context.getThisTaskId(); if (this.reloadConfig) { if (conf.containsKey(StormConfigGenerator.INIT_CONFIG_KEY)) { String watchPath = conf.get(StormConfigGenerator.INIT_CONFIG_KEY).toString(); String logFormat = "Config reload watch start. : WatchPath={0}, Interval(Sec)={1}"; logger.info(MessageFormat.format(logFormat, watchPath, this.reloadConfigIntervalSec)); this.watcher = new ConfigFileWatcher(watchPath, this.reloadConfigIntervalSec); this.watcher.init(); } } onOpen(conf, context); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "@", "Override", "public", "void", "open", "(", "Map", "conf", ",", "TopologyContext", "context", ",", "SpoutOutputCollector", "collector", ")", "{", "super", ".", "open", "(", "conf", ",", "context", ",", "collector", ")", ";", "this", ".", "taskId", "=", "context", ".", "getThisComponentId", "(", ")", "+", "\"_\"", "+", "context", ".", "getThisTaskId", "(", ")", ";", "if", "(", "this", ".", "reloadConfig", ")", "{", "if", "(", "conf", ".", "containsKey", "(", "StormConfigGenerator", ".", "INIT_CONFIG_KEY", ")", ")", "{", "String", "watchPath", "=", "conf", ".", "get", "(", "StormConfigGenerator", ".", "INIT_CONFIG_KEY", ")", ".", "toString", "(", ")", ";", "String", "logFormat", "=", "\"Config reload watch start. : WatchPath={0}, Interval(Sec)={1}\"", ";", "logger", ".", "info", "(", "MessageFormat", ".", "format", "(", "logFormat", ",", "watchPath", ",", "this", ".", "reloadConfigIntervalSec", ")", ")", ";", "this", ".", "watcher", "=", "new", "ConfigFileWatcher", "(", "watchPath", ",", "this", ".", "reloadConfigIntervalSec", ")", ";", "this", ".", "watcher", ".", "init", "(", ")", ";", "}", "}", "onOpen", "(", "conf", ",", "context", ")", ";", "}" ]
Initialize method called after extracted for worker processes.<br> <br> Initialize task id. @param conf Storm configuration @param context Topology context @param collector SpoutOutputCollector
[ "Initialize", "method", "called", "after", "extracted", "for", "worker", "processes", ".", "<br", ">", "<br", ">", "Initialize", "task", "id", "." ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/AmBaseSpout.java#L90-L112
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java
FileUtilities.deleteDirContents
public static boolean deleteDirContents(final File dir) { """ Delete the contents of a directory and all of its sub directories/files @param dir The directory whose content is to be deleted. @return True if the directories contents were deleted otherwise false if an error occurred. """ if (dir.isDirectory()) { final String[] children = dir.list(); for (final String aChildren : children) { final File child = new File(dir, aChildren); if (child.isDirectory()) { // Delete the sub directories if (!deleteDir(child)) { return false; } } else { // Delete a single file in the directory if (!child.delete()) { return false; } } } } return true; }
java
public static boolean deleteDirContents(final File dir) { if (dir.isDirectory()) { final String[] children = dir.list(); for (final String aChildren : children) { final File child = new File(dir, aChildren); if (child.isDirectory()) { // Delete the sub directories if (!deleteDir(child)) { return false; } } else { // Delete a single file in the directory if (!child.delete()) { return false; } } } } return true; }
[ "public", "static", "boolean", "deleteDirContents", "(", "final", "File", "dir", ")", "{", "if", "(", "dir", ".", "isDirectory", "(", ")", ")", "{", "final", "String", "[", "]", "children", "=", "dir", ".", "list", "(", ")", ";", "for", "(", "final", "String", "aChildren", ":", "children", ")", "{", "final", "File", "child", "=", "new", "File", "(", "dir", ",", "aChildren", ")", ";", "if", "(", "child", ".", "isDirectory", "(", ")", ")", "{", "// Delete the sub directories\r", "if", "(", "!", "deleteDir", "(", "child", ")", ")", "{", "return", "false", ";", "}", "}", "else", "{", "// Delete a single file in the directory\r", "if", "(", "!", "child", ".", "delete", "(", ")", ")", "{", "return", "false", ";", "}", "}", "}", "}", "return", "true", ";", "}" ]
Delete the contents of a directory and all of its sub directories/files @param dir The directory whose content is to be deleted. @return True if the directories contents were deleted otherwise false if an error occurred.
[ "Delete", "the", "contents", "of", "a", "directory", "and", "all", "of", "its", "sub", "directories", "/", "files" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java#L195-L214
kiegroup/drools
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNEvaluatorCompiler.java
DMNEvaluatorCompiler.variableTypeRefOrErrIfNull
private static QName variableTypeRefOrErrIfNull(DMNModelImpl model, InformationItem variable) { """ Utility method to have a error message is reported if a DMN Variable is missing typeRef. @param model used for reporting errors @param variable the variable to extract typeRef @return the `variable.typeRef` or null in case of errors. Errors are reported with standard notification mechanism via MsgUtil.reportMessage """ if ( variable.getTypeRef() != null ) { return variable.getTypeRef(); } else { MsgUtil.reportMessage( logger, DMNMessage.Severity.ERROR, variable, model, null, null, Msg.MISSING_TYPEREF_FOR_VARIABLE, variable.getName(), variable.getParentDRDElement().getIdentifierString() ); return null; } }
java
private static QName variableTypeRefOrErrIfNull(DMNModelImpl model, InformationItem variable) { if ( variable.getTypeRef() != null ) { return variable.getTypeRef(); } else { MsgUtil.reportMessage( logger, DMNMessage.Severity.ERROR, variable, model, null, null, Msg.MISSING_TYPEREF_FOR_VARIABLE, variable.getName(), variable.getParentDRDElement().getIdentifierString() ); return null; } }
[ "private", "static", "QName", "variableTypeRefOrErrIfNull", "(", "DMNModelImpl", "model", ",", "InformationItem", "variable", ")", "{", "if", "(", "variable", ".", "getTypeRef", "(", ")", "!=", "null", ")", "{", "return", "variable", ".", "getTypeRef", "(", ")", ";", "}", "else", "{", "MsgUtil", ".", "reportMessage", "(", "logger", ",", "DMNMessage", ".", "Severity", ".", "ERROR", ",", "variable", ",", "model", ",", "null", ",", "null", ",", "Msg", ".", "MISSING_TYPEREF_FOR_VARIABLE", ",", "variable", ".", "getName", "(", ")", ",", "variable", ".", "getParentDRDElement", "(", ")", ".", "getIdentifierString", "(", ")", ")", ";", "return", "null", ";", "}", "}" ]
Utility method to have a error message is reported if a DMN Variable is missing typeRef. @param model used for reporting errors @param variable the variable to extract typeRef @return the `variable.typeRef` or null in case of errors. Errors are reported with standard notification mechanism via MsgUtil.reportMessage
[ "Utility", "method", "to", "have", "a", "error", "message", "is", "reported", "if", "a", "DMN", "Variable", "is", "missing", "typeRef", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNEvaluatorCompiler.java#L740-L755
beanshell/beanshell
src/main/java/bsh/Types.java
Types.isJavaBoxTypesAssignable
static boolean isJavaBoxTypesAssignable( Class lhsType, Class rhsType ) { """ Determine if the type is assignable via Java boxing/unboxing rules. """ // Assignment to loose type... defer to bsh extensions if ( lhsType == null ) return false; // prim can be boxed and assigned to Object if ( lhsType == Object.class ) return true; // null rhs type corresponds to type of Primitive.NULL // assignable to any object type but not array if (rhsType == null) return !lhsType.isPrimitive() && !lhsType.isArray(); // prim numeric type can be boxed and assigned to number if ( lhsType == Number.class && rhsType != Character.TYPE && rhsType != Boolean.TYPE ) return true; // General case prim type to wrapper or vice versa. // I don't know if this is faster than a flat list of 'if's like above. // wrapperMap maps both prim to wrapper and wrapper to prim types, // so this test is symmetric if ( Primitive.wrapperMap.get( lhsType ) == rhsType ) return true; return isJavaBaseAssignable(lhsType, rhsType); }
java
static boolean isJavaBoxTypesAssignable( Class lhsType, Class rhsType ) { // Assignment to loose type... defer to bsh extensions if ( lhsType == null ) return false; // prim can be boxed and assigned to Object if ( lhsType == Object.class ) return true; // null rhs type corresponds to type of Primitive.NULL // assignable to any object type but not array if (rhsType == null) return !lhsType.isPrimitive() && !lhsType.isArray(); // prim numeric type can be boxed and assigned to number if ( lhsType == Number.class && rhsType != Character.TYPE && rhsType != Boolean.TYPE ) return true; // General case prim type to wrapper or vice versa. // I don't know if this is faster than a flat list of 'if's like above. // wrapperMap maps both prim to wrapper and wrapper to prim types, // so this test is symmetric if ( Primitive.wrapperMap.get( lhsType ) == rhsType ) return true; return isJavaBaseAssignable(lhsType, rhsType); }
[ "static", "boolean", "isJavaBoxTypesAssignable", "(", "Class", "lhsType", ",", "Class", "rhsType", ")", "{", "// Assignment to loose type... defer to bsh extensions", "if", "(", "lhsType", "==", "null", ")", "return", "false", ";", "// prim can be boxed and assigned to Object", "if", "(", "lhsType", "==", "Object", ".", "class", ")", "return", "true", ";", "// null rhs type corresponds to type of Primitive.NULL", "// assignable to any object type but not array", "if", "(", "rhsType", "==", "null", ")", "return", "!", "lhsType", ".", "isPrimitive", "(", ")", "&&", "!", "lhsType", ".", "isArray", "(", ")", ";", "// prim numeric type can be boxed and assigned to number", "if", "(", "lhsType", "==", "Number", ".", "class", "&&", "rhsType", "!=", "Character", ".", "TYPE", "&&", "rhsType", "!=", "Boolean", ".", "TYPE", ")", "return", "true", ";", "// General case prim type to wrapper or vice versa.", "// I don't know if this is faster than a flat list of 'if's like above.", "// wrapperMap maps both prim to wrapper and wrapper to prim types,", "// so this test is symmetric", "if", "(", "Primitive", ".", "wrapperMap", ".", "get", "(", "lhsType", ")", "==", "rhsType", ")", "return", "true", ";", "return", "isJavaBaseAssignable", "(", "lhsType", ",", "rhsType", ")", ";", "}" ]
Determine if the type is assignable via Java boxing/unboxing rules.
[ "Determine", "if", "the", "type", "is", "assignable", "via", "Java", "boxing", "/", "unboxing", "rules", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Types.java#L333-L364
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java
ObjectUtility.equalsOrBothNull
public static boolean equalsOrBothNull(final Object object1, final Object object2) { """ Return true if the object are equals or both null. @param object1 first object to compare @param object2 second object to compare @return true if the object are equals or both null """ return object1 == null && object2 == null || object1 != null && object1.equals(object2); }
java
public static boolean equalsOrBothNull(final Object object1, final Object object2) { return object1 == null && object2 == null || object1 != null && object1.equals(object2); }
[ "public", "static", "boolean", "equalsOrBothNull", "(", "final", "Object", "object1", ",", "final", "Object", "object2", ")", "{", "return", "object1", "==", "null", "&&", "object2", "==", "null", "||", "object1", "!=", "null", "&&", "object1", ".", "equals", "(", "object2", ")", ";", "}" ]
Return true if the object are equals or both null. @param object1 first object to compare @param object2 second object to compare @return true if the object are equals or both null
[ "Return", "true", "if", "the", "object", "are", "equals", "or", "both", "null", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java#L49-L51
stratosphere/stratosphere
stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java
GlobalConfiguration.getBooleanInternal
private boolean getBooleanInternal(final String key, final boolean defaultValue) { """ Returns the value associated with the given key as a boolean. @param key the key pointing to the associated value @param defaultValue the default value which is returned in case there is no value associated with the given key @return the (default) value associated with the given key """ boolean retVal = defaultValue; synchronized (this.confData) { final String value = this.confData.get(key); if (value != null) { retVal = Boolean.parseBoolean(value); } } return retVal; }
java
private boolean getBooleanInternal(final String key, final boolean defaultValue) { boolean retVal = defaultValue; synchronized (this.confData) { final String value = this.confData.get(key); if (value != null) { retVal = Boolean.parseBoolean(value); } } return retVal; }
[ "private", "boolean", "getBooleanInternal", "(", "final", "String", "key", ",", "final", "boolean", "defaultValue", ")", "{", "boolean", "retVal", "=", "defaultValue", ";", "synchronized", "(", "this", ".", "confData", ")", "{", "final", "String", "value", "=", "this", ".", "confData", ".", "get", "(", "key", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "retVal", "=", "Boolean", ".", "parseBoolean", "(", "value", ")", ";", "}", "}", "return", "retVal", ";", "}" ]
Returns the value associated with the given key as a boolean. @param key the key pointing to the associated value @param defaultValue the default value which is returned in case there is no value associated with the given key @return the (default) value associated with the given key
[ "Returns", "the", "value", "associated", "with", "the", "given", "key", "as", "a", "boolean", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java#L279-L292
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java
ValidatorAdapter.get
public static Validator get(ApplicationContext applicationContext, Validator validator) { """ Return a {@link Validator} that only implements the {@link Validator} interface, wrapping it if necessary. <p> If the specified {@link Validator} is not {@code null}, it is wrapped. If not, a {@link javax.validation.Validator} is retrieved from the context and wrapped. Otherwise, a new default validator is created. @param applicationContext the application context @param validator an existing validator to use or {@code null} @return the validator to use """ if (validator != null) { return wrap(validator, false); } return getExistingOrCreate(applicationContext); }
java
public static Validator get(ApplicationContext applicationContext, Validator validator) { if (validator != null) { return wrap(validator, false); } return getExistingOrCreate(applicationContext); }
[ "public", "static", "Validator", "get", "(", "ApplicationContext", "applicationContext", ",", "Validator", "validator", ")", "{", "if", "(", "validator", "!=", "null", ")", "{", "return", "wrap", "(", "validator", ",", "false", ")", ";", "}", "return", "getExistingOrCreate", "(", "applicationContext", ")", ";", "}" ]
Return a {@link Validator} that only implements the {@link Validator} interface, wrapping it if necessary. <p> If the specified {@link Validator} is not {@code null}, it is wrapped. If not, a {@link javax.validation.Validator} is retrieved from the context and wrapped. Otherwise, a new default validator is created. @param applicationContext the application context @param validator an existing validator to use or {@code null} @return the validator to use
[ "Return", "a", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java#L108-L114
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.setRow
public Matrix3d setRow(int row, Vector3dc src) throws IndexOutOfBoundsException { """ Set the row at the given <code>row</code> index, starting with <code>0</code>. @param row the row index in <code>[0..2]</code> @param src the row components to set @return this @throws IndexOutOfBoundsException if <code>row</code> is not in <code>[0..2]</code> """ return setRow(row, src.x(), src.y(), src.z()); }
java
public Matrix3d setRow(int row, Vector3dc src) throws IndexOutOfBoundsException { return setRow(row, src.x(), src.y(), src.z()); }
[ "public", "Matrix3d", "setRow", "(", "int", "row", ",", "Vector3dc", "src", ")", "throws", "IndexOutOfBoundsException", "{", "return", "setRow", "(", "row", ",", "src", ".", "x", "(", ")", ",", "src", ".", "y", "(", ")", ",", "src", ".", "z", "(", ")", ")", ";", "}" ]
Set the row at the given <code>row</code> index, starting with <code>0</code>. @param row the row index in <code>[0..2]</code> @param src the row components to set @return this @throws IndexOutOfBoundsException if <code>row</code> is not in <code>[0..2]</code>
[ "Set", "the", "row", "at", "the", "given", "<code", ">", "row<", "/", "code", ">", "index", "starting", "with", "<code", ">", "0<", "/", "code", ">", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L3512-L3514
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java
PropertiesManagerCore.deleteProperty
public boolean deleteProperty(String geoPackage, String property) { """ Delete the property and values from a specified GeoPackage @param geoPackage GeoPackage name @param property property name @return true if deleted """ boolean deleted = false; PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap .get(geoPackage); if (properties != null) { deleted = properties.deleteProperty(property) > 0; } return deleted; }
java
public boolean deleteProperty(String geoPackage, String property) { boolean deleted = false; PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap .get(geoPackage); if (properties != null) { deleted = properties.deleteProperty(property) > 0; } return deleted; }
[ "public", "boolean", "deleteProperty", "(", "String", "geoPackage", ",", "String", "property", ")", "{", "boolean", "deleted", "=", "false", ";", "PropertiesCoreExtension", "<", "T", ",", "?", ",", "?", ",", "?", ">", "properties", "=", "propertiesMap", ".", "get", "(", "geoPackage", ")", ";", "if", "(", "properties", "!=", "null", ")", "{", "deleted", "=", "properties", ".", "deleteProperty", "(", "property", ")", ">", "0", ";", "}", "return", "deleted", ";", "}" ]
Delete the property and values from a specified GeoPackage @param geoPackage GeoPackage name @param property property name @return true if deleted
[ "Delete", "the", "property", "and", "values", "from", "a", "specified", "GeoPackage" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java#L452-L460
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/Utils.java
Utils.checkForValidIndex
public static void checkForValidIndex(int index, int size) { """ Checks whether the given index is valid for accessing a tuple with the given size, and throws an <code>IndexOutOfBoundsException</code> if not. @param index The index @param size The size @throws IndexOutOfBoundsException If the given index is negative or not smaller than then given size """ if (index < 0) { throw new IndexOutOfBoundsException( "Index "+index+" is negative"); } if (index >= size) { throw new IndexOutOfBoundsException( "Index "+index+", size "+size); } }
java
public static void checkForValidIndex(int index, int size) { if (index < 0) { throw new IndexOutOfBoundsException( "Index "+index+" is negative"); } if (index >= size) { throw new IndexOutOfBoundsException( "Index "+index+", size "+size); } }
[ "public", "static", "void", "checkForValidIndex", "(", "int", "index", ",", "int", "size", ")", "{", "if", "(", "index", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index \"", "+", "index", "+", "\" is negative\"", ")", ";", "}", "if", "(", "index", ">=", "size", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index \"", "+", "index", "+", "\", size \"", "+", "size", ")", ";", "}", "}" ]
Checks whether the given index is valid for accessing a tuple with the given size, and throws an <code>IndexOutOfBoundsException</code> if not. @param index The index @param size The size @throws IndexOutOfBoundsException If the given index is negative or not smaller than then given size
[ "Checks", "whether", "the", "given", "index", "is", "valid", "for", "accessing", "a", "tuple", "with", "the", "given", "size", "and", "throws", "an", "<code", ">", "IndexOutOfBoundsException<", "/", "code", ">", "if", "not", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/Utils.java#L100-L112
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/Page.java
Page.addSection
public void addSection(String section, Composite composite) { """ Set a composite as a named section and add it to the. contents of the page """ sections.put(section,composite); add(composite); }
java
public void addSection(String section, Composite composite) { sections.put(section,composite); add(composite); }
[ "public", "void", "addSection", "(", "String", "section", ",", "Composite", "composite", ")", "{", "sections", ".", "put", "(", "section", ",", "composite", ")", ";", "add", "(", "composite", ")", ";", "}" ]
Set a composite as a named section and add it to the. contents of the page
[ "Set", "a", "composite", "as", "a", "named", "section", "and", "add", "it", "to", "the", ".", "contents", "of", "the", "page" ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Page.java#L331-L335
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onTickEvent
public Closeable onTickEvent(final BiConsumer<BitfinexTickerSymbol, BitfinexTick> listener) { """ registers listener for tick events @param listener of event @return hook of this listener """ tickConsumers.offer(listener); return () -> tickConsumers.remove(listener); }
java
public Closeable onTickEvent(final BiConsumer<BitfinexTickerSymbol, BitfinexTick> listener) { tickConsumers.offer(listener); return () -> tickConsumers.remove(listener); }
[ "public", "Closeable", "onTickEvent", "(", "final", "BiConsumer", "<", "BitfinexTickerSymbol", ",", "BitfinexTick", ">", "listener", ")", "{", "tickConsumers", ".", "offer", "(", "listener", ")", ";", "return", "(", ")", "->", "tickConsumers", ".", "remove", "(", "listener", ")", ";", "}" ]
registers listener for tick events @param listener of event @return hook of this listener
[ "registers", "listener", "for", "tick", "events" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L188-L191
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/TypeUtil.java
TypeUtil.isDouble
public static boolean isDouble(String _str, boolean _allowNegative) { """ Checks if the given string is a valid double. The used separator is based on the used system locale @param _str string to validate @param _allowNegative set to true if negative double should be allowed @return true if given string is double, false otherwise """ return isDouble(_str, DecimalFormatSymbols.getInstance().getDecimalSeparator(), _allowNegative); }
java
public static boolean isDouble(String _str, boolean _allowNegative) { return isDouble(_str, DecimalFormatSymbols.getInstance().getDecimalSeparator(), _allowNegative); }
[ "public", "static", "boolean", "isDouble", "(", "String", "_str", ",", "boolean", "_allowNegative", ")", "{", "return", "isDouble", "(", "_str", ",", "DecimalFormatSymbols", ".", "getInstance", "(", ")", ".", "getDecimalSeparator", "(", ")", ",", "_allowNegative", ")", ";", "}" ]
Checks if the given string is a valid double. The used separator is based on the used system locale @param _str string to validate @param _allowNegative set to true if negative double should be allowed @return true if given string is double, false otherwise
[ "Checks", "if", "the", "given", "string", "is", "a", "valid", "double", ".", "The", "used", "separator", "is", "based", "on", "the", "used", "system", "locale" ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/TypeUtil.java#L65-L67
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java
QuickSelect.insertionSort
private static void insertionSort(double[] data, int start, int end) { """ Sort a small array using repetitive insertion sort. @param data Data to sort @param start Interval start @param end Interval end """ for(int i = start + 1; i < end; i++) { for(int j = i; j > start && data[j - 1] > data[j]; j--) { swap(data, j, j - 1); } } }
java
private static void insertionSort(double[] data, int start, int end) { for(int i = start + 1; i < end; i++) { for(int j = i; j > start && data[j - 1] > data[j]; j--) { swap(data, j, j - 1); } } }
[ "private", "static", "void", "insertionSort", "(", "double", "[", "]", "data", ",", "int", "start", ",", "int", "end", ")", "{", "for", "(", "int", "i", "=", "start", "+", "1", ";", "i", "<", "end", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "i", ";", "j", ">", "start", "&&", "data", "[", "j", "-", "1", "]", ">", "data", "[", "j", "]", ";", "j", "--", ")", "{", "swap", "(", "data", ",", "j", ",", "j", "-", "1", ")", ";", "}", "}", "}" ]
Sort a small array using repetitive insertion sort. @param data Data to sort @param start Interval start @param end Interval end
[ "Sort", "a", "small", "array", "using", "repetitive", "insertion", "sort", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java#L563-L569
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addPreQualifiedClassLink
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) { """ Add the class link. @param context the id of the context where the link will be added @param cd the class doc to link to @param contentTree the content tree to which the link will be added """ addPreQualifiedClassLink(context, cd, false, contentTree); }
java
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) { addPreQualifiedClassLink(context, cd, false, contentTree); }
[ "public", "void", "addPreQualifiedClassLink", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "ClassDoc", "cd", ",", "Content", "contentTree", ")", "{", "addPreQualifiedClassLink", "(", "context", ",", "cd", ",", "false", ",", "contentTree", ")", ";", "}" ]
Add the class link. @param context the id of the context where the link will be added @param cd the class doc to link to @param contentTree the content tree to which the link will be added
[ "Add", "the", "class", "link", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1109-L1111
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java
DTMDocumentImpl.appendTextChild
void appendTextChild(int m_char_current_start,int contentLength) { """ Append a text child at the current insertion point. Assumes that the actual content of the text has previously been appended to the m_char buffer (shared with the builder). @param m_char_current_start int Starting offset of node's content in m_char. @param contentLength int Length of node's content in m_char. """ // create a Text Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = TEXT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; }
java
void appendTextChild(int m_char_current_start,int contentLength) { // create a Text Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = TEXT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; }
[ "void", "appendTextChild", "(", "int", "m_char_current_start", ",", "int", "contentLength", ")", "{", "// create a Text Node", "// %TBD% may be possible to combine with appendNode()to replace the next chunk of code", "int", "w0", "=", "TEXT_NODE", ";", "// W1: Parent", "int", "w1", "=", "currentParent", ";", "// W2: Start position within m_char", "int", "w2", "=", "m_char_current_start", ";", "// W3: Length of the full string", "int", "w3", "=", "contentLength", ";", "int", "ourslot", "=", "appendNode", "(", "w0", ",", "w1", ",", "w2", ",", "w3", ")", ";", "previousSibling", "=", "ourslot", ";", "}" ]
Append a text child at the current insertion point. Assumes that the actual content of the text has previously been appended to the m_char buffer (shared with the builder). @param m_char_current_start int Starting offset of node's content in m_char. @param contentLength int Length of node's content in m_char.
[ "Append", "a", "text", "child", "at", "the", "current", "insertion", "point", ".", "Assumes", "that", "the", "actual", "content", "of", "the", "text", "has", "previously", "been", "appended", "to", "the", "m_char", "buffer", "(", "shared", "with", "the", "builder", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L2091-L2105
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/rights/Grantee.java
Grantee.checkSelect
public void checkSelect(Table table, boolean[] checkList) { """ Checks if a right represented by the methods have been granted on the specified database object. <p> This is done by checking that a mapping exists in the rights map from the dbobject argument. Otherwise, it throws. """ if (isFullyAccessibleByRole(table)) { return; } Right right = (Right) fullRightsMap.get(table.getName()); if (right != null && right.canSelect(table, checkList)) { return; } throw Error.error(ErrorCode.X_42501, table.getName().name); }
java
public void checkSelect(Table table, boolean[] checkList) { if (isFullyAccessibleByRole(table)) { return; } Right right = (Right) fullRightsMap.get(table.getName()); if (right != null && right.canSelect(table, checkList)) { return; } throw Error.error(ErrorCode.X_42501, table.getName().name); }
[ "public", "void", "checkSelect", "(", "Table", "table", ",", "boolean", "[", "]", "checkList", ")", "{", "if", "(", "isFullyAccessibleByRole", "(", "table", ")", ")", "{", "return", ";", "}", "Right", "right", "=", "(", "Right", ")", "fullRightsMap", ".", "get", "(", "table", ".", "getName", "(", ")", ")", ";", "if", "(", "right", "!=", "null", "&&", "right", ".", "canSelect", "(", "table", ",", "checkList", ")", ")", "{", "return", ";", "}", "throw", "Error", ".", "error", "(", "ErrorCode", ".", "X_42501", ",", "table", ".", "getName", "(", ")", ".", "name", ")", ";", "}" ]
Checks if a right represented by the methods have been granted on the specified database object. <p> This is done by checking that a mapping exists in the rights map from the dbobject argument. Otherwise, it throws.
[ "Checks", "if", "a", "right", "represented", "by", "the", "methods", "have", "been", "granted", "on", "the", "specified", "database", "object", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rights/Grantee.java#L544-L557
thymeleaf/thymeleaf-spring
thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/SpringWebFluxTemplateEngine.java
SpringWebFluxTemplateEngine.applyDataDriverWrapper
private static IContext applyDataDriverWrapper( final IContext context, final String dataDriverVariableName, final DataDrivenTemplateIterator dataDrivenTemplateIterator) { """ /* This method will apply a wrapper on the data driver variable so that a DataDrivenTemplateIterator takes the place of the original data-driver variable. This is done via a wrapper in order to not perform such a strong modification on the original context object. Even if context objects should not be reused among template engine executions, when a non-IEngineContext implementation is used we will let that degree of liberty to the user just in case. """ // This is an IEngineContext, a very internal, low-level context implementation, so let's simply modify it if (context instanceof IEngineContext) { ((IEngineContext)context).setVariable(dataDriverVariableName, dataDrivenTemplateIterator); return context; } // Not an IEngineContext, but might still be an ISpringWebFluxContext and we don't want to lose that info if (context instanceof ISpringWebFluxContext) { return new DataDrivenSpringWebFluxContextWrapper( (ISpringWebFluxContext)context, dataDriverVariableName, dataDrivenTemplateIterator); } // Not a recognized context interface: just use a default implementation return new DataDrivenContextWrapper(context, dataDriverVariableName, dataDrivenTemplateIterator); }
java
private static IContext applyDataDriverWrapper( final IContext context, final String dataDriverVariableName, final DataDrivenTemplateIterator dataDrivenTemplateIterator) { // This is an IEngineContext, a very internal, low-level context implementation, so let's simply modify it if (context instanceof IEngineContext) { ((IEngineContext)context).setVariable(dataDriverVariableName, dataDrivenTemplateIterator); return context; } // Not an IEngineContext, but might still be an ISpringWebFluxContext and we don't want to lose that info if (context instanceof ISpringWebFluxContext) { return new DataDrivenSpringWebFluxContextWrapper( (ISpringWebFluxContext)context, dataDriverVariableName, dataDrivenTemplateIterator); } // Not a recognized context interface: just use a default implementation return new DataDrivenContextWrapper(context, dataDriverVariableName, dataDrivenTemplateIterator); }
[ "private", "static", "IContext", "applyDataDriverWrapper", "(", "final", "IContext", "context", ",", "final", "String", "dataDriverVariableName", ",", "final", "DataDrivenTemplateIterator", "dataDrivenTemplateIterator", ")", "{", "// This is an IEngineContext, a very internal, low-level context implementation, so let's simply modify it", "if", "(", "context", "instanceof", "IEngineContext", ")", "{", "(", "(", "IEngineContext", ")", "context", ")", ".", "setVariable", "(", "dataDriverVariableName", ",", "dataDrivenTemplateIterator", ")", ";", "return", "context", ";", "}", "// Not an IEngineContext, but might still be an ISpringWebFluxContext and we don't want to lose that info", "if", "(", "context", "instanceof", "ISpringWebFluxContext", ")", "{", "return", "new", "DataDrivenSpringWebFluxContextWrapper", "(", "(", "ISpringWebFluxContext", ")", "context", ",", "dataDriverVariableName", ",", "dataDrivenTemplateIterator", ")", ";", "}", "// Not a recognized context interface: just use a default implementation", "return", "new", "DataDrivenContextWrapper", "(", "context", ",", "dataDriverVariableName", ",", "dataDrivenTemplateIterator", ")", ";", "}" ]
/* This method will apply a wrapper on the data driver variable so that a DataDrivenTemplateIterator takes the place of the original data-driver variable. This is done via a wrapper in order to not perform such a strong modification on the original context object. Even if context objects should not be reused among template engine executions, when a non-IEngineContext implementation is used we will let that degree of liberty to the user just in case.
[ "/", "*", "This", "method", "will", "apply", "a", "wrapper", "on", "the", "data", "driver", "variable", "so", "that", "a", "DataDrivenTemplateIterator", "takes", "the", "place", "of", "the", "original", "data", "-", "driver", "variable", ".", "This", "is", "done", "via", "a", "wrapper", "in", "order", "to", "not", "perform", "such", "a", "strong", "modification", "on", "the", "original", "context", "object", ".", "Even", "if", "context", "objects", "should", "not", "be", "reused", "among", "template", "engine", "executions", "when", "a", "non", "-", "IEngineContext", "implementation", "is", "used", "we", "will", "let", "that", "degree", "of", "liberty", "to", "the", "user", "just", "in", "case", "." ]
train
https://github.com/thymeleaf/thymeleaf-spring/blob/9aa15a19017a0938e57646e3deefb8a90ab78dcb/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/SpringWebFluxTemplateEngine.java#L613-L633
OpenLiberty/open-liberty
dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java
ELHelper.isImmediateExpression
@Trivial static boolean isImmediateExpression(String expression, boolean mask) { """ Return whether the expression is an immediate EL expression. @param expression The expression to evaluate. @param mask Set whether to mask the expression and result. Useful for when passwords might be contained in either the expression or the result. @return True if the expression is an immediate EL expression. """ final String methodName = "isImmediateExpression"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask }); } boolean result = expression.startsWith("${") && expression.endsWith("}"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, result); } return result; }
java
@Trivial static boolean isImmediateExpression(String expression, boolean mask) { final String methodName = "isImmediateExpression"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask }); } boolean result = expression.startsWith("${") && expression.endsWith("}"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, result); } return result; }
[ "@", "Trivial", "static", "boolean", "isImmediateExpression", "(", "String", "expression", ",", "boolean", "mask", ")", "{", "final", "String", "methodName", "=", "\"isImmediateExpression\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "methodName", ",", "new", "Object", "[", "]", "{", "(", "expression", "==", "null", ")", "?", "null", ":", "mask", "?", "OBFUSCATED_STRING", ":", "expression", ",", "mask", "}", ")", ";", "}", "boolean", "result", "=", "expression", ".", "startsWith", "(", "\"${\"", ")", "&&", "expression", ".", "endsWith", "(", "\"}\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "methodName", ",", "result", ")", ";", "}", "return", "result", ";", "}" ]
Return whether the expression is an immediate EL expression. @param expression The expression to evaluate. @param mask Set whether to mask the expression and result. Useful for when passwords might be contained in either the expression or the result. @return True if the expression is an immediate EL expression.
[ "Return", "whether", "the", "expression", "is", "an", "immediate", "EL", "expression", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java#L118-L131
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_connectedDevices_macAddress_GET
public OvhConnectedDevice serviceName_modem_connectedDevices_macAddress_GET(String serviceName, String macAddress) throws IOException { """ Get this object properties REST: GET /xdsl/{serviceName}/modem/connectedDevices/{macAddress} @param serviceName [required] The internal name of your XDSL offer @param macAddress [required] MAC address of the device """ String qPath = "/xdsl/{serviceName}/modem/connectedDevices/{macAddress}"; StringBuilder sb = path(qPath, serviceName, macAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhConnectedDevice.class); }
java
public OvhConnectedDevice serviceName_modem_connectedDevices_macAddress_GET(String serviceName, String macAddress) throws IOException { String qPath = "/xdsl/{serviceName}/modem/connectedDevices/{macAddress}"; StringBuilder sb = path(qPath, serviceName, macAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhConnectedDevice.class); }
[ "public", "OvhConnectedDevice", "serviceName_modem_connectedDevices_macAddress_GET", "(", "String", "serviceName", ",", "String", "macAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/connectedDevices/{macAddress}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "macAddress", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhConnectedDevice", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /xdsl/{serviceName}/modem/connectedDevices/{macAddress} @param serviceName [required] The internal name of your XDSL offer @param macAddress [required] MAC address of the device
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1371-L1376
davidmoten/grumpy
grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java
Position.getBearingDifferenceDegrees
public static double getBearingDifferenceDegrees(double bearing1, double bearing2) { """ returns difference in degrees in the range -180 to 180 @param bearing1 degrees between -360 and 360 @param bearing2 degrees between -360 and 360 @return """ if (bearing1 < 0) bearing1 += 360; if (bearing2 > 180) bearing2 -= 360; double result = bearing1 - bearing2; if (result > 180) result -= 360; return result; }
java
public static double getBearingDifferenceDegrees(double bearing1, double bearing2) { if (bearing1 < 0) bearing1 += 360; if (bearing2 > 180) bearing2 -= 360; double result = bearing1 - bearing2; if (result > 180) result -= 360; return result; }
[ "public", "static", "double", "getBearingDifferenceDegrees", "(", "double", "bearing1", ",", "double", "bearing2", ")", "{", "if", "(", "bearing1", "<", "0", ")", "bearing1", "+=", "360", ";", "if", "(", "bearing2", ">", "180", ")", "bearing2", "-=", "360", ";", "double", "result", "=", "bearing1", "-", "bearing2", ";", "if", "(", "result", ">", "180", ")", "result", "-=", "360", ";", "return", "result", ";", "}" ]
returns difference in degrees in the range -180 to 180 @param bearing1 degrees between -360 and 360 @param bearing2 degrees between -360 and 360 @return
[ "returns", "difference", "in", "degrees", "in", "the", "range", "-", "180", "to", "180" ]
train
https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java#L315-L324
aws/aws-sdk-java
aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/TagProjectResult.java
TagProjectResult.withTags
public TagProjectResult withTags(java.util.Map<String, String> tags) { """ <p> The tags for the project. </p> @param tags The tags for the project. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public TagProjectResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "TagProjectResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags for the project. </p> @param tags The tags for the project. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "for", "the", "project", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/TagProjectResult.java#L68-L71
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java
CPOptionCategoryPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { """ Removes all the cp option categories where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID """ for (CPOptionCategory cpOptionCategory : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpOptionCategory); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPOptionCategory cpOptionCategory : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpOptionCategory); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CPOptionCategory", "cpOptionCategory", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "cpOptionCategory", ")", ";", "}", "}" ]
Removes all the cp option categories where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "cp", "option", "categories", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L1405-L1411
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.setFlowLogConfiguration
public FlowLogInformationInner setFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) { """ Configures flow log on a specified resource. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the configuration of flow log. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the FlowLogInformationInner object if successful. """ return setFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body(); }
java
public FlowLogInformationInner setFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) { return setFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body(); }
[ "public", "FlowLogInformationInner", "setFlowLogConfiguration", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "FlowLogInformationInner", "parameters", ")", "{", "return", "setFlowLogConfigurationWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Configures flow log on a specified resource. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the configuration of flow log. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the FlowLogInformationInner object if successful.
[ "Configures", "flow", "log", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1802-L1804
knowm/XChange
xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java
CexIOAdapters.adaptTicker
public static Ticker adaptTicker(CexIOTicker ticker) { """ Adapts a CexIOTicker to a Ticker Object @param ticker The exchange specific ticker @return The ticker """ if (ticker.getPair() == null) { throw new IllegalArgumentException("Missing currency pair in ticker: " + ticker); } return adaptTicker(ticker, adaptCurrencyPair(ticker.getPair())); }
java
public static Ticker adaptTicker(CexIOTicker ticker) { if (ticker.getPair() == null) { throw new IllegalArgumentException("Missing currency pair in ticker: " + ticker); } return adaptTicker(ticker, adaptCurrencyPair(ticker.getPair())); }
[ "public", "static", "Ticker", "adaptTicker", "(", "CexIOTicker", "ticker", ")", "{", "if", "(", "ticker", ".", "getPair", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Missing currency pair in ticker: \"", "+", "ticker", ")", ";", "}", "return", "adaptTicker", "(", "ticker", ",", "adaptCurrencyPair", "(", "ticker", ".", "getPair", "(", ")", ")", ")", ";", "}" ]
Adapts a CexIOTicker to a Ticker Object @param ticker The exchange specific ticker @return The ticker
[ "Adapts", "a", "CexIOTicker", "to", "a", "Ticker", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java#L83-L88
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/context/CounterContext.java
CounterContext.findPositionOf
@VisibleForTesting public int findPositionOf(ByteBuffer context, CounterId id) { """ Finds the position of a shard with the given id within the context (via binary search). """ int headerLength = headerLength(context); int offset = context.position() + headerLength; int left = 0; int right = (context.remaining() - headerLength) / STEP_LENGTH - 1; while (right >= left) { int middle = (left + right) / 2; int cmp = compareId(context, offset + middle * STEP_LENGTH, id.bytes(), id.bytes().position()); if (cmp == -1) left = middle + 1; else if (cmp == 0) return offset + middle * STEP_LENGTH; else right = middle - 1; } return -1; // position not found }
java
@VisibleForTesting public int findPositionOf(ByteBuffer context, CounterId id) { int headerLength = headerLength(context); int offset = context.position() + headerLength; int left = 0; int right = (context.remaining() - headerLength) / STEP_LENGTH - 1; while (right >= left) { int middle = (left + right) / 2; int cmp = compareId(context, offset + middle * STEP_LENGTH, id.bytes(), id.bytes().position()); if (cmp == -1) left = middle + 1; else if (cmp == 0) return offset + middle * STEP_LENGTH; else right = middle - 1; } return -1; // position not found }
[ "@", "VisibleForTesting", "public", "int", "findPositionOf", "(", "ByteBuffer", "context", ",", "CounterId", "id", ")", "{", "int", "headerLength", "=", "headerLength", "(", "context", ")", ";", "int", "offset", "=", "context", ".", "position", "(", ")", "+", "headerLength", ";", "int", "left", "=", "0", ";", "int", "right", "=", "(", "context", ".", "remaining", "(", ")", "-", "headerLength", ")", "/", "STEP_LENGTH", "-", "1", ";", "while", "(", "right", ">=", "left", ")", "{", "int", "middle", "=", "(", "left", "+", "right", ")", "/", "2", ";", "int", "cmp", "=", "compareId", "(", "context", ",", "offset", "+", "middle", "*", "STEP_LENGTH", ",", "id", ".", "bytes", "(", ")", ",", "id", ".", "bytes", "(", ")", ".", "position", "(", ")", ")", ";", "if", "(", "cmp", "==", "-", "1", ")", "left", "=", "middle", "+", "1", ";", "else", "if", "(", "cmp", "==", "0", ")", "return", "offset", "+", "middle", "*", "STEP_LENGTH", ";", "else", "right", "=", "middle", "-", "1", ";", "}", "return", "-", "1", ";", "// position not found", "}" ]
Finds the position of a shard with the given id within the context (via binary search).
[ "Finds", "the", "position", "of", "a", "shard", "with", "the", "given", "id", "within", "the", "context", "(", "via", "binary", "search", ")", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/context/CounterContext.java#L689-L712
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.backupSecretAsync
public Observable<BackupSecretResult> backupSecretAsync(String vaultBaseUrl, String secretName) { """ Backs up the specified secret. Requests that a backup of the specified secret be downloaded to the client. All versions of the secret will be downloaded. This operation requires the secrets/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupSecretResult object """ return backupSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<BackupSecretResult>, BackupSecretResult>() { @Override public BackupSecretResult call(ServiceResponse<BackupSecretResult> response) { return response.body(); } }); }
java
public Observable<BackupSecretResult> backupSecretAsync(String vaultBaseUrl, String secretName) { return backupSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<BackupSecretResult>, BackupSecretResult>() { @Override public BackupSecretResult call(ServiceResponse<BackupSecretResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackupSecretResult", ">", "backupSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ")", "{", "return", "backupSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "BackupSecretResult", ">", ",", "BackupSecretResult", ">", "(", ")", "{", "@", "Override", "public", "BackupSecretResult", "call", "(", "ServiceResponse", "<", "BackupSecretResult", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Backs up the specified secret. Requests that a backup of the specified secret be downloaded to the client. All versions of the secret will be downloaded. This operation requires the secrets/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupSecretResult object
[ "Backs", "up", "the", "specified", "secret", ".", "Requests", "that", "a", "backup", "of", "the", "specified", "secret", "be", "downloaded", "to", "the", "client", ".", "All", "versions", "of", "the", "secret", "will", "be", "downloaded", ".", "This", "operation", "requires", "the", "secrets", "/", "backup", "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#L4933-L4940
JodaOrg/joda-time
src/main/java/org/joda/time/DateMidnight.java
DateMidnight.toInterval
public Interval toInterval() { """ Converts this object to an <code>Interval</code> encompassing the whole of this day. <p> The interval starts at midnight 00:00 and ends at 00:00 the following day, (which is not included in the interval, as intervals are half-open). @return an interval over the day """ Chronology chrono = getChronology(); long start = getMillis(); long end = DurationFieldType.days().getField(chrono).add(start, 1); return new Interval(start, end, chrono); }
java
public Interval toInterval() { Chronology chrono = getChronology(); long start = getMillis(); long end = DurationFieldType.days().getField(chrono).add(start, 1); return new Interval(start, end, chrono); }
[ "public", "Interval", "toInterval", "(", ")", "{", "Chronology", "chrono", "=", "getChronology", "(", ")", ";", "long", "start", "=", "getMillis", "(", ")", ";", "long", "end", "=", "DurationFieldType", ".", "days", "(", ")", ".", "getField", "(", "chrono", ")", ".", "add", "(", "start", ",", "1", ")", ";", "return", "new", "Interval", "(", "start", ",", "end", ",", "chrono", ")", ";", "}" ]
Converts this object to an <code>Interval</code> encompassing the whole of this day. <p> The interval starts at midnight 00:00 and ends at 00:00 the following day, (which is not included in the interval, as intervals are half-open). @return an interval over the day
[ "Converts", "this", "object", "to", "an", "<code", ">", "Interval<", "/", "code", ">", "encompassing", "the", "whole", "of", "this", "day", ".", "<p", ">", "The", "interval", "starts", "at", "midnight", "00", ":", "00", "and", "ends", "at", "00", ":", "00", "the", "following", "day", "(", "which", "is", "not", "included", "in", "the", "interval", "as", "intervals", "are", "half", "-", "open", ")", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateMidnight.java#L894-L899
op4j/op4j-jodatime
src/main/java/org/op4j/jodatime/functions/FnPeriod.java
FnPeriod.calendarFieldCollectionToPeriod
public static final Function<Collection<? extends Calendar>, Period> calendarFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) { """ <p> It creates a {@link Period} with the specified {@link PeriodType} and {@link Chronology}. The input received by the {@link Function} must have size 2 and represents the start and end instants of the {@link Period} </p> @param periodType the {@link PeriodType} to be created. It specifies which duration fields are to be used @param chronology {@link Chronology} to be used @return the {@link Period} created from the input and arguments """ return new CalendarFieldCollectionToPeriod(periodType, chronology); }
java
public static final Function<Collection<? extends Calendar>, Period> calendarFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) { return new CalendarFieldCollectionToPeriod(periodType, chronology); }
[ "public", "static", "final", "Function", "<", "Collection", "<", "?", "extends", "Calendar", ">", ",", "Period", ">", "calendarFieldCollectionToPeriod", "(", "final", "PeriodType", "periodType", ",", "final", "Chronology", "chronology", ")", "{", "return", "new", "CalendarFieldCollectionToPeriod", "(", "periodType", ",", "chronology", ")", ";", "}" ]
<p> It creates a {@link Period} with the specified {@link PeriodType} and {@link Chronology}. The input received by the {@link Function} must have size 2 and represents the start and end instants of the {@link Period} </p> @param periodType the {@link PeriodType} to be created. It specifies which duration fields are to be used @param chronology {@link Chronology} to be used @return the {@link Period} created from the input and arguments
[ "<p", ">", "It", "creates", "a", "{", "@link", "Period", "}", "with", "the", "specified", "{", "@link", "PeriodType", "}", "and", "{", "@link", "Chronology", "}", ".", "The", "input", "received", "by", "the", "{", "@link", "Function", "}", "must", "have", "size", "2", "and", "represents", "the", "start", "and", "end", "instants", "of", "the", "{", "@link", "Period", "}", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j-jodatime/blob/26e5b8cda8553fb3b5a4a64b3109dbbf5df21194/src/main/java/org/op4j/jodatime/functions/FnPeriod.java#L511-L513
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java
SimplePipelineRev803.runPipeline
public static void runPipeline(final CAS aCas, final AnalysisEngineDescription... aDescs) throws UIMAException, IOException { """ Run a sequence of {@link AnalysisEngine analysis engines} over a {@link JCas}. The result of the analysis can be read from the JCas. @param aCas the CAS to process @param aDescs a sequence of analysis engines to run on the jCas @throws UIMAException @throws IOException """ // Create aggregate AE final AnalysisEngineDescription aaeDesc = createAggregateDescription(aDescs); // Instantiate final AnalysisEngine aae = createAggregate(aaeDesc); try { // Process aae.process(aCas); // Signal end of processing aae.collectionProcessComplete(); } finally { // Destroy aae.destroy(); } }
java
public static void runPipeline(final CAS aCas, final AnalysisEngineDescription... aDescs) throws UIMAException, IOException { // Create aggregate AE final AnalysisEngineDescription aaeDesc = createAggregateDescription(aDescs); // Instantiate final AnalysisEngine aae = createAggregate(aaeDesc); try { // Process aae.process(aCas); // Signal end of processing aae.collectionProcessComplete(); } finally { // Destroy aae.destroy(); } }
[ "public", "static", "void", "runPipeline", "(", "final", "CAS", "aCas", ",", "final", "AnalysisEngineDescription", "...", "aDescs", ")", "throws", "UIMAException", ",", "IOException", "{", "// Create aggregate AE", "final", "AnalysisEngineDescription", "aaeDesc", "=", "createAggregateDescription", "(", "aDescs", ")", ";", "// Instantiate", "final", "AnalysisEngine", "aae", "=", "createAggregate", "(", "aaeDesc", ")", ";", "try", "{", "// Process", "aae", ".", "process", "(", "aCas", ")", ";", "// Signal end of processing", "aae", ".", "collectionProcessComplete", "(", ")", ";", "}", "finally", "{", "// Destroy", "aae", ".", "destroy", "(", ")", ";", "}", "}" ]
Run a sequence of {@link AnalysisEngine analysis engines} over a {@link JCas}. The result of the analysis can be read from the JCas. @param aCas the CAS to process @param aDescs a sequence of analysis engines to run on the jCas @throws UIMAException @throws IOException
[ "Run", "a", "sequence", "of", "{", "@link", "AnalysisEngine", "analysis", "engines", "}", "over", "a", "{", "@link", "JCas", "}", ".", "The", "result", "of", "the", "analysis", "can", "be", "read", "from", "the", "JCas", "." ]
train
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java#L177-L195
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java
RTMPHandshake.getDHOffset1
protected int getDHOffset1(byte[] handshake, int bufferOffset) { """ Returns the DH byte offset. @param handshake handshake sequence @param bufferOffset buffer offset @return dh offset """ bufferOffset += 1532; int offset = handshake[bufferOffset] & 0xff; // & 0x0ff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = (offset % 632) + 772; if (res + KEY_LENGTH > 1531) { log.error("Invalid DH offset"); } return res; }
java
protected int getDHOffset1(byte[] handshake, int bufferOffset) { bufferOffset += 1532; int offset = handshake[bufferOffset] & 0xff; // & 0x0ff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = (offset % 632) + 772; if (res + KEY_LENGTH > 1531) { log.error("Invalid DH offset"); } return res; }
[ "protected", "int", "getDHOffset1", "(", "byte", "[", "]", "handshake", ",", "int", "bufferOffset", ")", "{", "bufferOffset", "+=", "1532", ";", "int", "offset", "=", "handshake", "[", "bufferOffset", "]", "&", "0xff", ";", "// & 0x0ff;\r", "bufferOffset", "++", ";", "offset", "+=", "handshake", "[", "bufferOffset", "]", "&", "0xff", ";", "bufferOffset", "++", ";", "offset", "+=", "handshake", "[", "bufferOffset", "]", "&", "0xff", ";", "bufferOffset", "++", ";", "offset", "+=", "handshake", "[", "bufferOffset", "]", "&", "0xff", ";", "int", "res", "=", "(", "offset", "%", "632", ")", "+", "772", ";", "if", "(", "res", "+", "KEY_LENGTH", ">", "1531", ")", "{", "log", ".", "error", "(", "\"Invalid DH offset\"", ")", ";", "}", "return", "res", ";", "}" ]
Returns the DH byte offset. @param handshake handshake sequence @param bufferOffset buffer offset @return dh offset
[ "Returns", "the", "DH", "byte", "offset", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L444-L458
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java
SphereUtil.cosineOrHaversineDeg
public static double cosineOrHaversineDeg(double lat1, double lon1, double lat2, double lon2) { """ Use cosine or haversine dynamically. Complexity: 4-5 trigonometric functions, 1 sqrt. @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance on unit sphere """ return cosineOrHaversineRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2)); }
java
public static double cosineOrHaversineDeg(double lat1, double lon1, double lat2, double lon2) { return cosineOrHaversineRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2)); }
[ "public", "static", "double", "cosineOrHaversineDeg", "(", "double", "lat1", ",", "double", "lon1", ",", "double", "lat2", ",", "double", "lon2", ")", "{", "return", "cosineOrHaversineRad", "(", "deg2rad", "(", "lat1", ")", ",", "deg2rad", "(", "lon1", ")", ",", "deg2rad", "(", "lat2", ")", ",", "deg2rad", "(", "lon2", ")", ")", ";", "}" ]
Use cosine or haversine dynamically. Complexity: 4-5 trigonometric functions, 1 sqrt. @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance on unit sphere
[ "Use", "cosine", "or", "haversine", "dynamically", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L200-L202
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/ReplicationInternal.java
ReplicationInternal.setHeaders
@InterfaceAudience.Public public void setHeaders(Map<String, Object> requestHeadersParam) { """ Set Extra HTTP headers to be sent in all requests to the remote server. """ if (requestHeadersParam != null && !requestHeaders.equals(requestHeadersParam)) { requestHeaders = requestHeadersParam; } }
java
@InterfaceAudience.Public public void setHeaders(Map<String, Object> requestHeadersParam) { if (requestHeadersParam != null && !requestHeaders.equals(requestHeadersParam)) { requestHeaders = requestHeadersParam; } }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setHeaders", "(", "Map", "<", "String", ",", "Object", ">", "requestHeadersParam", ")", "{", "if", "(", "requestHeadersParam", "!=", "null", "&&", "!", "requestHeaders", ".", "equals", "(", "requestHeadersParam", ")", ")", "{", "requestHeaders", "=", "requestHeadersParam", ";", "}", "}" ]
Set Extra HTTP headers to be sent in all requests to the remote server.
[ "Set", "Extra", "HTTP", "headers", "to", "be", "sent", "in", "all", "requests", "to", "the", "remote", "server", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/ReplicationInternal.java#L799-L804
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setNClob
@Override public void setNClob(int parameterIndex, NClob value) throws SQLException { """ Method setNClob. @param parameterIndex @param value @throws SQLException @see java.sql.PreparedStatement#setNClob(int, NClob) """ internalStmt.setNClob(parameterIndex, value); }
java
@Override public void setNClob(int parameterIndex, NClob value) throws SQLException { internalStmt.setNClob(parameterIndex, value); }
[ "@", "Override", "public", "void", "setNClob", "(", "int", "parameterIndex", ",", "NClob", "value", ")", "throws", "SQLException", "{", "internalStmt", ".", "setNClob", "(", "parameterIndex", ",", "value", ")", ";", "}" ]
Method setNClob. @param parameterIndex @param value @throws SQLException @see java.sql.PreparedStatement#setNClob(int, NClob)
[ "Method", "setNClob", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L817-L820
looly/hutool
hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java
Scheduler.schedule
public Scheduler schedule(String id, String pattern, Task task) { """ 新增Task @param id ID,为每一个Task定义一个ID @param pattern {@link CronPattern}对应的String表达式 @param task {@link Task} @return this """ return schedule(id, new CronPattern(pattern), task); }
java
public Scheduler schedule(String id, String pattern, Task task) { return schedule(id, new CronPattern(pattern), task); }
[ "public", "Scheduler", "schedule", "(", "String", "id", ",", "String", "pattern", ",", "Task", "task", ")", "{", "return", "schedule", "(", "id", ",", "new", "CronPattern", "(", "pattern", ")", ",", "task", ")", ";", "}" ]
新增Task @param id ID,为每一个Task定义一个ID @param pattern {@link CronPattern}对应的String表达式 @param task {@link Task} @return this
[ "新增Task" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L243-L245
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.createNewGallery
public void createNewGallery(final CmsUUID parentId, final int galleryTypeId, final String title) { """ Creates a new gallery folder of the given type.<p> @param parentId the parent folder id @param galleryTypeId the folder type id @param title the folder title """ final String parentFolder = parentId != null ? getEntryById(parentId).getSitePath() : CmsStringUtil.joinPaths(m_data.getRoot().getSitePath(), m_data.getDefaultGalleryFolder()); CmsRpcAction<CmsGalleryFolderEntry> action = new CmsRpcAction<CmsGalleryFolderEntry>() { @Override public void execute() { getService().createNewGalleryFolder(parentFolder, title, galleryTypeId, this); } @Override protected void onResponse(CmsGalleryFolderEntry result) { CmsSitemapView.getInstance().displayNewGallery(result); } }; action.execute(); }
java
public void createNewGallery(final CmsUUID parentId, final int galleryTypeId, final String title) { final String parentFolder = parentId != null ? getEntryById(parentId).getSitePath() : CmsStringUtil.joinPaths(m_data.getRoot().getSitePath(), m_data.getDefaultGalleryFolder()); CmsRpcAction<CmsGalleryFolderEntry> action = new CmsRpcAction<CmsGalleryFolderEntry>() { @Override public void execute() { getService().createNewGalleryFolder(parentFolder, title, galleryTypeId, this); } @Override protected void onResponse(CmsGalleryFolderEntry result) { CmsSitemapView.getInstance().displayNewGallery(result); } }; action.execute(); }
[ "public", "void", "createNewGallery", "(", "final", "CmsUUID", "parentId", ",", "final", "int", "galleryTypeId", ",", "final", "String", "title", ")", "{", "final", "String", "parentFolder", "=", "parentId", "!=", "null", "?", "getEntryById", "(", "parentId", ")", ".", "getSitePath", "(", ")", ":", "CmsStringUtil", ".", "joinPaths", "(", "m_data", ".", "getRoot", "(", ")", ".", "getSitePath", "(", ")", ",", "m_data", ".", "getDefaultGalleryFolder", "(", ")", ")", ";", "CmsRpcAction", "<", "CmsGalleryFolderEntry", ">", "action", "=", "new", "CmsRpcAction", "<", "CmsGalleryFolderEntry", ">", "(", ")", "{", "@", "Override", "public", "void", "execute", "(", ")", "{", "getService", "(", ")", ".", "createNewGalleryFolder", "(", "parentFolder", ",", "title", ",", "galleryTypeId", ",", "this", ")", ";", "}", "@", "Override", "protected", "void", "onResponse", "(", "CmsGalleryFolderEntry", "result", ")", "{", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "displayNewGallery", "(", "result", ")", ";", "}", "}", ";", "action", ".", "execute", "(", ")", ";", "}" ]
Creates a new gallery folder of the given type.<p> @param parentId the parent folder id @param galleryTypeId the folder type id @param title the folder title
[ "Creates", "a", "new", "gallery", "folder", "of", "the", "given", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L511-L533
cache2k/cache2k
cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java
JCacheBuilder.setupExceptionPropagator
private void setupExceptionPropagator() { """ If an exception propagator is configured, take this one, otherwise go with default that is providing JCache compatible behavior. """ if (cache2kConfiguration.getExceptionPropagator() != null) { return; } cache2kConfiguration.setExceptionPropagator( new CustomizationReferenceSupplier<ExceptionPropagator<K>>(new ExceptionPropagator<K>() { @Override public RuntimeException propagateException(Object key, final ExceptionInformation exceptionInformation) { return new CacheLoaderException("propagate previous loader exception", exceptionInformation.getException()); } })); }
java
private void setupExceptionPropagator() { if (cache2kConfiguration.getExceptionPropagator() != null) { return; } cache2kConfiguration.setExceptionPropagator( new CustomizationReferenceSupplier<ExceptionPropagator<K>>(new ExceptionPropagator<K>() { @Override public RuntimeException propagateException(Object key, final ExceptionInformation exceptionInformation) { return new CacheLoaderException("propagate previous loader exception", exceptionInformation.getException()); } })); }
[ "private", "void", "setupExceptionPropagator", "(", ")", "{", "if", "(", "cache2kConfiguration", ".", "getExceptionPropagator", "(", ")", "!=", "null", ")", "{", "return", ";", "}", "cache2kConfiguration", ".", "setExceptionPropagator", "(", "new", "CustomizationReferenceSupplier", "<", "ExceptionPropagator", "<", "K", ">", ">", "(", "new", "ExceptionPropagator", "<", "K", ">", "(", ")", "{", "@", "Override", "public", "RuntimeException", "propagateException", "(", "Object", "key", ",", "final", "ExceptionInformation", "exceptionInformation", ")", "{", "return", "new", "CacheLoaderException", "(", "\"propagate previous loader exception\"", ",", "exceptionInformation", ".", "getException", "(", ")", ")", ";", "}", "}", ")", ")", ";", "}" ]
If an exception propagator is configured, take this one, otherwise go with default that is providing JCache compatible behavior.
[ "If", "an", "exception", "propagator", "is", "configured", "take", "this", "one", "otherwise", "go", "with", "default", "that", "is", "providing", "JCache", "compatible", "behavior", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-jcache/src/main/java/org/cache2k/jcache/provider/JCacheBuilder.java#L190-L201
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.scalarMin
public SDVariable scalarMin(String name, SDVariable in, Number value) { """ Element-wise scalar minimum operation: out = min(in, value) @param name Name of the output variable @param in Input variable @param value Scalar value to compare @return Output variable """ validateNumerical("min", in); SDVariable ret = f().scalarMin(in, value); return updateVariableNameAndReference(ret, name); }
java
public SDVariable scalarMin(String name, SDVariable in, Number value) { validateNumerical("min", in); SDVariable ret = f().scalarMin(in, value); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "scalarMin", "(", "String", "name", ",", "SDVariable", "in", ",", "Number", "value", ")", "{", "validateNumerical", "(", "\"min\"", ",", "in", ")", ";", "SDVariable", "ret", "=", "f", "(", ")", ".", "scalarMin", "(", "in", ",", "value", ")", ";", "return", "updateVariableNameAndReference", "(", "ret", ",", "name", ")", ";", "}" ]
Element-wise scalar minimum operation: out = min(in, value) @param name Name of the output variable @param in Input variable @param value Scalar value to compare @return Output variable
[ "Element", "-", "wise", "scalar", "minimum", "operation", ":", "out", "=", "min", "(", "in", "value", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1980-L1984
dadoonet/fscrawler
elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ElasticsearchClientUtil.java
ElasticsearchClientUtil.getInstance
public static ElasticsearchClient getInstance(Path config, FsSettings settings, int version) throws ClassNotFoundException { """ Try to find a client version in the classpath @param config Path to FSCrawler configuration files (elasticsearch templates) @param settings FSCrawler settings. Can not be null. @param version Version to load @return A Client instance """ Objects.requireNonNull(settings, "settings can not be null"); Class<ElasticsearchClient> clazz = null; try { clazz = findClass(version); } catch (ClassNotFoundException e) { logger.trace("ElasticsearchClient class not found for version {} in the classpath. Skipping...", version); } if (clazz == null) { throw new ClassNotFoundException("Can not find any ElasticsearchClient in the classpath. " + "Did you forget to add the elasticsearch client library?"); } logger.trace("Found [{}] class as the elasticsearch client implementation.", clazz.getName()); try { Constructor<? extends ElasticsearchClient> constructor = clazz.getConstructor(Path.class, FsSettings.class); return constructor.newInstance(config, settings); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Class " + clazz.getName() + " does not have the expected ctor (Path, FsSettings).", e); } catch (IllegalAccessException|InstantiationException| InvocationTargetException e) { throw new IllegalArgumentException("Can not create an instance of " + clazz.getName(), e); } }
java
public static ElasticsearchClient getInstance(Path config, FsSettings settings, int version) throws ClassNotFoundException { Objects.requireNonNull(settings, "settings can not be null"); Class<ElasticsearchClient> clazz = null; try { clazz = findClass(version); } catch (ClassNotFoundException e) { logger.trace("ElasticsearchClient class not found for version {} in the classpath. Skipping...", version); } if (clazz == null) { throw new ClassNotFoundException("Can not find any ElasticsearchClient in the classpath. " + "Did you forget to add the elasticsearch client library?"); } logger.trace("Found [{}] class as the elasticsearch client implementation.", clazz.getName()); try { Constructor<? extends ElasticsearchClient> constructor = clazz.getConstructor(Path.class, FsSettings.class); return constructor.newInstance(config, settings); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Class " + clazz.getName() + " does not have the expected ctor (Path, FsSettings).", e); } catch (IllegalAccessException|InstantiationException| InvocationTargetException e) { throw new IllegalArgumentException("Can not create an instance of " + clazz.getName(), e); } }
[ "public", "static", "ElasticsearchClient", "getInstance", "(", "Path", "config", ",", "FsSettings", "settings", ",", "int", "version", ")", "throws", "ClassNotFoundException", "{", "Objects", ".", "requireNonNull", "(", "settings", ",", "\"settings can not be null\"", ")", ";", "Class", "<", "ElasticsearchClient", ">", "clazz", "=", "null", ";", "try", "{", "clazz", "=", "findClass", "(", "version", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "logger", ".", "trace", "(", "\"ElasticsearchClient class not found for version {} in the classpath. Skipping...\"", ",", "version", ")", ";", "}", "if", "(", "clazz", "==", "null", ")", "{", "throw", "new", "ClassNotFoundException", "(", "\"Can not find any ElasticsearchClient in the classpath. \"", "+", "\"Did you forget to add the elasticsearch client library?\"", ")", ";", "}", "logger", ".", "trace", "(", "\"Found [{}] class as the elasticsearch client implementation.\"", ",", "clazz", ".", "getName", "(", ")", ")", ";", "try", "{", "Constructor", "<", "?", "extends", "ElasticsearchClient", ">", "constructor", "=", "clazz", ".", "getConstructor", "(", "Path", ".", "class", ",", "FsSettings", ".", "class", ")", ";", "return", "constructor", ".", "newInstance", "(", "config", ",", "settings", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Class \"", "+", "clazz", ".", "getName", "(", ")", "+", "\" does not have the expected ctor (Path, FsSettings).\"", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "InstantiationException", "|", "InvocationTargetException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can not create an instance of \"", "+", "clazz", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "}" ]
Try to find a client version in the classpath @param config Path to FSCrawler configuration files (elasticsearch templates) @param settings FSCrawler settings. Can not be null. @param version Version to load @return A Client instance
[ "Try", "to", "find", "a", "client", "version", "in", "the", "classpath" ]
train
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ElasticsearchClientUtil.java#L69-L93
wcm-io/wcm-io-handler
richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java
DefaultRewriteContentHandler.getAnchorLegacyMetadataFromSingleData
private boolean getAnchorLegacyMetadataFromSingleData(ValueMap resourceProps, Element element) { """ Support legacy data structures where link metadata is stored as JSON fragment in single HTML5 data attribute. @param resourceProps ValueMap to write link metadata to @param element Link element """ boolean foundAny = false; JSONObject metadata = null; Attribute dataAttribute = element.getAttribute("data"); if (dataAttribute != null) { String metadataString = dataAttribute.getValue(); if (StringUtils.isNotEmpty(metadataString)) { try { metadata = new JSONObject(metadataString); } catch (JSONException ex) { log.debug("Invalid link metadata: " + metadataString, ex); } } } if (metadata != null) { JSONArray names = metadata.names(); for (int i = 0; i < names.length(); i++) { String name = names.optString(i); resourceProps.put(name, metadata.opt(name)); foundAny = true; } } return foundAny; }
java
private boolean getAnchorLegacyMetadataFromSingleData(ValueMap resourceProps, Element element) { boolean foundAny = false; JSONObject metadata = null; Attribute dataAttribute = element.getAttribute("data"); if (dataAttribute != null) { String metadataString = dataAttribute.getValue(); if (StringUtils.isNotEmpty(metadataString)) { try { metadata = new JSONObject(metadataString); } catch (JSONException ex) { log.debug("Invalid link metadata: " + metadataString, ex); } } } if (metadata != null) { JSONArray names = metadata.names(); for (int i = 0; i < names.length(); i++) { String name = names.optString(i); resourceProps.put(name, metadata.opt(name)); foundAny = true; } } return foundAny; }
[ "private", "boolean", "getAnchorLegacyMetadataFromSingleData", "(", "ValueMap", "resourceProps", ",", "Element", "element", ")", "{", "boolean", "foundAny", "=", "false", ";", "JSONObject", "metadata", "=", "null", ";", "Attribute", "dataAttribute", "=", "element", ".", "getAttribute", "(", "\"data\"", ")", ";", "if", "(", "dataAttribute", "!=", "null", ")", "{", "String", "metadataString", "=", "dataAttribute", ".", "getValue", "(", ")", ";", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "metadataString", ")", ")", "{", "try", "{", "metadata", "=", "new", "JSONObject", "(", "metadataString", ")", ";", "}", "catch", "(", "JSONException", "ex", ")", "{", "log", ".", "debug", "(", "\"Invalid link metadata: \"", "+", "metadataString", ",", "ex", ")", ";", "}", "}", "}", "if", "(", "metadata", "!=", "null", ")", "{", "JSONArray", "names", "=", "metadata", ".", "names", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "names", ".", "length", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "names", ".", "optString", "(", "i", ")", ";", "resourceProps", ".", "put", "(", "name", ",", "metadata", ".", "opt", "(", "name", ")", ")", ";", "foundAny", "=", "true", ";", "}", "}", "return", "foundAny", ";", "}" ]
Support legacy data structures where link metadata is stored as JSON fragment in single HTML5 data attribute. @param resourceProps ValueMap to write link metadata to @param element Link element
[ "Support", "legacy", "data", "structures", "where", "link", "metadata", "is", "stored", "as", "JSON", "fragment", "in", "single", "HTML5", "data", "attribute", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L257-L283
UrielCh/ovh-java-sdk
ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java
ApiOvhMsServices.serviceName_exchange_PUT
public void serviceName_exchange_PUT(String serviceName, OvhExchangeService body) throws IOException { """ Alter this object properties REST: PUT /msServices/{serviceName}/exchange @param body [required] New object properties @param serviceName [required] The internal name of your Active Directory organization API beta """ String qPath = "/msServices/{serviceName}/exchange"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_exchange_PUT(String serviceName, OvhExchangeService body) throws IOException { String qPath = "/msServices/{serviceName}/exchange"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_exchange_PUT", "(", "String", "serviceName", ",", "OvhExchangeService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/msServices/{serviceName}/exchange\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /msServices/{serviceName}/exchange @param body [required] New object properties @param serviceName [required] The internal name of your Active Directory organization API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L543-L547
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.incorrectMethodDefinition
public static void incorrectMethodDefinition(String methodName, String className) { """ Thrown when the method don't respects the convetions beloging to the dynamic conversion implementation. @param methodName method name @param className class name """ throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className)); }
java
public static void incorrectMethodDefinition(String methodName, String className){ throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className)); }
[ "public", "static", "void", "incorrectMethodDefinition", "(", "String", "methodName", ",", "String", "className", ")", "{", "throw", "new", "DynamicConversionMethodException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "dynamicConversionMethodException", ",", "methodName", ",", "className", ")", ")", ";", "}" ]
Thrown when the method don't respects the convetions beloging to the dynamic conversion implementation. @param methodName method name @param className class name
[ "Thrown", "when", "the", "method", "don", "t", "respects", "the", "convetions", "beloging", "to", "the", "dynamic", "conversion", "implementation", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L222-L224
netty/netty-tcnative
openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java
SSL.setTlsExtHostName
public static void setTlsExtHostName(long ssl, String hostname) { """ Call SSL_set_tlsext_host_name @param ssl the SSL instance (SSL *) @param hostname the hostname """ if (hostname != null && hostname.endsWith(".")) { // Strip trailing dot if included. // See https://github.com/netty/netty-tcnative/issues/400 hostname = hostname.substring(0, hostname.length() - 1); } setTlsExtHostName0(ssl, hostname); }
java
public static void setTlsExtHostName(long ssl, String hostname) { if (hostname != null && hostname.endsWith(".")) { // Strip trailing dot if included. // See https://github.com/netty/netty-tcnative/issues/400 hostname = hostname.substring(0, hostname.length() - 1); } setTlsExtHostName0(ssl, hostname); }
[ "public", "static", "void", "setTlsExtHostName", "(", "long", "ssl", ",", "String", "hostname", ")", "{", "if", "(", "hostname", "!=", "null", "&&", "hostname", ".", "endsWith", "(", "\".\"", ")", ")", "{", "// Strip trailing dot if included.", "// See https://github.com/netty/netty-tcnative/issues/400", "hostname", "=", "hostname", ".", "substring", "(", "0", ",", "hostname", ".", "length", "(", ")", "-", "1", ")", ";", "}", "setTlsExtHostName0", "(", "ssl", ",", "hostname", ")", ";", "}" ]
Call SSL_set_tlsext_host_name @param ssl the SSL instance (SSL *) @param hostname the hostname
[ "Call", "SSL_set_tlsext_host_name" ]
train
https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java#L564-L571
Jasig/uPortal
uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java
PropertiesManager.getPropertyAsInt
public static int getPropertyAsInt(String name) throws MissingPropertyException, BadPropertyException { """ Returns the value of a property for a given name as an <code>int</code> @param name the name of the requested property @return value the property's value as an <code>int</code> @throws MissingPropertyException - if the property is not set @throws BadPropertyException - if the property cannot be parsed as an int """ if (PropertiesManager.props == null) loadProps(); try { return Integer.parseInt(getProperty(name)); } catch (NumberFormatException nfe) { throw new BadPropertyException(name, getProperty(name), "int"); } }
java
public static int getPropertyAsInt(String name) throws MissingPropertyException, BadPropertyException { if (PropertiesManager.props == null) loadProps(); try { return Integer.parseInt(getProperty(name)); } catch (NumberFormatException nfe) { throw new BadPropertyException(name, getProperty(name), "int"); } }
[ "public", "static", "int", "getPropertyAsInt", "(", "String", "name", ")", "throws", "MissingPropertyException", ",", "BadPropertyException", "{", "if", "(", "PropertiesManager", ".", "props", "==", "null", ")", "loadProps", "(", ")", ";", "try", "{", "return", "Integer", ".", "parseInt", "(", "getProperty", "(", "name", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "throw", "new", "BadPropertyException", "(", "name", ",", "getProperty", "(", "name", ")", ",", "\"int\"", ")", ";", "}", "}" ]
Returns the value of a property for a given name as an <code>int</code> @param name the name of the requested property @return value the property's value as an <code>int</code> @throws MissingPropertyException - if the property is not set @throws BadPropertyException - if the property cannot be parsed as an int
[ "Returns", "the", "value", "of", "a", "property", "for", "a", "given", "name", "as", "an", "<code", ">", "int<", "/", "code", ">" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L237-L245
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.addToCreateElements
private void addToCreateElements(String elementName) { """ Creates a class based on a {@link XsdElement} if it wasn't been already. @param elementName The name of the element. """ HashMap<String, String> elementAttributes = new HashMap<>(); elementAttributes.put(XsdAbstractElement.NAME_TAG, elementName); if (!createdElements.containsKey(getCleanName(elementName))){ createdElements.put(getCleanName(elementName), new XsdElement(null, elementAttributes)); } }
java
private void addToCreateElements(String elementName) { HashMap<String, String> elementAttributes = new HashMap<>(); elementAttributes.put(XsdAbstractElement.NAME_TAG, elementName); if (!createdElements.containsKey(getCleanName(elementName))){ createdElements.put(getCleanName(elementName), new XsdElement(null, elementAttributes)); } }
[ "private", "void", "addToCreateElements", "(", "String", "elementName", ")", "{", "HashMap", "<", "String", ",", "String", ">", "elementAttributes", "=", "new", "HashMap", "<>", "(", ")", ";", "elementAttributes", ".", "put", "(", "XsdAbstractElement", ".", "NAME_TAG", ",", "elementName", ")", ";", "if", "(", "!", "createdElements", ".", "containsKey", "(", "getCleanName", "(", "elementName", ")", ")", ")", "{", "createdElements", ".", "put", "(", "getCleanName", "(", "elementName", ")", ",", "new", "XsdElement", "(", "null", ",", "elementAttributes", ")", ")", ";", "}", "}" ]
Creates a class based on a {@link XsdElement} if it wasn't been already. @param elementName The name of the element.
[ "Creates", "a", "class", "based", "on", "a", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L811-L819
dropwizard/metrics
metrics-jersey2/src/main/java/com/codahale/metrics/jersey2/MetricsFeature.java
MetricsFeature.configure
@Override public boolean configure(FeatureContext context) { """ A call-back method called when the feature is to be enabled in a given runtime configuration scope. <p> The responsibility of the feature is to properly update the supplied runtime configuration context and return {@code true} if the feature was successfully enabled or {@code false} otherwise. <p> Note that under some circumstances the feature may decide not to enable itself, which is indicated by returning {@code false}. In such case the configuration context does not add the feature to the collection of enabled features and a subsequent call to {@link javax.ws.rs.core.Configuration#isEnabled(javax.ws.rs.core.Feature)} or {@link javax.ws.rs.core.Configuration#isEnabled(Class)} method would return {@code false}. <p> @param context configurable context in which the feature should be enabled. @return {@code true} if the feature was successfully enabled, {@code false} otherwise. """ context.register(new InstrumentedResourceMethodApplicationListener(registry, clock, trackFilters)); return true; }
java
@Override public boolean configure(FeatureContext context) { context.register(new InstrumentedResourceMethodApplicationListener(registry, clock, trackFilters)); return true; }
[ "@", "Override", "public", "boolean", "configure", "(", "FeatureContext", "context", ")", "{", "context", ".", "register", "(", "new", "InstrumentedResourceMethodApplicationListener", "(", "registry", ",", "clock", ",", "trackFilters", ")", ")", ";", "return", "true", ";", "}" ]
A call-back method called when the feature is to be enabled in a given runtime configuration scope. <p> The responsibility of the feature is to properly update the supplied runtime configuration context and return {@code true} if the feature was successfully enabled or {@code false} otherwise. <p> Note that under some circumstances the feature may decide not to enable itself, which is indicated by returning {@code false}. In such case the configuration context does not add the feature to the collection of enabled features and a subsequent call to {@link javax.ws.rs.core.Configuration#isEnabled(javax.ws.rs.core.Feature)} or {@link javax.ws.rs.core.Configuration#isEnabled(Class)} method would return {@code false}. <p> @param context configurable context in which the feature should be enabled. @return {@code true} if the feature was successfully enabled, {@code false} otherwise.
[ "A", "call", "-", "back", "method", "called", "when", "the", "feature", "is", "to", "be", "enabled", "in", "a", "given", "runtime", "configuration", "scope", ".", "<p", ">", "The", "responsibility", "of", "the", "feature", "is", "to", "properly", "update", "the", "supplied", "runtime", "configuration", "context", "and", "return", "{", "@code", "true", "}", "if", "the", "feature", "was", "successfully", "enabled", "or", "{", "@code", "false", "}", "otherwise", ".", "<p", ">", "Note", "that", "under", "some", "circumstances", "the", "feature", "may", "decide", "not", "to", "enable", "itself", "which", "is", "indicated", "by", "returning", "{", "@code", "false", "}", ".", "In", "such", "case", "the", "configuration", "context", "does", "not", "add", "the", "feature", "to", "the", "collection", "of", "enabled", "features", "and", "a", "subsequent", "call", "to", "{", "@link", "javax", ".", "ws", ".", "rs", ".", "core", ".", "Configuration#isEnabled", "(", "javax", ".", "ws", ".", "rs", ".", "core", ".", "Feature", ")", "}", "or", "{", "@link", "javax", ".", "ws", ".", "rs", ".", "core", ".", "Configuration#isEnabled", "(", "Class", ")", "}", "method", "would", "return", "{", "@code", "false", "}", ".", "<p", ">" ]
train
https://github.com/dropwizard/metrics/blob/3c6105a0b9b4416c59e16b6b841b123052d6f57d/metrics-jersey2/src/main/java/com/codahale/metrics/jersey2/MetricsFeature.java#L57-L61
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCircuitPeeringsInner.java
ExpressRouteCircuitPeeringsInner.createOrUpdateAsync
public Observable<ExpressRouteCircuitPeeringInner> createOrUpdateAsync(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeeringInner peeringParameters) { """ Creates or updates a peering in the specified express route circuits. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param peeringParameters Parameters supplied to the create or update express route circuit peering operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, peeringParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitPeeringInner>, ExpressRouteCircuitPeeringInner>() { @Override public ExpressRouteCircuitPeeringInner call(ServiceResponse<ExpressRouteCircuitPeeringInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitPeeringInner> createOrUpdateAsync(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeeringInner peeringParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, peeringParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitPeeringInner>, ExpressRouteCircuitPeeringInner>() { @Override public ExpressRouteCircuitPeeringInner call(ServiceResponse<ExpressRouteCircuitPeeringInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitPeeringInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ",", "ExpressRouteCircuitPeeringInner", "peeringParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName", ",", "peeringName", ",", "peeringParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ExpressRouteCircuitPeeringInner", ">", ",", "ExpressRouteCircuitPeeringInner", ">", "(", ")", "{", "@", "Override", "public", "ExpressRouteCircuitPeeringInner", "call", "(", "ServiceResponse", "<", "ExpressRouteCircuitPeeringInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a peering in the specified express route circuits. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param peeringParameters Parameters supplied to the create or update express route circuit peering operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "peering", "in", "the", "specified", "express", "route", "circuits", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCircuitPeeringsInner.java#L391-L398
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiCollaboration.java
BoxApiCollaboration.getAddToFileRequest
public BoxRequestsShare.AddCollaboration getAddToFileRequest(String fileId, BoxCollaboration.Role role, BoxCollaborator collaborator) { """ A request that adds a {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} as a collaborator to a file. @param fileId id of the file to be collaborated. @param role role of the collaboration @param collaborator the {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} to add as a collaborator @return request to add/create a collaboration """ return new BoxRequestsShare.AddCollaboration(getCollaborationsUrl(), BoxFile.createFromId(fileId), role, collaborator, mSession); }
java
public BoxRequestsShare.AddCollaboration getAddToFileRequest(String fileId, BoxCollaboration.Role role, BoxCollaborator collaborator) { return new BoxRequestsShare.AddCollaboration(getCollaborationsUrl(), BoxFile.createFromId(fileId), role, collaborator, mSession); }
[ "public", "BoxRequestsShare", ".", "AddCollaboration", "getAddToFileRequest", "(", "String", "fileId", ",", "BoxCollaboration", ".", "Role", "role", ",", "BoxCollaborator", "collaborator", ")", "{", "return", "new", "BoxRequestsShare", ".", "AddCollaboration", "(", "getCollaborationsUrl", "(", ")", ",", "BoxFile", ".", "createFromId", "(", "fileId", ")", ",", "role", ",", "collaborator", ",", "mSession", ")", ";", "}" ]
A request that adds a {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} as a collaborator to a file. @param fileId id of the file to be collaborated. @param role role of the collaboration @param collaborator the {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} to add as a collaborator @return request to add/create a collaboration
[ "A", "request", "that", "adds", "a", "{" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiCollaboration.java#L86-L89
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Transaction.java
Transaction.addOutput
public TransactionOutput addOutput(Coin value, Script script) { """ Creates an output that pays to the given script. The address and key forms are specialisations of this method, you won't normally need to use it unless you're doing unusual things. """ return addOutput(new TransactionOutput(params, this, value, script.getProgram())); }
java
public TransactionOutput addOutput(Coin value, Script script) { return addOutput(new TransactionOutput(params, this, value, script.getProgram())); }
[ "public", "TransactionOutput", "addOutput", "(", "Coin", "value", ",", "Script", "script", ")", "{", "return", "addOutput", "(", "new", "TransactionOutput", "(", "params", ",", "this", ",", "value", ",", "script", ".", "getProgram", "(", ")", ")", ")", ";", "}" ]
Creates an output that pays to the given script. The address and key forms are specialisations of this method, you won't normally need to use it unless you're doing unusual things.
[ "Creates", "an", "output", "that", "pays", "to", "the", "given", "script", ".", "The", "address", "and", "key", "forms", "are", "specialisations", "of", "this", "method", "you", "won", "t", "normally", "need", "to", "use", "it", "unless", "you", "re", "doing", "unusual", "things", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1057-L1059
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.ifTrue
public PropertyConstraint ifTrue(PropertyConstraint ifConstraint, PropertyConstraint thenConstraint, String type) { """ Returns a ConditionalPropertyConstraint: one property will trigger the validation of another. @see ConditionalPropertyConstraint """ return new ConditionalPropertyConstraint(ifConstraint, thenConstraint, type); }
java
public PropertyConstraint ifTrue(PropertyConstraint ifConstraint, PropertyConstraint thenConstraint, String type) { return new ConditionalPropertyConstraint(ifConstraint, thenConstraint, type); }
[ "public", "PropertyConstraint", "ifTrue", "(", "PropertyConstraint", "ifConstraint", ",", "PropertyConstraint", "thenConstraint", ",", "String", "type", ")", "{", "return", "new", "ConditionalPropertyConstraint", "(", "ifConstraint", ",", "thenConstraint", ",", "type", ")", ";", "}" ]
Returns a ConditionalPropertyConstraint: one property will trigger the validation of another. @see ConditionalPropertyConstraint
[ "Returns", "a", "ConditionalPropertyConstraint", ":", "one", "property", "will", "trigger", "the", "validation", "of", "another", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L318-L320
square/pollexor
src/main/java/com/squareup/pollexor/Utilities.java
Utilities.normalizeString
static String normalizeString(String string, int desiredLength) { """ Normalize a string to a desired length by repeatedly appending itself and/or truncating. @param string Input string. @param desiredLength Desired length of string. @return Output string which is guaranteed to have a length equal to the desired length argument. @throws IllegalArgumentException if {@code string} is blank or {@code desiredLength} is not greater than 0. """ if (string == null || string.length() == 0) { throw new IllegalArgumentException("Must supply a non-null, non-empty string."); } if (desiredLength <= 0) { throw new IllegalArgumentException("Desired length must be greater than zero."); } if (string.length() >= desiredLength) { return string.substring(0, desiredLength); } else { StringBuilder builder = new StringBuilder(string); while (builder.length() < desiredLength) { builder.append(string); } return builder.substring(0, desiredLength); } }
java
static String normalizeString(String string, int desiredLength) { if (string == null || string.length() == 0) { throw new IllegalArgumentException("Must supply a non-null, non-empty string."); } if (desiredLength <= 0) { throw new IllegalArgumentException("Desired length must be greater than zero."); } if (string.length() >= desiredLength) { return string.substring(0, desiredLength); } else { StringBuilder builder = new StringBuilder(string); while (builder.length() < desiredLength) { builder.append(string); } return builder.substring(0, desiredLength); } }
[ "static", "String", "normalizeString", "(", "String", "string", ",", "int", "desiredLength", ")", "{", "if", "(", "string", "==", "null", "||", "string", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Must supply a non-null, non-empty string.\"", ")", ";", "}", "if", "(", "desiredLength", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Desired length must be greater than zero.\"", ")", ";", "}", "if", "(", "string", ".", "length", "(", ")", ">=", "desiredLength", ")", "{", "return", "string", ".", "substring", "(", "0", ",", "desiredLength", ")", ";", "}", "else", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "string", ")", ";", "while", "(", "builder", ".", "length", "(", ")", "<", "desiredLength", ")", "{", "builder", ".", "append", "(", "string", ")", ";", "}", "return", "builder", ".", "substring", "(", "0", ",", "desiredLength", ")", ";", "}", "}" ]
Normalize a string to a desired length by repeatedly appending itself and/or truncating. @param string Input string. @param desiredLength Desired length of string. @return Output string which is guaranteed to have a length equal to the desired length argument. @throws IllegalArgumentException if {@code string} is blank or {@code desiredLength} is not greater than 0.
[ "Normalize", "a", "string", "to", "a", "desired", "length", "by", "repeatedly", "appending", "itself", "and", "/", "or", "truncating", "." ]
train
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L109-L125
pravega/pravega
controller/src/main/java/io/pravega/controller/store/stream/records/RecordHelper.java
RecordHelper.validateStreamCut
public static void validateStreamCut(List<Map.Entry<Double, Double>> streamCutSegments) { """ Method to validate a given stream Cut. A stream cut is valid if it covers the entire key space without any overlaps in ranges for segments that form the streamcut. It throws {@link IllegalArgumentException} if the supplied stream cut does not satisfy the invariants. @param streamCutSegments supplied stream cut. """ // verify that stream cut covers the entire range of 0.0 to 1.0 keyspace without overlaps. List<Map.Entry<Double, Double>> reduced = reduce(streamCutSegments); Exceptions.checkArgument(reduced.size() == 1 && reduced.get(0).getKey().equals(0.0) && reduced.get(0).getValue().equals(1.0), "streamCut", " Invalid input, Stream Cut does not cover full key range."); }
java
public static void validateStreamCut(List<Map.Entry<Double, Double>> streamCutSegments) { // verify that stream cut covers the entire range of 0.0 to 1.0 keyspace without overlaps. List<Map.Entry<Double, Double>> reduced = reduce(streamCutSegments); Exceptions.checkArgument(reduced.size() == 1 && reduced.get(0).getKey().equals(0.0) && reduced.get(0).getValue().equals(1.0), "streamCut", " Invalid input, Stream Cut does not cover full key range."); }
[ "public", "static", "void", "validateStreamCut", "(", "List", "<", "Map", ".", "Entry", "<", "Double", ",", "Double", ">", ">", "streamCutSegments", ")", "{", "// verify that stream cut covers the entire range of 0.0 to 1.0 keyspace without overlaps.", "List", "<", "Map", ".", "Entry", "<", "Double", ",", "Double", ">", ">", "reduced", "=", "reduce", "(", "streamCutSegments", ")", ";", "Exceptions", ".", "checkArgument", "(", "reduced", ".", "size", "(", ")", "==", "1", "&&", "reduced", ".", "get", "(", "0", ")", ".", "getKey", "(", ")", ".", "equals", "(", "0.0", ")", "&&", "reduced", ".", "get", "(", "0", ")", ".", "getValue", "(", ")", ".", "equals", "(", "1.0", ")", ",", "\"streamCut\"", ",", "\" Invalid input, Stream Cut does not cover full key range.\"", ")", ";", "}" ]
Method to validate a given stream Cut. A stream cut is valid if it covers the entire key space without any overlaps in ranges for segments that form the streamcut. It throws {@link IllegalArgumentException} if the supplied stream cut does not satisfy the invariants. @param streamCutSegments supplied stream cut.
[ "Method", "to", "validate", "a", "given", "stream", "Cut", ".", "A", "stream", "cut", "is", "valid", "if", "it", "covers", "the", "entire", "key", "space", "without", "any", "overlaps", "in", "ranges", "for", "segments", "that", "form", "the", "streamcut", ".", "It", "throws", "{", "@link", "IllegalArgumentException", "}", "if", "the", "supplied", "stream", "cut", "does", "not", "satisfy", "the", "invariants", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/records/RecordHelper.java#L174-L180
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.appLaunched
public static void appLaunched(Context context, ShowRateDialogCondition showRateDialogCondition, Options options) { """ Tells RMP-Appirater that the app has launched. <p/> Rating dialog is shown after calling this method. @param context Context @param showRateDialogCondition Showing rate dialog condition. @param options RMP-Appirater options. """ appLaunched(context, showRateDialogCondition, options, null); }
java
public static void appLaunched(Context context, ShowRateDialogCondition showRateDialogCondition, Options options) { appLaunched(context, showRateDialogCondition, options, null); }
[ "public", "static", "void", "appLaunched", "(", "Context", "context", ",", "ShowRateDialogCondition", "showRateDialogCondition", ",", "Options", "options", ")", "{", "appLaunched", "(", "context", ",", "showRateDialogCondition", ",", "options", ",", "null", ")", ";", "}" ]
Tells RMP-Appirater that the app has launched. <p/> Rating dialog is shown after calling this method. @param context Context @param showRateDialogCondition Showing rate dialog condition. @param options RMP-Appirater options.
[ "Tells", "RMP", "-", "Appirater", "that", "the", "app", "has", "launched", ".", "<p", "/", ">", "Rating", "dialog", "is", "shown", "after", "calling", "this", "method", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L96-L98
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.recoverDeletedCertificateAsync
public ServiceFuture<CertificateBundle> recoverDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateBundle> serviceCallback) { """ Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the deleted certificate @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(recoverDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
java
public ServiceFuture<CertificateBundle> recoverDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateBundle> serviceCallback) { return ServiceFuture.fromResponse(recoverDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificateBundle", ">", "recoverDeletedCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "final", "ServiceCallback", "<", "CertificateBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "recoverDeletedCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ")", ",", "serviceCallback", ")", ";", "}" ]
Recovers the deleted certificate back to its current version under /certificates. The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the deleted certificate @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Recovers", "the", "deleted", "certificate", "back", "to", "its", "current", "version", "under", "/", "certificates", ".", "The", "RecoverDeletedCertificate", "operation", "performs", "the", "reversal", "of", "the", "Delete", "operation", ".", "The", "operation", "is", "applicable", "in", "vaults", "enabled", "for", "soft", "-", "delete", "and", "must", "be", "issued", "during", "the", "retention", "interval", "(", "available", "in", "the", "deleted", "certificate", "s", "attributes", ")", ".", "This", "operation", "requires", "the", "certificates", "/", "recover", "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#L8723-L8725
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.beginCreateOrUpdateAsync
public Observable<DatabaseAccountInner> beginCreateOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { """ Creates or updates an Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param createUpdateParameters The parameters to provide for the current database account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseAccountInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() { @Override public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) { return response.body(); } }); }
java
public Observable<DatabaseAccountInner> beginCreateOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() { @Override public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabaseAccountInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "DatabaseAccountCreateUpdateParameters", "createUpdateParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "createUpdateParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DatabaseAccountInner", ">", ",", "DatabaseAccountInner", ">", "(", ")", "{", "@", "Override", "public", "DatabaseAccountInner", "call", "(", "ServiceResponse", "<", "DatabaseAccountInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates an Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param createUpdateParameters The parameters to provide for the current database account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseAccountInner object
[ "Creates", "or", "updates", "an", "Azure", "Cosmos", "DB", "database", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L549-L556
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java
ArtifactResource.updateDownloadUrl
@POST @Path("/ { """ Update an artifact download url. This method is call via GET <grapes_url>/artifact/<gavc>/downloadurl?url=<targetUrl> @param credential DbCredential @param gavc String @param downLoadUrl String @return Response """gavc}" + ServerAPI.GET_DOWNLOAD_URL) public Response updateDownloadUrl(@Auth final DbCredential credential, @PathParam("gavc") final String gavc, @QueryParam(ServerAPI.URL_PARAM) final String downLoadUrl){ if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } if(LOG.isInfoEnabled()) { LOG.info(String.format("Got an update downloadUrl request [%s] [%s]", gavc, downLoadUrl)); } if(gavc == null || downLoadUrl == null){ return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build(); } getArtifactHandler().updateDownLoadUrl(gavc, downLoadUrl); return Response.ok("done").build(); }
java
@POST @Path("/{gavc}" + ServerAPI.GET_DOWNLOAD_URL) public Response updateDownloadUrl(@Auth final DbCredential credential, @PathParam("gavc") final String gavc, @QueryParam(ServerAPI.URL_PARAM) final String downLoadUrl){ if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } if(LOG.isInfoEnabled()) { LOG.info(String.format("Got an update downloadUrl request [%s] [%s]", gavc, downLoadUrl)); } if(gavc == null || downLoadUrl == null){ return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build(); } getArtifactHandler().updateDownLoadUrl(gavc, downLoadUrl); return Response.ok("done").build(); }
[ "@", "POST", "@", "Path", "(", "\"/{gavc}\"", "+", "ServerAPI", ".", "GET_DOWNLOAD_URL", ")", "public", "Response", "updateDownloadUrl", "(", "@", "Auth", "final", "DbCredential", "credential", ",", "@", "PathParam", "(", "\"gavc\"", ")", "final", "String", "gavc", ",", "@", "QueryParam", "(", "ServerAPI", ".", "URL_PARAM", ")", "final", "String", "downLoadUrl", ")", "{", "if", "(", "!", "credential", ".", "getRoles", "(", ")", ".", "contains", "(", "AvailableRoles", ".", "DATA_UPDATER", ")", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "status", "(", "Response", ".", "Status", ".", "UNAUTHORIZED", ")", ".", "build", "(", ")", ")", ";", "}", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "String", ".", "format", "(", "\"Got an update downloadUrl request [%s] [%s]\"", ",", "gavc", ",", "downLoadUrl", ")", ")", ";", "}", "if", "(", "gavc", "==", "null", "||", "downLoadUrl", "==", "null", ")", "{", "return", "Response", ".", "serverError", "(", ")", ".", "status", "(", "HttpStatus", ".", "NOT_ACCEPTABLE_406", ")", ".", "build", "(", ")", ";", "}", "getArtifactHandler", "(", ")", ".", "updateDownLoadUrl", "(", "gavc", ",", "downLoadUrl", ")", ";", "return", "Response", ".", "ok", "(", "\"done\"", ")", ".", "build", "(", ")", ";", "}" ]
Update an artifact download url. This method is call via GET <grapes_url>/artifact/<gavc>/downloadurl?url=<targetUrl> @param credential DbCredential @param gavc String @param downLoadUrl String @return Response
[ "Update", "an", "artifact", "download", "url", ".", "This", "method", "is", "call", "via", "GET", "<grapes_url", ">", "/", "artifact", "/", "<gavc", ">", "/", "downloadurl?url", "=", "<targetUrl", ">" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java#L329-L347
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/function/Actions.java
Actions.toFunc
public static <T1, T2, T3, T4> Func4<T1, T2, T3, T4, Void> toFunc(final Action4<T1, T2, T3, T4> action) { """ Converts an {@link Action4} to a function that calls the action and returns {@code null}. @param action the {@link Action4} to convert @return a {@link Func4} that calls {@code action} and returns {@code null} """ return toFunc(action, (Void) null); }
java
public static <T1, T2, T3, T4> Func4<T1, T2, T3, T4, Void> toFunc(final Action4<T1, T2, T3, T4> action) { return toFunc(action, (Void) null); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ">", "Func4", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "Void", ">", "toFunc", "(", "final", "Action4", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ">", "action", ")", "{", "return", "toFunc", "(", "action", ",", "(", "Void", ")", "null", ")", ";", "}" ]
Converts an {@link Action4} to a function that calls the action and returns {@code null}. @param action the {@link Action4} to convert @return a {@link Func4} that calls {@code action} and returns {@code null}
[ "Converts", "an", "{", "@link", "Action4", "}", "to", "a", "function", "that", "calls", "the", "action", "and", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L125-L127
bbossgroups/bboss-elasticsearch
bboss-elasticsearch/src/main/java/org/frameworkset/elasticsearch/event/EventBuilder.java
EventBuilder.withBody
public static Event withBody(Object body, Map<String, String> headers) { """ Instantiate an Event instance based on the provided body and headers. If <code>headers</code> is <code>null</code>, then it is ignored. @param body @param headers @return """ Event event = new SimpleEvent(body); // if (body == null) { // body = null; // } // event.setBody(body); if (headers != null) { event.setHeaders(new HashMap<String, String>(headers)); } return event; }
java
public static Event withBody(Object body, Map<String, String> headers) { Event event = new SimpleEvent(body); // if (body == null) { // body = null; // } // event.setBody(body); if (headers != null) { event.setHeaders(new HashMap<String, String>(headers)); } return event; }
[ "public", "static", "Event", "withBody", "(", "Object", "body", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "{", "Event", "event", "=", "new", "SimpleEvent", "(", "body", ")", ";", "// if (body == null) {", "// body = null;", "// }", "// event.setBody(body);", "if", "(", "headers", "!=", "null", ")", "{", "event", ".", "setHeaders", "(", "new", "HashMap", "<", "String", ",", "String", ">", "(", "headers", ")", ")", ";", "}", "return", "event", ";", "}" ]
Instantiate an Event instance based on the provided body and headers. If <code>headers</code> is <code>null</code>, then it is ignored. @param body @param headers @return
[ "Instantiate", "an", "Event", "instance", "based", "on", "the", "provided", "body", "and", "headers", ".", "If", "<code", ">", "headers<", "/", "code", ">", "is", "<code", ">", "null<", "/", "code", ">", "then", "it", "is", "ignored", "." ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch/src/main/java/org/frameworkset/elasticsearch/event/EventBuilder.java#L34-L47
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/DoubleCheckedLocking.java
DoubleCheckedLocking.getChild
private static <T> T getChild(StatementTree tree, final Class<T> clazz) { """ Visits (possibly nested) block statements and returns the first child statement with the given class. """ return tree.accept( new SimpleTreeVisitor<T, Void>() { @Override protected T defaultAction(Tree node, Void p) { if (clazz.isInstance(node)) { return clazz.cast(node); } return null; } @Override public T visitBlock(BlockTree node, Void p) { return visit(node.getStatements()); } private T visit(List<? extends Tree> tx) { for (Tree t : tx) { T r = t.accept(this, null); if (r != null) { return r; } } return null; } }, null); }
java
private static <T> T getChild(StatementTree tree, final Class<T> clazz) { return tree.accept( new SimpleTreeVisitor<T, Void>() { @Override protected T defaultAction(Tree node, Void p) { if (clazz.isInstance(node)) { return clazz.cast(node); } return null; } @Override public T visitBlock(BlockTree node, Void p) { return visit(node.getStatements()); } private T visit(List<? extends Tree> tx) { for (Tree t : tx) { T r = t.accept(this, null); if (r != null) { return r; } } return null; } }, null); }
[ "private", "static", "<", "T", ">", "T", "getChild", "(", "StatementTree", "tree", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "return", "tree", ".", "accept", "(", "new", "SimpleTreeVisitor", "<", "T", ",", "Void", ">", "(", ")", "{", "@", "Override", "protected", "T", "defaultAction", "(", "Tree", "node", ",", "Void", "p", ")", "{", "if", "(", "clazz", ".", "isInstance", "(", "node", ")", ")", "{", "return", "clazz", ".", "cast", "(", "node", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "public", "T", "visitBlock", "(", "BlockTree", "node", ",", "Void", "p", ")", "{", "return", "visit", "(", "node", ".", "getStatements", "(", ")", ")", ";", "}", "private", "T", "visit", "(", "List", "<", "?", "extends", "Tree", ">", "tx", ")", "{", "for", "(", "Tree", "t", ":", "tx", ")", "{", "T", "r", "=", "t", ".", "accept", "(", "this", ",", "null", ")", ";", "if", "(", "r", "!=", "null", ")", "{", "return", "r", ";", "}", "}", "return", "null", ";", "}", "}", ",", "null", ")", ";", "}" ]
Visits (possibly nested) block statements and returns the first child statement with the given class.
[ "Visits", "(", "possibly", "nested", ")", "block", "statements", "and", "returns", "the", "first", "child", "statement", "with", "the", "given", "class", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/DoubleCheckedLocking.java#L273-L300
playn/playn
scene/src/playn/scene/Layer.java
Layer.setOrigin
public Layer setOrigin (float x, float y) { """ Sets the origin of the layer to a fixed position. This automatically sets the layer's logical origin to {@link Origin#FIXED}. @param x origin on x axis in display units. @param y origin on y axis in display units. @return a reference to this layer for call chaining. """ this.originX = x; this.originY = y; this.origin = Origin.FIXED; setFlag(Flag.ODIRTY, false); return this; }
java
public Layer setOrigin (float x, float y) { this.originX = x; this.originY = y; this.origin = Origin.FIXED; setFlag(Flag.ODIRTY, false); return this; }
[ "public", "Layer", "setOrigin", "(", "float", "x", ",", "float", "y", ")", "{", "this", ".", "originX", "=", "x", ";", "this", ".", "originY", "=", "y", ";", "this", ".", "origin", "=", "Origin", ".", "FIXED", ";", "setFlag", "(", "Flag", ".", "ODIRTY", ",", "false", ")", ";", "return", "this", ";", "}" ]
Sets the origin of the layer to a fixed position. This automatically sets the layer's logical origin to {@link Origin#FIXED}. @param x origin on x axis in display units. @param y origin on y axis in display units. @return a reference to this layer for call chaining.
[ "Sets", "the", "origin", "of", "the", "layer", "to", "a", "fixed", "position", ".", "This", "automatically", "sets", "the", "layer", "s", "logical", "origin", "to", "{", "@link", "Origin#FIXED", "}", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/Layer.java#L387-L393
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java
LabsInner.listAsync
public Observable<Page<LabInner>> listAsync(final String resourceGroupName, final String labAccountName) { """ List labs in a given lab account. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;LabInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, labAccountName) .map(new Func1<ServiceResponse<Page<LabInner>>, Page<LabInner>>() { @Override public Page<LabInner> call(ServiceResponse<Page<LabInner>> response) { return response.body(); } }); }
java
public Observable<Page<LabInner>> listAsync(final String resourceGroupName, final String labAccountName) { return listWithServiceResponseAsync(resourceGroupName, labAccountName) .map(new Func1<ServiceResponse<Page<LabInner>>, Page<LabInner>>() { @Override public Page<LabInner> call(ServiceResponse<Page<LabInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "LabInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "labAccountName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "LabInner", ">", ">", ",", "Page", "<", "LabInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "LabInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "LabInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List labs in a given lab account. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;LabInner&gt; object
[ "List", "labs", "in", "a", "given", "lab", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L155-L163
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.findByUUID_G
@Override public CommerceCountry findByUUID_G(String uuid, long groupId) throws NoSuchCountryException { """ Returns the commerce country where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCountryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce country @throws NoSuchCountryException if a matching commerce country could not be found """ CommerceCountry commerceCountry = fetchByUUID_G(uuid, groupId); if (commerceCountry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCountryException(msg.toString()); } return commerceCountry; }
java
@Override public CommerceCountry findByUUID_G(String uuid, long groupId) throws NoSuchCountryException { CommerceCountry commerceCountry = fetchByUUID_G(uuid, groupId); if (commerceCountry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCountryException(msg.toString()); } return commerceCountry; }
[ "@", "Override", "public", "CommerceCountry", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCountryException", "{", "CommerceCountry", "commerceCountry", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "commerceCountry", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"uuid=\"", ")", ";", "msg", ".", "append", "(", "uuid", ")", ";", "msg", ".", "append", "(", "\", groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchCountryException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "commerceCountry", ";", "}" ]
Returns the commerce country where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCountryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce country @throws NoSuchCountryException if a matching commerce country could not be found
[ "Returns", "the", "commerce", "country", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCountryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L666-L692
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateClosedListAsync
public Observable<OperationStatus> updateClosedListAsync(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { """ Updates the closed list model. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param closedListModelUpdateObject The new entity name and words list. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateClosedListAsync(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateClosedListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "ClosedListModelUpdateObject", "closedListModelUpdateObject", ")", "{", "return", "updateClosedListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "clEntityId", ",", "closedListModelUpdateObject", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates the closed list model. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param closedListModelUpdateObject The new entity name and words list. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "the", "closed", "list", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4339-L4346
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java
CmsForm.createValidationHandler
private I_CmsValidationHandler createValidationHandler() { """ Creates a validation handler which updates the OK button state when validation results come in.<p> @return a validation handler """ return new I_CmsValidationHandler() { /** * @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationFinished(boolean) */ public void onValidationFinished(boolean ok) { m_formHandler.onValidationResult(CmsForm.this, noFieldsInvalid(m_fields.values())); } /** * @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationResult(java.lang.String, org.opencms.gwt.shared.CmsValidationResult) */ public void onValidationResult(String fieldId, CmsValidationResult result) { I_CmsFormField field = m_fields.get(fieldId); String modelId = field.getModelId(); updateModelValidationStatus(modelId, result); } }; }
java
private I_CmsValidationHandler createValidationHandler() { return new I_CmsValidationHandler() { /** * @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationFinished(boolean) */ public void onValidationFinished(boolean ok) { m_formHandler.onValidationResult(CmsForm.this, noFieldsInvalid(m_fields.values())); } /** * @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationResult(java.lang.String, org.opencms.gwt.shared.CmsValidationResult) */ public void onValidationResult(String fieldId, CmsValidationResult result) { I_CmsFormField field = m_fields.get(fieldId); String modelId = field.getModelId(); updateModelValidationStatus(modelId, result); } }; }
[ "private", "I_CmsValidationHandler", "createValidationHandler", "(", ")", "{", "return", "new", "I_CmsValidationHandler", "(", ")", "{", "/**\n * @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationFinished(boolean)\n */", "public", "void", "onValidationFinished", "(", "boolean", "ok", ")", "{", "m_formHandler", ".", "onValidationResult", "(", "CmsForm", ".", "this", ",", "noFieldsInvalid", "(", "m_fields", ".", "values", "(", ")", ")", ")", ";", "}", "/**\n * @see org.opencms.gwt.client.validation.I_CmsValidationHandler#onValidationResult(java.lang.String, org.opencms.gwt.shared.CmsValidationResult)\n */", "public", "void", "onValidationResult", "(", "String", "fieldId", ",", "CmsValidationResult", "result", ")", "{", "I_CmsFormField", "field", "=", "m_fields", ".", "get", "(", "fieldId", ")", ";", "String", "modelId", "=", "field", ".", "getModelId", "(", ")", ";", "updateModelValidationStatus", "(", "modelId", ",", "result", ")", ";", "}", "}", ";", "}" ]
Creates a validation handler which updates the OK button state when validation results come in.<p> @return a validation handler
[ "Creates", "a", "validation", "handler", "which", "updates", "the", "OK", "button", "state", "when", "validation", "results", "come", "in", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L546-L568
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/GreenPepperWiki.java
GreenPepperWiki.execute
@Override public String execute(@SuppressWarnings("rawtypes") Map parameters, String body, RenderContext renderContext) throws MacroException { """ Confluence 2 and 3 @param parameters @param body @param renderContext @return @throws MacroException """ try { return body; } catch (Exception e) { return getErrorView("greenpepper.info.macroid", e.getMessage()); } }
java
@Override public String execute(@SuppressWarnings("rawtypes") Map parameters, String body, RenderContext renderContext) throws MacroException { try { return body; } catch (Exception e) { return getErrorView("greenpepper.info.macroid", e.getMessage()); } }
[ "@", "Override", "public", "String", "execute", "(", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Map", "parameters", ",", "String", "body", ",", "RenderContext", "renderContext", ")", "throws", "MacroException", "{", "try", "{", "return", "body", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "getErrorView", "(", "\"greenpepper.info.macroid\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Confluence 2 and 3 @param parameters @param body @param renderContext @return @throws MacroException
[ "Confluence", "2", "and", "3" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/GreenPepperWiki.java#L59-L70
spotify/apollo
examples/spotify-api-example/src/main/java/com/spotify/apollo/example/ArtistResource.java
ArtistResource.parseTopTracks
private ArrayList<Track> parseTopTracks(String json) { """ Parses an artist top tracks response from the <a href="https://developer.spotify.com/web-api/get-artists-top-tracks/">Spotify API</a> @param json The json response @return A list of top tracks """ ArrayList<Track> tracks = new ArrayList<>(); try { JsonNode jsonNode = this.objectMapper.readTree(json); for (JsonNode trackNode : jsonNode.get("tracks")) { JsonNode albumNode = trackNode.get("album"); String albumName = albumNode.get("name").asText(); String artistName = trackNode.get("artists").get(0).get("name").asText(); String trackName = trackNode.get("name").asText(); tracks.add(new Track(trackName, new Album(albumName, new Artist(artistName)))); } } catch (IOException e) { throw new RuntimeException("Failed to parse JSON", e); } return tracks; }
java
private ArrayList<Track> parseTopTracks(String json) { ArrayList<Track> tracks = new ArrayList<>(); try { JsonNode jsonNode = this.objectMapper.readTree(json); for (JsonNode trackNode : jsonNode.get("tracks")) { JsonNode albumNode = trackNode.get("album"); String albumName = albumNode.get("name").asText(); String artistName = trackNode.get("artists").get(0).get("name").asText(); String trackName = trackNode.get("name").asText(); tracks.add(new Track(trackName, new Album(albumName, new Artist(artistName)))); } } catch (IOException e) { throw new RuntimeException("Failed to parse JSON", e); } return tracks; }
[ "private", "ArrayList", "<", "Track", ">", "parseTopTracks", "(", "String", "json", ")", "{", "ArrayList", "<", "Track", ">", "tracks", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "JsonNode", "jsonNode", "=", "this", ".", "objectMapper", ".", "readTree", "(", "json", ")", ";", "for", "(", "JsonNode", "trackNode", ":", "jsonNode", ".", "get", "(", "\"tracks\"", ")", ")", "{", "JsonNode", "albumNode", "=", "trackNode", ".", "get", "(", "\"album\"", ")", ";", "String", "albumName", "=", "albumNode", ".", "get", "(", "\"name\"", ")", ".", "asText", "(", ")", ";", "String", "artistName", "=", "trackNode", ".", "get", "(", "\"artists\"", ")", ".", "get", "(", "0", ")", ".", "get", "(", "\"name\"", ")", ".", "asText", "(", ")", ";", "String", "trackName", "=", "trackNode", ".", "get", "(", "\"name\"", ")", ".", "asText", "(", ")", ";", "tracks", ".", "add", "(", "new", "Track", "(", "trackName", ",", "new", "Album", "(", "albumName", ",", "new", "Artist", "(", "artistName", ")", ")", ")", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to parse JSON\"", ",", "e", ")", ";", "}", "return", "tracks", ";", "}" ]
Parses an artist top tracks response from the <a href="https://developer.spotify.com/web-api/get-artists-top-tracks/">Spotify API</a> @param json The json response @return A list of top tracks
[ "Parses", "an", "artist", "top", "tracks", "response", "from", "the", "<a", "href", "=", "https", ":", "//", "developer", ".", "spotify", ".", "com", "/", "web", "-", "api", "/", "get", "-", "artists", "-", "top", "-", "tracks", "/", ">", "Spotify", "API<", "/", "a", ">" ]
train
https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/examples/spotify-api-example/src/main/java/com/spotify/apollo/example/ArtistResource.java#L87-L103
micronaut-projects/micronaut-core
http-client/src/main/java/io/micronaut/http/client/multipart/StringPart.java
StringPart.getData
@Override InterfaceHttpData getData(HttpRequest request, HttpDataFactory factory) { """ Create an object of {@link InterfaceHttpData} to build Netty multipart request body. @see Part#getData(HttpRequest, HttpDataFactory) """ return factory.createAttribute(request, name, value); }
java
@Override InterfaceHttpData getData(HttpRequest request, HttpDataFactory factory) { return factory.createAttribute(request, name, value); }
[ "@", "Override", "InterfaceHttpData", "getData", "(", "HttpRequest", "request", ",", "HttpDataFactory", "factory", ")", "{", "return", "factory", ".", "createAttribute", "(", "request", ",", "name", ",", "value", ")", ";", "}" ]
Create an object of {@link InterfaceHttpData} to build Netty multipart request body. @see Part#getData(HttpRequest, HttpDataFactory)
[ "Create", "an", "object", "of", "{", "@link", "InterfaceHttpData", "}", "to", "build", "Netty", "multipart", "request", "body", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-client/src/main/java/io/micronaut/http/client/multipart/StringPart.java#L50-L53
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/IO.java
IO.copyThread
public static void copyThread(InputStream in, OutputStream out) { """ Copy Stream in to Stream out until EOF or exception. in own thread """ try{ instance().run(new Job(in,out)); } catch(InterruptedException e) { log.warn(LogSupport.EXCEPTION,e); } }
java
public static void copyThread(InputStream in, OutputStream out) { try{ instance().run(new Job(in,out)); } catch(InterruptedException e) { log.warn(LogSupport.EXCEPTION,e); } }
[ "public", "static", "void", "copyThread", "(", "InputStream", "in", ",", "OutputStream", "out", ")", "{", "try", "{", "instance", "(", ")", ".", "run", "(", "new", "Job", "(", "in", ",", "out", ")", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "log", ".", "warn", "(", "LogSupport", ".", "EXCEPTION", ",", "e", ")", ";", "}", "}" ]
Copy Stream in to Stream out until EOF or exception. in own thread
[ "Copy", "Stream", "in", "to", "Stream", "out", "until", "EOF", "or", "exception", ".", "in", "own", "thread" ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/IO.java#L86-L95
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.perspectiveFrustumSlice
public Matrix4f perspectiveFrustumSlice(float near, float far, Matrix4f dest) { """ Change the near and far clip plane distances of <code>this</code> perspective frustum transformation matrix and store the result in <code>dest</code>. <p> This method only works if <code>this</code> is a perspective projection frustum transformation, for example obtained via {@link #perspective(float, float, float, float) perspective()} or {@link #frustum(float, float, float, float, float, float) frustum()}. @see #perspective(float, float, float, float) @see #frustum(float, float, float, float, float, float) @param near the new near clip plane distance @param far the new far clip plane distance @param dest will hold the resulting matrix @return dest """ float invOldNear = (m23 + m22) / m32; float invNearFar = 1.0f / (near - far); dest._m00(m00 * invOldNear * near); dest._m01(m01); dest._m02(m02); dest._m03(m03); dest._m10(m10); dest._m11(m11 * invOldNear * near); dest._m12(m12); dest._m13(m13); dest._m20(m20); dest._m21(m21); dest._m22((far + near) * invNearFar); dest._m23(m23); dest._m30(m30); dest._m31(m31); dest._m32((far + far) * near * invNearFar); dest._m33(m33); dest._properties(properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION | PROPERTY_ORTHONORMAL)); return dest; }
java
public Matrix4f perspectiveFrustumSlice(float near, float far, Matrix4f dest) { float invOldNear = (m23 + m22) / m32; float invNearFar = 1.0f / (near - far); dest._m00(m00 * invOldNear * near); dest._m01(m01); dest._m02(m02); dest._m03(m03); dest._m10(m10); dest._m11(m11 * invOldNear * near); dest._m12(m12); dest._m13(m13); dest._m20(m20); dest._m21(m21); dest._m22((far + near) * invNearFar); dest._m23(m23); dest._m30(m30); dest._m31(m31); dest._m32((far + far) * near * invNearFar); dest._m33(m33); dest._properties(properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION | PROPERTY_ORTHONORMAL)); return dest; }
[ "public", "Matrix4f", "perspectiveFrustumSlice", "(", "float", "near", ",", "float", "far", ",", "Matrix4f", "dest", ")", "{", "float", "invOldNear", "=", "(", "m23", "+", "m22", ")", "/", "m32", ";", "float", "invNearFar", "=", "1.0f", "/", "(", "near", "-", "far", ")", ";", "dest", ".", "_m00", "(", "m00", "*", "invOldNear", "*", "near", ")", ";", "dest", ".", "_m01", "(", "m01", ")", ";", "dest", ".", "_m02", "(", "m02", ")", ";", "dest", ".", "_m03", "(", "m03", ")", ";", "dest", ".", "_m10", "(", "m10", ")", ";", "dest", ".", "_m11", "(", "m11", "*", "invOldNear", "*", "near", ")", ";", "dest", ".", "_m12", "(", "m12", ")", ";", "dest", ".", "_m13", "(", "m13", ")", ";", "dest", ".", "_m20", "(", "m20", ")", ";", "dest", ".", "_m21", "(", "m21", ")", ";", "dest", ".", "_m22", "(", "(", "far", "+", "near", ")", "*", "invNearFar", ")", ";", "dest", ".", "_m23", "(", "m23", ")", ";", "dest", ".", "_m30", "(", "m30", ")", ";", "dest", ".", "_m31", "(", "m31", ")", ";", "dest", ".", "_m32", "(", "(", "far", "+", "far", ")", "*", "near", "*", "invNearFar", ")", ";", "dest", ".", "_m33", "(", "m33", ")", ";", "dest", ".", "_properties", "(", "properties", "&", "~", "(", "PROPERTY_IDENTITY", "|", "PROPERTY_TRANSLATION", "|", "PROPERTY_ORTHONORMAL", ")", ")", ";", "return", "dest", ";", "}" ]
Change the near and far clip plane distances of <code>this</code> perspective frustum transformation matrix and store the result in <code>dest</code>. <p> This method only works if <code>this</code> is a perspective projection frustum transformation, for example obtained via {@link #perspective(float, float, float, float) perspective()} or {@link #frustum(float, float, float, float, float, float) frustum()}. @see #perspective(float, float, float, float) @see #frustum(float, float, float, float, float, float) @param near the new near clip plane distance @param far the new far clip plane distance @param dest will hold the resulting matrix @return dest
[ "Change", "the", "near", "and", "far", "clip", "plane", "distances", "of", "<code", ">", "this<", "/", "code", ">", "perspective", "frustum", "transformation", "matrix", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "This", "method", "only", "works", "if", "<code", ">", "this<", "/", "code", ">", "is", "a", "perspective", "projection", "frustum", "transformation", "for", "example", "obtained", "via", "{", "@link", "#perspective", "(", "float", "float", "float", "float", ")", "perspective", "()", "}", "or", "{", "@link", "#frustum", "(", "float", "float", "float", "float", "float", "float", ")", "frustum", "()", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L13839-L13860