repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java
TextRowProtocol.getInternalBoolean
public boolean getInternalBoolean(ColumnInformation columnInfo) { """ Get boolean from raw text format. @param columnInfo column information @return boolean value """ if (lastValueWasNull()) { return false; } if (columnInfo.getColumnType() == ColumnType.BIT) { return parseBit() != 0; } final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8); return !("false".equals(rawVal) || "0".equals(rawVal)); }
java
public boolean getInternalBoolean(ColumnInformation columnInfo) { if (lastValueWasNull()) { return false; } if (columnInfo.getColumnType() == ColumnType.BIT) { return parseBit() != 0; } final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8); return !("false".equals(rawVal) || "0".equals(rawVal)); }
[ "public", "boolean", "getInternalBoolean", "(", "ColumnInformation", "columnInfo", ")", "{", "if", "(", "lastValueWasNull", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "columnInfo", ".", "getColumnType", "(", ")", "==", "ColumnType", ".", "BIT", ")", "{", "return", "parseBit", "(", ")", "!=", "0", ";", "}", "final", "String", "rawVal", "=", "new", "String", "(", "buf", ",", "pos", ",", "length", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "return", "!", "(", "\"false\"", ".", "equals", "(", "rawVal", ")", "||", "\"0\"", ".", "equals", "(", "rawVal", ")", ")", ";", "}" ]
Get boolean from raw text format. @param columnInfo column information @return boolean value
[ "Get", "boolean", "from", "raw", "text", "format", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L797-L807
JoeKerouac/utils
src/main/java/com/joe/utils/cluster/redis/RedisClusterManagerFactory.java
RedisClusterManagerFactory.buildRedisConfig
public static RedisSingleServerConfig buildRedisConfig(String host, int port, String password) { """ 根据host、port、password构建一个redis单机配置文件 @param host redis host @param port redis port @param password redis password @return redis 单机配置文件 """ RedisSingleServerConfig config = new RedisSingleServerConfig(); config.setAddress(host + ":" + port); config.setPassword(password); return config; }
java
public static RedisSingleServerConfig buildRedisConfig(String host, int port, String password) { RedisSingleServerConfig config = new RedisSingleServerConfig(); config.setAddress(host + ":" + port); config.setPassword(password); return config; }
[ "public", "static", "RedisSingleServerConfig", "buildRedisConfig", "(", "String", "host", ",", "int", "port", ",", "String", "password", ")", "{", "RedisSingleServerConfig", "config", "=", "new", "RedisSingleServerConfig", "(", ")", ";", "config", ".", "setAddress", "(", "host", "+", "\":\"", "+", "port", ")", ";", "config", ".", "setPassword", "(", "password", ")", ";", "return", "config", ";", "}" ]
根据host、port、password构建一个redis单机配置文件 @param host redis host @param port redis port @param password redis password @return redis 单机配置文件
[ "根据host、port、password构建一个redis单机配置文件" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/cluster/redis/RedisClusterManagerFactory.java#L106-L111
aws/aws-sdk-java
aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/ListObjectParentsResult.java
ListObjectParentsResult.withParents
public ListObjectParentsResult withParents(java.util.Map<String, String> parents) { """ <p> The parent structure, which is a map with key as the <code>ObjectIdentifier</code> and LinkName as the value. </p> @param parents The parent structure, which is a map with key as the <code>ObjectIdentifier</code> and LinkName as the value. @return Returns a reference to this object so that method calls can be chained together. """ setParents(parents); return this; }
java
public ListObjectParentsResult withParents(java.util.Map<String, String> parents) { setParents(parents); return this; }
[ "public", "ListObjectParentsResult", "withParents", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "parents", ")", "{", "setParents", "(", "parents", ")", ";", "return", "this", ";", "}" ]
<p> The parent structure, which is a map with key as the <code>ObjectIdentifier</code> and LinkName as the value. </p> @param parents The parent structure, which is a map with key as the <code>ObjectIdentifier</code> and LinkName as the value. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "parent", "structure", "which", "is", "a", "map", "with", "key", "as", "the", "<code", ">", "ObjectIdentifier<", "/", "code", ">", "and", "LinkName", "as", "the", "value", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/ListObjectParentsResult.java#L83-L86
PawelAdamski/HttpClientMock
src/main/java/com/github/paweladamski/httpclientmock/HttpClientVerifyBuilder.java
HttpClientVerifyBuilder.withHeader
public HttpClientVerifyBuilder withHeader(String header, String value) { """ Adds header condition. Header must be equal to provided value. @param header header name @param value expected value @return verification builder """ return withHeader(header, equalTo(value)); }
java
public HttpClientVerifyBuilder withHeader(String header, String value) { return withHeader(header, equalTo(value)); }
[ "public", "HttpClientVerifyBuilder", "withHeader", "(", "String", "header", ",", "String", "value", ")", "{", "return", "withHeader", "(", "header", ",", "equalTo", "(", "value", ")", ")", ";", "}" ]
Adds header condition. Header must be equal to provided value. @param header header name @param value expected value @return verification builder
[ "Adds", "header", "condition", ".", "Header", "must", "be", "equal", "to", "provided", "value", "." ]
train
https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientVerifyBuilder.java#L29-L31
wildfly/wildfly-core
domain-management/src/main/java/org/jboss/as/domain/management/security/adduser/PropertyFileFinder.java
PropertyFileFinder.validatePermissions
private void validatePermissions(final File dirPath, final File file) { """ This method performs a series of permissions checks given a directory and properties file path. 1 - Check whether the parent directory dirPath has proper execute and read permissions 2 - Check whether properties file path is readable and writable If either of the permissions checks fail, update validFilePermissions and filePermissionsProblemPath appropriately. """ // Check execute and read permissions for parent dirPath if( !dirPath.canExecute() || !dirPath.canRead() ) { validFilePermissions = false; filePermissionsProblemPath = dirPath.getAbsolutePath(); return; } // Check read and write permissions for properties file if( !file.canRead() || !file.canWrite() ) { validFilePermissions = false; filePermissionsProblemPath = dirPath.getAbsolutePath(); } }
java
private void validatePermissions(final File dirPath, final File file) { // Check execute and read permissions for parent dirPath if( !dirPath.canExecute() || !dirPath.canRead() ) { validFilePermissions = false; filePermissionsProblemPath = dirPath.getAbsolutePath(); return; } // Check read and write permissions for properties file if( !file.canRead() || !file.canWrite() ) { validFilePermissions = false; filePermissionsProblemPath = dirPath.getAbsolutePath(); } }
[ "private", "void", "validatePermissions", "(", "final", "File", "dirPath", ",", "final", "File", "file", ")", "{", "// Check execute and read permissions for parent dirPath", "if", "(", "!", "dirPath", ".", "canExecute", "(", ")", "||", "!", "dirPath", ".", "canRead", "(", ")", ")", "{", "validFilePermissions", "=", "false", ";", "filePermissionsProblemPath", "=", "dirPath", ".", "getAbsolutePath", "(", ")", ";", "return", ";", "}", "// Check read and write permissions for properties file", "if", "(", "!", "file", ".", "canRead", "(", ")", "||", "!", "file", ".", "canWrite", "(", ")", ")", "{", "validFilePermissions", "=", "false", ";", "filePermissionsProblemPath", "=", "dirPath", ".", "getAbsolutePath", "(", ")", ";", "}", "}" ]
This method performs a series of permissions checks given a directory and properties file path. 1 - Check whether the parent directory dirPath has proper execute and read permissions 2 - Check whether properties file path is readable and writable If either of the permissions checks fail, update validFilePermissions and filePermissionsProblemPath appropriately.
[ "This", "method", "performs", "a", "series", "of", "permissions", "checks", "given", "a", "directory", "and", "properties", "file", "path", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/adduser/PropertyFileFinder.java#L293-L308
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.generateSecuredApiKey
@Deprecated public String generateSecuredApiKey(String privateApiKey, String tagFilters, String userToken) throws NoSuchAlgorithmException, InvalidKeyException, AlgoliaException { """ Generate a secured and public API Key from a list of tagFilters and an optional user token identifying the current user @param privateApiKey your private API Key @param tagFilters the list of tags applied to the query (used as security) @param userToken an optional token identifying the current user @deprecated Use `generateSecuredApiKey(String privateApiKey, Query query, String userToken)` version """ if (!tagFilters.contains("=")) return generateSecuredApiKey(privateApiKey, new Query().setTagFilters(tagFilters), userToken); else { if (userToken != null && userToken.length() > 0) { try { tagFilters = String.format("%s%s%s", tagFilters, "&userToken=", URLEncoder.encode(userToken, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(e.getMessage()); } } return Base64.encodeBase64String(String.format("%s%s", hmac(privateApiKey, tagFilters), tagFilters).getBytes(Charset.forName("UTF8"))); } }
java
@Deprecated public String generateSecuredApiKey(String privateApiKey, String tagFilters, String userToken) throws NoSuchAlgorithmException, InvalidKeyException, AlgoliaException { if (!tagFilters.contains("=")) return generateSecuredApiKey(privateApiKey, new Query().setTagFilters(tagFilters), userToken); else { if (userToken != null && userToken.length() > 0) { try { tagFilters = String.format("%s%s%s", tagFilters, "&userToken=", URLEncoder.encode(userToken, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(e.getMessage()); } } return Base64.encodeBase64String(String.format("%s%s", hmac(privateApiKey, tagFilters), tagFilters).getBytes(Charset.forName("UTF8"))); } }
[ "@", "Deprecated", "public", "String", "generateSecuredApiKey", "(", "String", "privateApiKey", ",", "String", "tagFilters", ",", "String", "userToken", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", ",", "AlgoliaException", "{", "if", "(", "!", "tagFilters", ".", "contains", "(", "\"=\"", ")", ")", "return", "generateSecuredApiKey", "(", "privateApiKey", ",", "new", "Query", "(", ")", ".", "setTagFilters", "(", "tagFilters", ")", ",", "userToken", ")", ";", "else", "{", "if", "(", "userToken", "!=", "null", "&&", "userToken", ".", "length", "(", ")", ">", "0", ")", "{", "try", "{", "tagFilters", "=", "String", ".", "format", "(", "\"%s%s%s\"", ",", "tagFilters", ",", "\"&userToken=\"", ",", "URLEncoder", ".", "encode", "(", "userToken", ",", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "AlgoliaException", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "return", "Base64", ".", "encodeBase64String", "(", "String", ".", "format", "(", "\"%s%s\"", ",", "hmac", "(", "privateApiKey", ",", "tagFilters", ")", ",", "tagFilters", ")", ".", "getBytes", "(", "Charset", ".", "forName", "(", "\"UTF8\"", ")", ")", ")", ";", "}", "}" ]
Generate a secured and public API Key from a list of tagFilters and an optional user token identifying the current user @param privateApiKey your private API Key @param tagFilters the list of tags applied to the query (used as security) @param userToken an optional token identifying the current user @deprecated Use `generateSecuredApiKey(String privateApiKey, Query query, String userToken)` version
[ "Generate", "a", "secured", "and", "public", "API", "Key", "from", "a", "list", "of", "tagFilters", "and", "an", "optional", "user", "token", "identifying", "the", "current", "user" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L1006-L1020
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/internal/RedmineJSONBuilder.java
RedmineJSONBuilder.writeProject
public static void writeProject(JSONWriter writer, Project project) throws IllegalArgumentException, JSONException { """ Writes a "create project" request. @param writer project writer. @param project project to create. @throws IllegalArgumentException if some project fields are not configured. @throws JSONException if IO error occurs. """ /* Validate project */ if (project.getName() == null) throw new IllegalArgumentException( "Project name must be set to create a new project"); if (project.getIdentifier() == null) throw new IllegalArgumentException( "Project identifier must be set to create a new project"); writeProject(project, writer); }
java
public static void writeProject(JSONWriter writer, Project project) throws IllegalArgumentException, JSONException { /* Validate project */ if (project.getName() == null) throw new IllegalArgumentException( "Project name must be set to create a new project"); if (project.getIdentifier() == null) throw new IllegalArgumentException( "Project identifier must be set to create a new project"); writeProject(project, writer); }
[ "public", "static", "void", "writeProject", "(", "JSONWriter", "writer", ",", "Project", "project", ")", "throws", "IllegalArgumentException", ",", "JSONException", "{", "/* Validate project */", "if", "(", "project", ".", "getName", "(", ")", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Project name must be set to create a new project\"", ")", ";", "if", "(", "project", ".", "getIdentifier", "(", ")", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Project identifier must be set to create a new project\"", ")", ";", "writeProject", "(", "project", ",", "writer", ")", ";", "}" ]
Writes a "create project" request. @param writer project writer. @param project project to create. @throws IllegalArgumentException if some project fields are not configured. @throws JSONException if IO error occurs.
[ "Writes", "a", "create", "project", "request", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/RedmineJSONBuilder.java#L53-L64
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceAPIManager.java
FaceAPIManager.authenticate
public static FaceAPI authenticate(String baseUrl, final String subscriptionKey) { """ Initializes an instance of Face API client. @param baseUrl the base URL of the service @param subscriptionKey the Face API key @return the Face API client """ ServiceClientCredentials serviceClientCredentials = new ServiceClientCredentials() { @Override public void applyCredentialsFilter(OkHttpClient.Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); // Request customization: add request headers Request.Builder requestBuilder = original.newBuilder() .addHeader("Ocp-Apim-Subscription-Key", subscriptionKey); request = requestBuilder.build(); return chain.proceed(request); } }); } }; return authenticate(baseUrl, serviceClientCredentials); }
java
public static FaceAPI authenticate(String baseUrl, final String subscriptionKey) { ServiceClientCredentials serviceClientCredentials = new ServiceClientCredentials() { @Override public void applyCredentialsFilter(OkHttpClient.Builder builder) { builder.addNetworkInterceptor( new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = null; Request original = chain.request(); // Request customization: add request headers Request.Builder requestBuilder = original.newBuilder() .addHeader("Ocp-Apim-Subscription-Key", subscriptionKey); request = requestBuilder.build(); return chain.proceed(request); } }); } }; return authenticate(baseUrl, serviceClientCredentials); }
[ "public", "static", "FaceAPI", "authenticate", "(", "String", "baseUrl", ",", "final", "String", "subscriptionKey", ")", "{", "ServiceClientCredentials", "serviceClientCredentials", "=", "new", "ServiceClientCredentials", "(", ")", "{", "@", "Override", "public", "void", "applyCredentialsFilter", "(", "OkHttpClient", ".", "Builder", "builder", ")", "{", "builder", ".", "addNetworkInterceptor", "(", "new", "Interceptor", "(", ")", "{", "@", "Override", "public", "Response", "intercept", "(", "Chain", "chain", ")", "throws", "IOException", "{", "Request", "request", "=", "null", ";", "Request", "original", "=", "chain", ".", "request", "(", ")", ";", "// Request customization: add request headers", "Request", ".", "Builder", "requestBuilder", "=", "original", ".", "newBuilder", "(", ")", ".", "addHeader", "(", "\"Ocp-Apim-Subscription-Key\"", ",", "subscriptionKey", ")", ";", "request", "=", "requestBuilder", ".", "build", "(", ")", ";", "return", "chain", ".", "proceed", "(", "request", ")", ";", "}", "}", ")", ";", "}", "}", ";", "return", "authenticate", "(", "baseUrl", ",", "serviceClientCredentials", ")", ";", "}" ]
Initializes an instance of Face API client. @param baseUrl the base URL of the service @param subscriptionKey the Face API key @return the Face API client
[ "Initializes", "an", "instance", "of", "Face", "API", "client", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceAPIManager.java#L43-L63
derari/cthul
objects/src/main/java/org/cthul/objects/Boxing.java
Boxing.deepUnboxAs
public static <T> T deepUnboxAs(Object src, Class<T> result) { """ Returns any multidimensional array into an array of primitives. @param <T> @param src source array @param result target type @return multidimensional array of primitives """ return (T) deepUnbox(result, src); }
java
public static <T> T deepUnboxAs(Object src, Class<T> result) { return (T) deepUnbox(result, src); }
[ "public", "static", "<", "T", ">", "T", "deepUnboxAs", "(", "Object", "src", ",", "Class", "<", "T", ">", "result", ")", "{", "return", "(", "T", ")", "deepUnbox", "(", "result", ",", "src", ")", ";", "}" ]
Returns any multidimensional array into an array of primitives. @param <T> @param src source array @param result target type @return multidimensional array of primitives
[ "Returns", "any", "multidimensional", "array", "into", "an", "array", "of", "primitives", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L704-L706
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java
ReadOnlyStyledDocumentBuilder.addParagraph
public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(SEG segment, StyleSpans<S> styles) { """ Adds to the list a paragraph that has only one segment but a number of different styles throughout that segment """ return addParagraph(segment, styles, null); }
java
public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(SEG segment, StyleSpans<S> styles) { return addParagraph(segment, styles, null); }
[ "public", "ReadOnlyStyledDocumentBuilder", "<", "PS", ",", "SEG", ",", "S", ">", "addParagraph", "(", "SEG", "segment", ",", "StyleSpans", "<", "S", ">", "styles", ")", "{", "return", "addParagraph", "(", "segment", ",", "styles", ",", "null", ")", ";", "}" ]
Adds to the list a paragraph that has only one segment but a number of different styles throughout that segment
[ "Adds", "to", "the", "list", "a", "paragraph", "that", "has", "only", "one", "segment", "but", "a", "number", "of", "different", "styles", "throughout", "that", "segment" ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java#L120-L122
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java
FtpFileUtil.disconnectAndLogoutFromFTPServer
public static void disconnectAndLogoutFromFTPServer(FTPClient ftpClient, String hostName) { """ Disconnect and logout given FTP client. @param hostName the FTP server host name """ try { // logout and disconnect if (ftpClient != null && ftpClient.isConnected()) { ftpClient.logout(); ftpClient.disconnect(); } } catch (IOException e) { // what the hell?! throw new RuntimeException("Unable to logout and disconnect from : " + hostName, e); } }
java
public static void disconnectAndLogoutFromFTPServer(FTPClient ftpClient, String hostName) { try { // logout and disconnect if (ftpClient != null && ftpClient.isConnected()) { ftpClient.logout(); ftpClient.disconnect(); } } catch (IOException e) { // what the hell?! throw new RuntimeException("Unable to logout and disconnect from : " + hostName, e); } }
[ "public", "static", "void", "disconnectAndLogoutFromFTPServer", "(", "FTPClient", "ftpClient", ",", "String", "hostName", ")", "{", "try", "{", "// logout and disconnect", "if", "(", "ftpClient", "!=", "null", "&&", "ftpClient", ".", "isConnected", "(", ")", ")", "{", "ftpClient", ".", "logout", "(", ")", ";", "ftpClient", ".", "disconnect", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "// what the hell?!", "throw", "new", "RuntimeException", "(", "\"Unable to logout and disconnect from : \"", "+", "hostName", ",", "e", ")", ";", "}", "}" ]
Disconnect and logout given FTP client. @param hostName the FTP server host name
[ "Disconnect", "and", "logout", "given", "FTP", "client", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java#L231-L242
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/template/TemplateExecution.java
TemplateExecution.require
public void require(Namer packageNamer, Namer classNamer) { """ Import the passed classNamer's type present in the passed packageNamer's package name. """ requireFirstTime(packageNamer.getPackageName() + "." + classNamer.getType()); }
java
public void require(Namer packageNamer, Namer classNamer) { requireFirstTime(packageNamer.getPackageName() + "." + classNamer.getType()); }
[ "public", "void", "require", "(", "Namer", "packageNamer", ",", "Namer", "classNamer", ")", "{", "requireFirstTime", "(", "packageNamer", ".", "getPackageName", "(", ")", "+", "\".\"", "+", "classNamer", ".", "getType", "(", ")", ")", ";", "}" ]
Import the passed classNamer's type present in the passed packageNamer's package name.
[ "Import", "the", "passed", "classNamer", "s", "type", "present", "in", "the", "passed", "packageNamer", "s", "package", "name", "." ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/template/TemplateExecution.java#L434-L436
GII/broccoli
broccoli-tools/src/main/java/com/hi3project/broccoli/bsdf/impl/implementation/AJavaServiceImplementation.java
AJavaServiceImplementation.getResponseToFrom
private static String getResponseToFrom(String callerClassName, String callerMethodName) throws ServiceExecutionException { """ /* Utility method to extract the value of @ResponseTo for a method supposedly annotated. """ try { Class<?> clas = Class.forName(callerClassName); Method[] methods = clas.getMethods(); for (Method method : methods) { if (method.getName().equalsIgnoreCase(callerMethodName)) { ResponseTo annotation = method.getAnnotation(ResponseTo.class); return (null!=annotation)?annotation.value():null; } } } catch (ClassNotFoundException ex) { throw new ServiceExecutionException(callerClassName, ex); } return null; }
java
private static String getResponseToFrom(String callerClassName, String callerMethodName) throws ServiceExecutionException { try { Class<?> clas = Class.forName(callerClassName); Method[] methods = clas.getMethods(); for (Method method : methods) { if (method.getName().equalsIgnoreCase(callerMethodName)) { ResponseTo annotation = method.getAnnotation(ResponseTo.class); return (null!=annotation)?annotation.value():null; } } } catch (ClassNotFoundException ex) { throw new ServiceExecutionException(callerClassName, ex); } return null; }
[ "private", "static", "String", "getResponseToFrom", "(", "String", "callerClassName", ",", "String", "callerMethodName", ")", "throws", "ServiceExecutionException", "{", "try", "{", "Class", "<", "?", ">", "clas", "=", "Class", ".", "forName", "(", "callerClassName", ")", ";", "Method", "[", "]", "methods", "=", "clas", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "method", ":", "methods", ")", "{", "if", "(", "method", ".", "getName", "(", ")", ".", "equalsIgnoreCase", "(", "callerMethodName", ")", ")", "{", "ResponseTo", "annotation", "=", "method", ".", "getAnnotation", "(", "ResponseTo", ".", "class", ")", ";", "return", "(", "null", "!=", "annotation", ")", "?", "annotation", ".", "value", "(", ")", ":", "null", ";", "}", "}", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "throw", "new", "ServiceExecutionException", "(", "callerClassName", ",", "ex", ")", ";", "}", "return", "null", ";", "}" ]
/* Utility method to extract the value of @ResponseTo for a method supposedly annotated.
[ "/", "*", "Utility", "method", "to", "extract", "the", "value", "of" ]
train
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-tools/src/main/java/com/hi3project/broccoli/bsdf/impl/implementation/AJavaServiceImplementation.java#L233-L255
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/message/session/ClientSessionMessageFilter.java
ClientSessionMessageFilter.init
public void init(String strQueueName, String strQueueType, Object source, RemoteSession session, Map propertiesForFilter, boolean bPrivate) { """ Constructor. @param strQueueName The queue name. @param strQueueType The queue type. @param source The source (sender). @param session The remote session. @param propertiesForFilter The properties for the filter. """ super.init(strQueueName, strQueueType, source, null); m_session = session; m_propertiesForFilter = propertiesForFilter; m_bPrivate = bPrivate; this.setThinTarget(true); // Yes, this is always a thin target }
java
public void init(String strQueueName, String strQueueType, Object source, RemoteSession session, Map propertiesForFilter, boolean bPrivate) { super.init(strQueueName, strQueueType, source, null); m_session = session; m_propertiesForFilter = propertiesForFilter; m_bPrivate = bPrivate; this.setThinTarget(true); // Yes, this is always a thin target }
[ "public", "void", "init", "(", "String", "strQueueName", ",", "String", "strQueueType", ",", "Object", "source", ",", "RemoteSession", "session", ",", "Map", "propertiesForFilter", ",", "boolean", "bPrivate", ")", "{", "super", ".", "init", "(", "strQueueName", ",", "strQueueType", ",", "source", ",", "null", ")", ";", "m_session", "=", "session", ";", "m_propertiesForFilter", "=", "propertiesForFilter", ";", "m_bPrivate", "=", "bPrivate", ";", "this", ".", "setThinTarget", "(", "true", ")", ";", "// Yes, this is always a thin target", "}" ]
Constructor. @param strQueueName The queue name. @param strQueueType The queue type. @param source The source (sender). @param session The remote session. @param propertiesForFilter The properties for the filter.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/session/ClientSessionMessageFilter.java#L115-L122
UrielCh/ovh-java-sdk
ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java
ApiOvhEmailpro.service_externalContact_externalEmailAddress_PUT
public void service_externalContact_externalEmailAddress_PUT(String service, String externalEmailAddress, OvhExternalContact body) throws IOException { """ Alter this object properties REST: PUT /email/pro/{service}/externalContact/{externalEmailAddress} @param body [required] New object properties @param service [required] The internal name of your pro organization @param externalEmailAddress [required] Contact email API beta """ String qPath = "/email/pro/{service}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, service, externalEmailAddress); exec(qPath, "PUT", sb.toString(), body); }
java
public void service_externalContact_externalEmailAddress_PUT(String service, String externalEmailAddress, OvhExternalContact body) throws IOException { String qPath = "/email/pro/{service}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, service, externalEmailAddress); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "service_externalContact_externalEmailAddress_PUT", "(", "String", "service", ",", "String", "externalEmailAddress", ",", "OvhExternalContact", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/pro/{service}/externalContact/{externalEmailAddress}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "service", ",", "externalEmailAddress", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /email/pro/{service}/externalContact/{externalEmailAddress} @param body [required] New object properties @param service [required] The internal name of your pro organization @param externalEmailAddress [required] Contact email API beta
[ "Alter", "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#L93-L97
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java
ChatController.handleParticipantsAdded
public Observable<ChatResult> handleParticipantsAdded(final String conversationId) { """ Handle participant added to a conversation Foundation SDK event. @param conversationId Unique conversation id. @return Observable with Chat SDK result. """ return persistenceController.getConversation(conversationId).flatMap(conversation -> { if (conversation == null) { return handleNoLocalConversation(conversationId); } else { return Observable.fromCallable(() -> new ChatResult(true, null)); } }); }
java
public Observable<ChatResult> handleParticipantsAdded(final String conversationId) { return persistenceController.getConversation(conversationId).flatMap(conversation -> { if (conversation == null) { return handleNoLocalConversation(conversationId); } else { return Observable.fromCallable(() -> new ChatResult(true, null)); } }); }
[ "public", "Observable", "<", "ChatResult", ">", "handleParticipantsAdded", "(", "final", "String", "conversationId", ")", "{", "return", "persistenceController", ".", "getConversation", "(", "conversationId", ")", ".", "flatMap", "(", "conversation", "->", "{", "if", "(", "conversation", "==", "null", ")", "{", "return", "handleNoLocalConversation", "(", "conversationId", ")", ";", "}", "else", "{", "return", "Observable", ".", "fromCallable", "(", "(", ")", "->", "new", "ChatResult", "(", "true", ",", "null", ")", ")", ";", "}", "}", ")", ";", "}" ]
Handle participant added to a conversation Foundation SDK event. @param conversationId Unique conversation id. @return Observable with Chat SDK result.
[ "Handle", "participant", "added", "to", "a", "conversation", "Foundation", "SDK", "event", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L202-L210
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_RingSideBuffer.java
ST_RingSideBuffer.ringSideBuffer
public static Geometry ringSideBuffer(Geometry geom, double bufferSize, int numBuffer) throws SQLException { """ Compute a ring buffer on one side of the geometry @param geom @param bufferSize @param numBuffer @return @throws java.sql.SQLException """ return ringSideBuffer(geom, bufferSize, numBuffer, "endcap=flat"); }
java
public static Geometry ringSideBuffer(Geometry geom, double bufferSize, int numBuffer) throws SQLException { return ringSideBuffer(geom, bufferSize, numBuffer, "endcap=flat"); }
[ "public", "static", "Geometry", "ringSideBuffer", "(", "Geometry", "geom", ",", "double", "bufferSize", ",", "int", "numBuffer", ")", "throws", "SQLException", "{", "return", "ringSideBuffer", "(", "geom", ",", "bufferSize", ",", "numBuffer", ",", "\"endcap=flat\"", ")", ";", "}" ]
Compute a ring buffer on one side of the geometry @param geom @param bufferSize @param numBuffer @return @throws java.sql.SQLException
[ "Compute", "a", "ring", "buffer", "on", "one", "side", "of", "the", "geometry" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_RingSideBuffer.java#L65-L67
Twitter4J/Twitter4J
twitter4j-async/src/main/java/twitter4j/AsyncTwitterFactory.java
AsyncTwitterFactory.getInstance
public AsyncTwitter getInstance(AccessToken accessToken) { """ Returns a OAuth Authenticated instance.<br> consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.<br> Unlike {@link AsyncTwitter#setOAuthAccessToken(twitter4j.auth.AccessToken)}, this factory method potentially returns a cached instance. @param accessToken access token @return an instance """ String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret(); if (null == consumerKey && null == consumerSecret) { throw new IllegalStateException("Consumer key and Consumer secret not supplied."); } OAuthAuthorization oauth = new OAuthAuthorization(conf); oauth.setOAuthConsumer(consumerKey, consumerSecret); oauth.setOAuthAccessToken(accessToken); return new AsyncTwitterImpl(conf, oauth); }
java
public AsyncTwitter getInstance(AccessToken accessToken) { String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret(); if (null == consumerKey && null == consumerSecret) { throw new IllegalStateException("Consumer key and Consumer secret not supplied."); } OAuthAuthorization oauth = new OAuthAuthorization(conf); oauth.setOAuthConsumer(consumerKey, consumerSecret); oauth.setOAuthAccessToken(accessToken); return new AsyncTwitterImpl(conf, oauth); }
[ "public", "AsyncTwitter", "getInstance", "(", "AccessToken", "accessToken", ")", "{", "String", "consumerKey", "=", "conf", ".", "getOAuthConsumerKey", "(", ")", ";", "String", "consumerSecret", "=", "conf", ".", "getOAuthConsumerSecret", "(", ")", ";", "if", "(", "null", "==", "consumerKey", "&&", "null", "==", "consumerSecret", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Consumer key and Consumer secret not supplied.\"", ")", ";", "}", "OAuthAuthorization", "oauth", "=", "new", "OAuthAuthorization", "(", "conf", ")", ";", "oauth", ".", "setOAuthConsumer", "(", "consumerKey", ",", "consumerSecret", ")", ";", "oauth", ".", "setOAuthAccessToken", "(", "accessToken", ")", ";", "return", "new", "AsyncTwitterImpl", "(", "conf", ",", "oauth", ")", ";", "}" ]
Returns a OAuth Authenticated instance.<br> consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.<br> Unlike {@link AsyncTwitter#setOAuthAccessToken(twitter4j.auth.AccessToken)}, this factory method potentially returns a cached instance. @param accessToken access token @return an instance
[ "Returns", "a", "OAuth", "Authenticated", "instance", ".", "<br", ">", "consumer", "key", "and", "consumer", "Secret", "must", "be", "provided", "by", "twitter4j", ".", "properties", "or", "system", "properties", ".", "<br", ">", "Unlike", "{", "@link", "AsyncTwitter#setOAuthAccessToken", "(", "twitter4j", ".", "auth", ".", "AccessToken", ")", "}", "this", "factory", "method", "potentially", "returns", "a", "cached", "instance", "." ]
train
https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-async/src/main/java/twitter4j/AsyncTwitterFactory.java#L91-L101
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java
ConfusingAutoboxedOverloading.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { """ overrides the visitor to look for confusing signatures @param classContext the context object that holds the JavaClass currently being parsed """ JavaClass cls = classContext.getJavaClass(); if (cls.isClass() && (cls.getMajor() >= JDK15_MAJOR)) { Map<String, Set<String>> methodInfo = new HashMap<>(); populateMethodInfo(cls, methodInfo); Method[] methods = cls.getMethods(); for (Method m : methods) { String name = m.getName(); String signature = m.getSignature(); Set<String> sigs = methodInfo.get(name); if (sigs != null) { for (String sig : sigs) { if (confusingSignatures(sig, signature)) { bugReporter.reportBug(new BugInstance(this, BugType.CAO_CONFUSING_AUTOBOXED_OVERLOADING.name(), NORMAL_PRIORITY) .addClass(cls.getClassName()).addString(name + signature).addString(name + sig)); } } } } } }
java
@Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); if (cls.isClass() && (cls.getMajor() >= JDK15_MAJOR)) { Map<String, Set<String>> methodInfo = new HashMap<>(); populateMethodInfo(cls, methodInfo); Method[] methods = cls.getMethods(); for (Method m : methods) { String name = m.getName(); String signature = m.getSignature(); Set<String> sigs = methodInfo.get(name); if (sigs != null) { for (String sig : sigs) { if (confusingSignatures(sig, signature)) { bugReporter.reportBug(new BugInstance(this, BugType.CAO_CONFUSING_AUTOBOXED_OVERLOADING.name(), NORMAL_PRIORITY) .addClass(cls.getClassName()).addString(name + signature).addString(name + sig)); } } } } } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "cls", ".", "isClass", "(", ")", "&&", "(", "cls", ".", "getMajor", "(", ")", ">=", "JDK15_MAJOR", ")", ")", "{", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "methodInfo", "=", "new", "HashMap", "<>", "(", ")", ";", "populateMethodInfo", "(", "cls", ",", "methodInfo", ")", ";", "Method", "[", "]", "methods", "=", "cls", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "m", ":", "methods", ")", "{", "String", "name", "=", "m", ".", "getName", "(", ")", ";", "String", "signature", "=", "m", ".", "getSignature", "(", ")", ";", "Set", "<", "String", ">", "sigs", "=", "methodInfo", ".", "get", "(", "name", ")", ";", "if", "(", "sigs", "!=", "null", ")", "{", "for", "(", "String", "sig", ":", "sigs", ")", "{", "if", "(", "confusingSignatures", "(", "sig", ",", "signature", ")", ")", "{", "bugReporter", ".", "reportBug", "(", "new", "BugInstance", "(", "this", ",", "BugType", ".", "CAO_CONFUSING_AUTOBOXED_OVERLOADING", ".", "name", "(", ")", ",", "NORMAL_PRIORITY", ")", ".", "addClass", "(", "cls", ".", "getClassName", "(", ")", ")", ".", "addString", "(", "name", "+", "signature", ")", ".", "addString", "(", "name", "+", "sig", ")", ")", ";", "}", "}", "}", "}", "}", "}" ]
overrides the visitor to look for confusing signatures @param classContext the context object that holds the JavaClass currently being parsed
[ "overrides", "the", "visitor", "to", "look", "for", "confusing", "signatures" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java#L81-L106
voldemort/voldemort
src/java/voldemort/utils/ByteUtils.java
ByteUtils.writeInt
public static void writeInt(byte[] bytes, int value, int offset) { """ Write an int to the byte array starting at the given offset @param bytes The byte array @param value The int to write @param offset The offset to begin writing at """ bytes[offset] = (byte) (0xFF & (value >> 24)); bytes[offset + 1] = (byte) (0xFF & (value >> 16)); bytes[offset + 2] = (byte) (0xFF & (value >> 8)); bytes[offset + 3] = (byte) (0xFF & value); }
java
public static void writeInt(byte[] bytes, int value, int offset) { bytes[offset] = (byte) (0xFF & (value >> 24)); bytes[offset + 1] = (byte) (0xFF & (value >> 16)); bytes[offset + 2] = (byte) (0xFF & (value >> 8)); bytes[offset + 3] = (byte) (0xFF & value); }
[ "public", "static", "void", "writeInt", "(", "byte", "[", "]", "bytes", ",", "int", "value", ",", "int", "offset", ")", "{", "bytes", "[", "offset", "]", "=", "(", "byte", ")", "(", "0xFF", "&", "(", "value", ">>", "24", ")", ")", ";", "bytes", "[", "offset", "+", "1", "]", "=", "(", "byte", ")", "(", "0xFF", "&", "(", "value", ">>", "16", ")", ")", ";", "bytes", "[", "offset", "+", "2", "]", "=", "(", "byte", ")", "(", "0xFF", "&", "(", "value", ">>", "8", ")", ")", ";", "bytes", "[", "offset", "+", "3", "]", "=", "(", "byte", ")", "(", "0xFF", "&", "value", ")", ";", "}" ]
Write an int to the byte array starting at the given offset @param bytes The byte array @param value The int to write @param offset The offset to begin writing at
[ "Write", "an", "int", "to", "the", "byte", "array", "starting", "at", "the", "given", "offset" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ByteUtils.java#L262-L267
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.getOffset
public static long getOffset(IntBuffer shapeInformation, int row, int col) { """ Get the offset of the specified [row,col] for the 2d array @param shapeInformation Shape information @param row Row index to get the offset for @param col Column index to get the offset for @return Buffer offset """ int rank = rank(shapeInformation); if (rank != 2) throw new IllegalArgumentException( "Cannot use this getOffset method on arrays of rank != 2 (rank is: " + rank + ")"); long offset = 0; int size_0 = size(shapeInformation, 0); int size_1 = size(shapeInformation, 1); if (row >= size_0 || col >= size_1) throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += row * stride(shapeInformation, 0); if (size_1 != 1) offset += col * stride(shapeInformation, 1); return offset; }
java
public static long getOffset(IntBuffer shapeInformation, int row, int col) { int rank = rank(shapeInformation); if (rank != 2) throw new IllegalArgumentException( "Cannot use this getOffset method on arrays of rank != 2 (rank is: " + rank + ")"); long offset = 0; int size_0 = size(shapeInformation, 0); int size_1 = size(shapeInformation, 1); if (row >= size_0 || col >= size_1) throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += row * stride(shapeInformation, 0); if (size_1 != 1) offset += col * stride(shapeInformation, 1); return offset; }
[ "public", "static", "long", "getOffset", "(", "IntBuffer", "shapeInformation", ",", "int", "row", ",", "int", "col", ")", "{", "int", "rank", "=", "rank", "(", "shapeInformation", ")", ";", "if", "(", "rank", "!=", "2", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cannot use this getOffset method on arrays of rank != 2 (rank is: \"", "+", "rank", "+", "\")\"", ")", ";", "long", "offset", "=", "0", ";", "int", "size_0", "=", "size", "(", "shapeInformation", ",", "0", ")", ";", "int", "size_1", "=", "size", "(", "shapeInformation", ",", "1", ")", ";", "if", "(", "row", ">=", "size_0", "||", "col", ">=", "size_1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid indices: cannot get [\"", "+", "row", "+", "\",\"", "+", "col", "+", "\"] from a \"", "+", "Arrays", ".", "toString", "(", "shape", "(", "shapeInformation", ")", ")", "+", "\" NDArray\"", ")", ";", "if", "(", "size_0", "!=", "1", ")", "offset", "+=", "row", "*", "stride", "(", "shapeInformation", ",", "0", ")", ";", "if", "(", "size_1", "!=", "1", ")", "offset", "+=", "col", "*", "stride", "(", "shapeInformation", ",", "1", ")", ";", "return", "offset", ";", "}" ]
Get the offset of the specified [row,col] for the 2d array @param shapeInformation Shape information @param row Row index to get the offset for @param col Column index to get the offset for @return Buffer offset
[ "Get", "the", "offset", "of", "the", "specified", "[", "row", "col", "]", "for", "the", "2d", "array" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1058-L1076
intellimate/Izou
src/main/java/org/intellimate/izou/events/EventDistributor.java
EventDistributor.unregisterEventFinishedListener
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public void unregisterEventFinishedListener(EventModel<EventModel> event, EventListenerModel eventListener) throws IllegalArgumentException { """ unregister an EventListener that got called when the event finished processing. It will unregister for all Descriptors individually! It will also ignore if this listener is not listening to an Event. Method is thread-safe. @param event the Event to stop listen to @param eventListener the ActivatorEventListener used to listen for events @throws IllegalArgumentException if Listener is already listening to the Event or the id is not allowed """ for (String id : event.getAllInformations()) { ArrayList<EventListenerModel> listenersList = finishListeners.get(id); if (listenersList == null) { return; } synchronized (listenersList) { listenersList.remove(eventListener); } } }
java
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public void unregisterEventFinishedListener(EventModel<EventModel> event, EventListenerModel eventListener) throws IllegalArgumentException { for (String id : event.getAllInformations()) { ArrayList<EventListenerModel> listenersList = finishListeners.get(id); if (listenersList == null) { return; } synchronized (listenersList) { listenersList.remove(eventListener); } } }
[ "@", "SuppressWarnings", "(", "\"SynchronizationOnLocalVariableOrMethodParameter\"", ")", "public", "void", "unregisterEventFinishedListener", "(", "EventModel", "<", "EventModel", ">", "event", ",", "EventListenerModel", "eventListener", ")", "throws", "IllegalArgumentException", "{", "for", "(", "String", "id", ":", "event", ".", "getAllInformations", "(", ")", ")", "{", "ArrayList", "<", "EventListenerModel", ">", "listenersList", "=", "finishListeners", ".", "get", "(", "id", ")", ";", "if", "(", "listenersList", "==", "null", ")", "{", "return", ";", "}", "synchronized", "(", "listenersList", ")", "{", "listenersList", ".", "remove", "(", "eventListener", ")", ";", "}", "}", "}" ]
unregister an EventListener that got called when the event finished processing. It will unregister for all Descriptors individually! It will also ignore if this listener is not listening to an Event. Method is thread-safe. @param event the Event to stop listen to @param eventListener the ActivatorEventListener used to listen for events @throws IllegalArgumentException if Listener is already listening to the Event or the id is not allowed
[ "unregister", "an", "EventListener", "that", "got", "called", "when", "the", "event", "finished", "processing", "." ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/events/EventDistributor.java#L246-L257
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.listSecretVersionsAsync
public ServiceFuture<List<SecretItem>> listSecretVersionsAsync(final String vaultBaseUrl, final String secretName, final ListOperationCallback<SecretItem> serviceCallback) { """ List the versions of the specified secret. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param secretName The name of the secret in the given vault @param serviceCallback the async ServiceCallback to handle successful and failed responses. @return the {@link ServiceFuture} object """ return getSecretVersionsAsync(vaultBaseUrl, secretName, serviceCallback); }
java
public ServiceFuture<List<SecretItem>> listSecretVersionsAsync(final String vaultBaseUrl, final String secretName, final ListOperationCallback<SecretItem> serviceCallback) { return getSecretVersionsAsync(vaultBaseUrl, secretName, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "SecretItem", ">", ">", "listSecretVersionsAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "secretName", ",", "final", "ListOperationCallback", "<", "SecretItem", ">", "serviceCallback", ")", "{", "return", "getSecretVersionsAsync", "(", "vaultBaseUrl", ",", "secretName", ",", "serviceCallback", ")", ";", "}" ]
List the versions of the specified secret. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param secretName The name of the secret in the given vault @param serviceCallback the async ServiceCallback to handle successful and failed responses. @return the {@link ServiceFuture} object
[ "List", "the", "versions", "of", "the", "specified", "secret", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1245-L1248
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/CronScheduleBuilder.java
CronScheduleBuilder.cronSchedule
@Nonnull public static CronScheduleBuilder cronSchedule (final String cronExpression) { """ Create a CronScheduleBuilder with the given cron-expression string - which is presumed to b e valid cron expression (and hence only a RuntimeException will be thrown if it is not). @param cronExpression the cron expression string to base the schedule on. @return the new CronScheduleBuilder @throws RuntimeException wrapping a ParseException if the expression is invalid @see CronExpression """ try { return cronSchedule (new CronExpression (cronExpression)); } catch (final ParseException e) { // all methods of construction ensure the expression is valid by // this point... throw new RuntimeException ("CronExpression '" + cronExpression + "' is invalid.", e); } }
java
@Nonnull public static CronScheduleBuilder cronSchedule (final String cronExpression) { try { return cronSchedule (new CronExpression (cronExpression)); } catch (final ParseException e) { // all methods of construction ensure the expression is valid by // this point... throw new RuntimeException ("CronExpression '" + cronExpression + "' is invalid.", e); } }
[ "@", "Nonnull", "public", "static", "CronScheduleBuilder", "cronSchedule", "(", "final", "String", "cronExpression", ")", "{", "try", "{", "return", "cronSchedule", "(", "new", "CronExpression", "(", "cronExpression", ")", ")", ";", "}", "catch", "(", "final", "ParseException", "e", ")", "{", "// all methods of construction ensure the expression is valid by", "// this point...", "throw", "new", "RuntimeException", "(", "\"CronExpression '\"", "+", "cronExpression", "+", "\"' is invalid.\"", ",", "e", ")", ";", "}", "}" ]
Create a CronScheduleBuilder with the given cron-expression string - which is presumed to b e valid cron expression (and hence only a RuntimeException will be thrown if it is not). @param cronExpression the cron expression string to base the schedule on. @return the new CronScheduleBuilder @throws RuntimeException wrapping a ParseException if the expression is invalid @see CronExpression
[ "Create", "a", "CronScheduleBuilder", "with", "the", "given", "cron", "-", "expression", "string", "-", "which", "is", "presumed", "to", "b", "e", "valid", "cron", "expression", "(", "and", "hence", "only", "a", "RuntimeException", "will", "be", "thrown", "if", "it", "is", "not", ")", "." ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/CronScheduleBuilder.java#L102-L115
adamfisk/littleshoot-util
src/main/java/org/littleshoot/util/xml/XPathUtils.java
XPathUtils.newXPath
public static XPathUtils newXPath(final InputStream is) throws SAXException, IOException { """ Creates a new {@link XPathUtils} instance. @param is The {@link InputStream} with XML data. @return A new {@link XPathUtils} instance. @throws SAXException If there's a SAX error in the XML. @throws IOException If there's an IO error reading the stream. """ final XPathFactory xpfactory = XPathFactory.newInstance(); final XPath xPath = xpfactory.newXPath(); final Document doc = XmlUtils.toDoc(is); return new XPathUtils(xPath, doc); }
java
public static XPathUtils newXPath(final InputStream is) throws SAXException, IOException { final XPathFactory xpfactory = XPathFactory.newInstance(); final XPath xPath = xpfactory.newXPath(); final Document doc = XmlUtils.toDoc(is); return new XPathUtils(xPath, doc); }
[ "public", "static", "XPathUtils", "newXPath", "(", "final", "InputStream", "is", ")", "throws", "SAXException", ",", "IOException", "{", "final", "XPathFactory", "xpfactory", "=", "XPathFactory", ".", "newInstance", "(", ")", ";", "final", "XPath", "xPath", "=", "xpfactory", ".", "newXPath", "(", ")", ";", "final", "Document", "doc", "=", "XmlUtils", ".", "toDoc", "(", "is", ")", ";", "return", "new", "XPathUtils", "(", "xPath", ",", "doc", ")", ";", "}" ]
Creates a new {@link XPathUtils} instance. @param is The {@link InputStream} with XML data. @return A new {@link XPathUtils} instance. @throws SAXException If there's a SAX error in the XML. @throws IOException If there's an IO error reading the stream.
[ "Creates", "a", "new", "{", "@link", "XPathUtils", "}", "instance", "." ]
train
https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/xml/XPathUtils.java#L102-L108
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/documents/FileColumn.java
FileColumn.convertDecimal
private String convertDecimal(double d, String format) { """ Converts the given numeric value to the output date format. @param d The value to be converted @param format The format to use for the value @return The formatted value """ String ret = ""; if(format.length() > 0) { DecimalFormat f = new DecimalFormat(format); ret = f.format(d); } else { ret = Double.toString(d); } return ret; }
java
private String convertDecimal(double d, String format) { String ret = ""; if(format.length() > 0) { DecimalFormat f = new DecimalFormat(format); ret = f.format(d); } else { ret = Double.toString(d); } return ret; }
[ "private", "String", "convertDecimal", "(", "double", "d", ",", "String", "format", ")", "{", "String", "ret", "=", "\"\"", ";", "if", "(", "format", ".", "length", "(", ")", ">", "0", ")", "{", "DecimalFormat", "f", "=", "new", "DecimalFormat", "(", "format", ")", ";", "ret", "=", "f", ".", "format", "(", "d", ")", ";", "}", "else", "{", "ret", "=", "Double", ".", "toString", "(", "d", ")", ";", "}", "return", "ret", ";", "}" ]
Converts the given numeric value to the output date format. @param d The value to be converted @param format The format to use for the value @return The formatted value
[ "Converts", "the", "given", "numeric", "value", "to", "the", "output", "date", "format", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/FileColumn.java#L714-L729
yatechorg/jedis-utils
src/main/java/org/yatech/jedis/collections/JedisCollections.java
JedisCollections.getSortedSet
public static JedisSortedSet getSortedSet(Jedis jedis, String key, ScoreProvider scoreProvider) { """ Get a {@link java.util.Set} abstraction of a sorted set redis value in the specified key, using the given {@link Jedis}. @param jedis the {@link Jedis} connection to use for the sorted set operations. @param key the key of the sorted set value in redis @param scoreProvider the provider to use for assigning scores when none is given explicitly. @return the {@link JedisSortedSet} instance """ return new JedisSortedSet(jedis, key, scoreProvider); }
java
public static JedisSortedSet getSortedSet(Jedis jedis, String key, ScoreProvider scoreProvider) { return new JedisSortedSet(jedis, key, scoreProvider); }
[ "public", "static", "JedisSortedSet", "getSortedSet", "(", "Jedis", "jedis", ",", "String", "key", ",", "ScoreProvider", "scoreProvider", ")", "{", "return", "new", "JedisSortedSet", "(", "jedis", ",", "key", ",", "scoreProvider", ")", ";", "}" ]
Get a {@link java.util.Set} abstraction of a sorted set redis value in the specified key, using the given {@link Jedis}. @param jedis the {@link Jedis} connection to use for the sorted set operations. @param key the key of the sorted set value in redis @param scoreProvider the provider to use for assigning scores when none is given explicitly. @return the {@link JedisSortedSet} instance
[ "Get", "a", "{" ]
train
https://github.com/yatechorg/jedis-utils/blob/1951609fa6697df4f69be76e7d66b9284924bd97/src/main/java/org/yatech/jedis/collections/JedisCollections.java#L109-L111
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/date.java
date.convertMonth
public static String convertMonth(int month, boolean useShort) { """ Converts a month by number to full text @param month number of the month 1..12 @param useShort boolean that gives "Jun" instead of "June" if true @return returns "January" if "1" is given """ String monthStr; switch (month) { default: monthStr = "January"; break; case Calendar.FEBRUARY: monthStr = "February"; break; case Calendar.MARCH: monthStr = "March"; break; case Calendar.APRIL: monthStr = "April"; break; case Calendar.MAY: monthStr = "May"; break; case Calendar.JUNE: monthStr = "June"; break; case Calendar.JULY: monthStr = "July"; break; case Calendar.AUGUST: monthStr = "August"; break; case Calendar.SEPTEMBER: monthStr = "September"; break; case Calendar.OCTOBER: monthStr = "October"; break; case Calendar.NOVEMBER: monthStr = "November"; break; case Calendar.DECEMBER: monthStr = "December"; break; } if (useShort) monthStr = monthStr.substring(0, 3); return monthStr; }
java
public static String convertMonth(int month, boolean useShort) { String monthStr; switch (month) { default: monthStr = "January"; break; case Calendar.FEBRUARY: monthStr = "February"; break; case Calendar.MARCH: monthStr = "March"; break; case Calendar.APRIL: monthStr = "April"; break; case Calendar.MAY: monthStr = "May"; break; case Calendar.JUNE: monthStr = "June"; break; case Calendar.JULY: monthStr = "July"; break; case Calendar.AUGUST: monthStr = "August"; break; case Calendar.SEPTEMBER: monthStr = "September"; break; case Calendar.OCTOBER: monthStr = "October"; break; case Calendar.NOVEMBER: monthStr = "November"; break; case Calendar.DECEMBER: monthStr = "December"; break; } if (useShort) monthStr = monthStr.substring(0, 3); return monthStr; }
[ "public", "static", "String", "convertMonth", "(", "int", "month", ",", "boolean", "useShort", ")", "{", "String", "monthStr", ";", "switch", "(", "month", ")", "{", "default", ":", "monthStr", "=", "\"January\"", ";", "break", ";", "case", "Calendar", ".", "FEBRUARY", ":", "monthStr", "=", "\"February\"", ";", "break", ";", "case", "Calendar", ".", "MARCH", ":", "monthStr", "=", "\"March\"", ";", "break", ";", "case", "Calendar", ".", "APRIL", ":", "monthStr", "=", "\"April\"", ";", "break", ";", "case", "Calendar", ".", "MAY", ":", "monthStr", "=", "\"May\"", ";", "break", ";", "case", "Calendar", ".", "JUNE", ":", "monthStr", "=", "\"June\"", ";", "break", ";", "case", "Calendar", ".", "JULY", ":", "monthStr", "=", "\"July\"", ";", "break", ";", "case", "Calendar", ".", "AUGUST", ":", "monthStr", "=", "\"August\"", ";", "break", ";", "case", "Calendar", ".", "SEPTEMBER", ":", "monthStr", "=", "\"September\"", ";", "break", ";", "case", "Calendar", ".", "OCTOBER", ":", "monthStr", "=", "\"October\"", ";", "break", ";", "case", "Calendar", ".", "NOVEMBER", ":", "monthStr", "=", "\"November\"", ";", "break", ";", "case", "Calendar", ".", "DECEMBER", ":", "monthStr", "=", "\"December\"", ";", "break", ";", "}", "if", "(", "useShort", ")", "monthStr", "=", "monthStr", ".", "substring", "(", "0", ",", "3", ")", ";", "return", "monthStr", ";", "}" ]
Converts a month by number to full text @param month number of the month 1..12 @param useShort boolean that gives "Jun" instead of "June" if true @return returns "January" if "1" is given
[ "Converts", "a", "month", "by", "number", "to", "full", "text" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/date.java#L211-L253
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJScatterChartBuilder.java
DJScatterChartBuilder.addSerie
public DJScatterChartBuilder addSerie(AbstractColumn column, String label) { """ Adds the specified serie column to the dataset with custom label. @param column the serie column @param label column the custom label """ getDataset().addSerie(column, label); return this; }
java
public DJScatterChartBuilder addSerie(AbstractColumn column, String label) { getDataset().addSerie(column, label); return this; }
[ "public", "DJScatterChartBuilder", "addSerie", "(", "AbstractColumn", "column", ",", "String", "label", ")", "{", "getDataset", "(", ")", ".", "addSerie", "(", "column", ",", "label", ")", ";", "return", "this", ";", "}" ]
Adds the specified serie column to the dataset with custom label. @param column the serie column @param label column the custom label
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJScatterChartBuilder.java#L374-L377
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XCostExtension.java
XCostExtension.assignTypes
public void assignTypes(XEvent event, Map<List<String>, String> types) { """ Assigns (to the given event) multiple cost types given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. @see #assignAmounts(XEvent, Map) @param event Event to assign the cost types to. @param types Mapping from keys to cost types which are to be assigned. """ XCostType.instance().assignNestedValues(event, types); }
java
public void assignTypes(XEvent event, Map<List<String>, String> types) { XCostType.instance().assignNestedValues(event, types); }
[ "public", "void", "assignTypes", "(", "XEvent", "event", ",", "Map", "<", "List", "<", "String", ">", ",", "String", ">", "types", ")", "{", "XCostType", ".", "instance", "(", ")", ".", "assignNestedValues", "(", "event", ",", "types", ")", ";", "}" ]
Assigns (to the given event) multiple cost types given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. @see #assignAmounts(XEvent, Map) @param event Event to assign the cost types to. @param types Mapping from keys to cost types which are to be assigned.
[ "Assigns", "(", "to", "the", "given", "event", ")", "multiple", "cost", "types", "given", "their", "keys", ".", "Note", "that", "as", "a", "side", "effect", "this", "method", "creates", "attributes", "when", "it", "does", "not", "find", "an", "attribute", "with", "the", "proper", "key", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XCostExtension.java#L986-L988
knightliao/disconf
disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/inner/ResilientActiveKeyValueStore.java
ResilientActiveKeyValueStore.read
public String read(String path, Watcher watcher, Stat stat) throws InterruptedException, KeeperException { """ @param path @param watcher @return String @throws InterruptedException @throws KeeperException @Description: 读数据 @author liaoqiqi @date 2013-6-14 """ byte[] data = zk.getData(path, watcher, stat); return new String(data, CHARSET); }
java
public String read(String path, Watcher watcher, Stat stat) throws InterruptedException, KeeperException { byte[] data = zk.getData(path, watcher, stat); return new String(data, CHARSET); }
[ "public", "String", "read", "(", "String", "path", ",", "Watcher", "watcher", ",", "Stat", "stat", ")", "throws", "InterruptedException", ",", "KeeperException", "{", "byte", "[", "]", "data", "=", "zk", ".", "getData", "(", "path", ",", "watcher", ",", "stat", ")", ";", "return", "new", "String", "(", "data", ",", "CHARSET", ")", ";", "}" ]
@param path @param watcher @return String @throws InterruptedException @throws KeeperException @Description: 读数据 @author liaoqiqi @date 2013-6-14
[ "@param", "path", "@param", "watcher" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/inner/ResilientActiveKeyValueStore.java#L207-L211
Netflix/astyanax
astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java
ColumnPrefixDistributedRowLock.fillLockMutation
public String fillLockMutation(MutationBatch m, Long time, Integer ttl) { """ Fill a mutation with the lock column. This may be used when the mutation is executed externally but should be used with extreme caution to ensure the lock is properly released @param m @param time @param ttl """ if (lockColumn != null) { if (!lockColumn.equals(prefix+lockId)) throw new IllegalStateException("Can't change prefix or lockId after acquiring the lock"); } else { lockColumn = prefix + lockId; } Long timeoutValue = (time == null) ? new Long(0) : time + TimeUnit.MICROSECONDS.convert(timeout, timeoutUnits); m.withRow(columnFamily, key).putColumn(lockColumn, generateTimeoutValue(timeoutValue), ttl); return lockColumn; }
java
public String fillLockMutation(MutationBatch m, Long time, Integer ttl) { if (lockColumn != null) { if (!lockColumn.equals(prefix+lockId)) throw new IllegalStateException("Can't change prefix or lockId after acquiring the lock"); } else { lockColumn = prefix + lockId; } Long timeoutValue = (time == null) ? new Long(0) : time + TimeUnit.MICROSECONDS.convert(timeout, timeoutUnits); m.withRow(columnFamily, key).putColumn(lockColumn, generateTimeoutValue(timeoutValue), ttl); return lockColumn; }
[ "public", "String", "fillLockMutation", "(", "MutationBatch", "m", ",", "Long", "time", ",", "Integer", "ttl", ")", "{", "if", "(", "lockColumn", "!=", "null", ")", "{", "if", "(", "!", "lockColumn", ".", "equals", "(", "prefix", "+", "lockId", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Can't change prefix or lockId after acquiring the lock\"", ")", ";", "}", "else", "{", "lockColumn", "=", "prefix", "+", "lockId", ";", "}", "Long", "timeoutValue", "=", "(", "time", "==", "null", ")", "?", "new", "Long", "(", "0", ")", ":", "time", "+", "TimeUnit", ".", "MICROSECONDS", ".", "convert", "(", "timeout", ",", "timeoutUnits", ")", ";", "m", ".", "withRow", "(", "columnFamily", ",", "key", ")", ".", "putColumn", "(", "lockColumn", ",", "generateTimeoutValue", "(", "timeoutValue", ")", ",", "ttl", ")", ";", "return", "lockColumn", ";", "}" ]
Fill a mutation with the lock column. This may be used when the mutation is executed externally but should be used with extreme caution to ensure the lock is properly released @param m @param time @param ttl
[ "Fill", "a", "mutation", "with", "the", "lock", "column", ".", "This", "may", "be", "used", "when", "the", "mutation", "is", "executed", "externally", "but", "should", "be", "used", "with", "extreme", "caution", "to", "ensure", "the", "lock", "is", "properly", "released" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java#L460-L476
apereo/cas
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/encoder/BaseHttpServletAwareSamlObjectEncoder.java
BaseHttpServletAwareSamlObjectEncoder.getEncoderMessageContext
protected MessageContext getEncoderMessageContext(final RequestAbstractType request, final T samlObject, final String relayState) { """ Build encoder message context. @param request the authn request @param samlObject the saml response @param relayState the relay state @return the message context """ val ctx = new MessageContext<SAMLObject>(); ctx.setMessage(samlObject); SAMLBindingSupport.setRelayState(ctx, relayState); SamlIdPUtils.preparePeerEntitySamlEndpointContext(request, ctx, adaptor, getBinding()); val self = ctx.getSubcontext(SAMLSelfEntityContext.class, true); self.setEntityId(SamlIdPUtils.getIssuerFromSamlObject(samlObject)); return ctx; }
java
protected MessageContext getEncoderMessageContext(final RequestAbstractType request, final T samlObject, final String relayState) { val ctx = new MessageContext<SAMLObject>(); ctx.setMessage(samlObject); SAMLBindingSupport.setRelayState(ctx, relayState); SamlIdPUtils.preparePeerEntitySamlEndpointContext(request, ctx, adaptor, getBinding()); val self = ctx.getSubcontext(SAMLSelfEntityContext.class, true); self.setEntityId(SamlIdPUtils.getIssuerFromSamlObject(samlObject)); return ctx; }
[ "protected", "MessageContext", "getEncoderMessageContext", "(", "final", "RequestAbstractType", "request", ",", "final", "T", "samlObject", ",", "final", "String", "relayState", ")", "{", "val", "ctx", "=", "new", "MessageContext", "<", "SAMLObject", ">", "(", ")", ";", "ctx", ".", "setMessage", "(", "samlObject", ")", ";", "SAMLBindingSupport", ".", "setRelayState", "(", "ctx", ",", "relayState", ")", ";", "SamlIdPUtils", ".", "preparePeerEntitySamlEndpointContext", "(", "request", ",", "ctx", ",", "adaptor", ",", "getBinding", "(", ")", ")", ";", "val", "self", "=", "ctx", ".", "getSubcontext", "(", "SAMLSelfEntityContext", ".", "class", ",", "true", ")", ";", "self", ".", "setEntityId", "(", "SamlIdPUtils", ".", "getIssuerFromSamlObject", "(", "samlObject", ")", ")", ";", "return", "ctx", ";", "}" ]
Build encoder message context. @param request the authn request @param samlObject the saml response @param relayState the relay state @return the message context
[ "Build", "encoder", "message", "context", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/encoder/BaseHttpServletAwareSamlObjectEncoder.java#L78-L86
adessoAG/wicked-charts
showcase/wicked-charts-showcase-wicket6/src/main/java/de/adesso/wickedcharts/showcase/HomepageHighcharts.java
HomepageHighcharts.addThemeLinks
private void addThemeLinks(PageParameters parameters) { """ Adds links to the different themes @param parameters the page parameters from the page URI """ if (parameters.getAllNamed().size() < 2) { add(new UpdateThemeLink("defaultTheme", "chart")); add(new UpdateThemeLink("grid", "chart")); add(new UpdateThemeLink("skies", "chart")); add(new UpdateThemeLink("gray", "chart")); add(new UpdateThemeLink("darkblue", "chart")); } else { String chartString = parameters.getAllNamed().get(1).getValue(); add(new UpdateThemeLink("defaultTheme", chartString)); add(new UpdateThemeLink("grid", chartString)); add(new UpdateThemeLink("skies", chartString)); add(new UpdateThemeLink("gray", chartString)); add(new UpdateThemeLink("darkblue", chartString)); } }
java
private void addThemeLinks(PageParameters parameters){ if (parameters.getAllNamed().size() < 2) { add(new UpdateThemeLink("defaultTheme", "chart")); add(new UpdateThemeLink("grid", "chart")); add(new UpdateThemeLink("skies", "chart")); add(new UpdateThemeLink("gray", "chart")); add(new UpdateThemeLink("darkblue", "chart")); } else { String chartString = parameters.getAllNamed().get(1).getValue(); add(new UpdateThemeLink("defaultTheme", chartString)); add(new UpdateThemeLink("grid", chartString)); add(new UpdateThemeLink("skies", chartString)); add(new UpdateThemeLink("gray", chartString)); add(new UpdateThemeLink("darkblue", chartString)); } }
[ "private", "void", "addThemeLinks", "(", "PageParameters", "parameters", ")", "{", "if", "(", "parameters", ".", "getAllNamed", "(", ")", ".", "size", "(", ")", "<", "2", ")", "{", "add", "(", "new", "UpdateThemeLink", "(", "\"defaultTheme\"", ",", "\"chart\"", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"grid\"", ",", "\"chart\"", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"skies\"", ",", "\"chart\"", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"gray\"", ",", "\"chart\"", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"darkblue\"", ",", "\"chart\"", ")", ")", ";", "}", "else", "{", "String", "chartString", "=", "parameters", ".", "getAllNamed", "(", ")", ".", "get", "(", "1", ")", ".", "getValue", "(", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"defaultTheme\"", ",", "chartString", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"grid\"", ",", "chartString", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"skies\"", ",", "chartString", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"gray\"", ",", "chartString", ")", ")", ";", "add", "(", "new", "UpdateThemeLink", "(", "\"darkblue\"", ",", "chartString", ")", ")", ";", "}", "}" ]
Adds links to the different themes @param parameters the page parameters from the page URI
[ "Adds", "links", "to", "the", "different", "themes" ]
train
https://github.com/adessoAG/wicked-charts/blob/498aceff025f612e22ba5135b26531afeabac03c/showcase/wicked-charts-showcase-wicket6/src/main/java/de/adesso/wickedcharts/showcase/HomepageHighcharts.java#L63-L78
jenkinsci/jenkins
core/src/main/java/hudson/model/AbstractModelObject.java
AbstractModelObject.requirePOST
@Deprecated protected final void requirePOST() throws ServletException { """ Convenience method to verify that the current request is a POST request. @deprecated Use {@link RequirePOST} on your method. """ StaplerRequest req = Stapler.getCurrentRequest(); if (req==null) return; // invoked outside the context of servlet String method = req.getMethod(); if(!method.equalsIgnoreCase("POST")) throw new ServletException("Must be POST, Can't be "+method); }
java
@Deprecated protected final void requirePOST() throws ServletException { StaplerRequest req = Stapler.getCurrentRequest(); if (req==null) return; // invoked outside the context of servlet String method = req.getMethod(); if(!method.equalsIgnoreCase("POST")) throw new ServletException("Must be POST, Can't be "+method); }
[ "@", "Deprecated", "protected", "final", "void", "requirePOST", "(", ")", "throws", "ServletException", "{", "StaplerRequest", "req", "=", "Stapler", ".", "getCurrentRequest", "(", ")", ";", "if", "(", "req", "==", "null", ")", "return", ";", "// invoked outside the context of servlet", "String", "method", "=", "req", ".", "getMethod", "(", ")", ";", "if", "(", "!", "method", ".", "equalsIgnoreCase", "(", "\"POST\"", ")", ")", "throw", "new", "ServletException", "(", "\"Must be POST, Can't be \"", "+", "method", ")", ";", "}" ]
Convenience method to verify that the current request is a POST request. @deprecated Use {@link RequirePOST} on your method.
[ "Convenience", "method", "to", "verify", "that", "the", "current", "request", "is", "a", "POST", "request", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractModelObject.java#L84-L91
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java
PredictionsImpl.predictImageUrl
public ImagePrediction predictImageUrl(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { """ Predict an image url and saves the result. @param projectId The project id @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API @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 ImagePrediction object if successful. """ return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).toBlocking().single().body(); }
java
public ImagePrediction predictImageUrl(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).toBlocking().single().body(); }
[ "public", "ImagePrediction", "predictImageUrl", "(", "UUID", "projectId", ",", "PredictImageUrlOptionalParameter", "predictImageUrlOptionalParameter", ")", "{", "return", "predictImageUrlWithServiceResponseAsync", "(", "projectId", ",", "predictImageUrlOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Predict an image url and saves the result. @param projectId The project id @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API @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 ImagePrediction object if successful.
[ "Predict", "an", "image", "url", "and", "saves", "the", "result", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L625-L627
structr/structr
structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java
AuthHelper.isConfirmationKeyValid
public static boolean isConfirmationKeyValid(final String confirmationKey, final Integer validityPeriod) { """ Determines if the key is valid or not. If the key has no timestamp the configuration setting for keys without timestamp is used @param confirmationKey The confirmation key to check @param validityPeriod The validity period for the key (in minutes) @return """ final String[] parts = confirmationKey.split("!"); if (parts.length == 2) { final long confirmationKeyCreated = Long.parseLong(parts[1]); final long maxValidity = confirmationKeyCreated + validityPeriod * 60 * 1000; return (maxValidity >= new Date().getTime()); } return Settings.ConfirmationKeyValidWithoutTimestamp.getValue(); }
java
public static boolean isConfirmationKeyValid(final String confirmationKey, final Integer validityPeriod) { final String[] parts = confirmationKey.split("!"); if (parts.length == 2) { final long confirmationKeyCreated = Long.parseLong(parts[1]); final long maxValidity = confirmationKeyCreated + validityPeriod * 60 * 1000; return (maxValidity >= new Date().getTime()); } return Settings.ConfirmationKeyValidWithoutTimestamp.getValue(); }
[ "public", "static", "boolean", "isConfirmationKeyValid", "(", "final", "String", "confirmationKey", ",", "final", "Integer", "validityPeriod", ")", "{", "final", "String", "[", "]", "parts", "=", "confirmationKey", ".", "split", "(", "\"!\"", ")", ";", "if", "(", "parts", ".", "length", "==", "2", ")", "{", "final", "long", "confirmationKeyCreated", "=", "Long", ".", "parseLong", "(", "parts", "[", "1", "]", ")", ";", "final", "long", "maxValidity", "=", "confirmationKeyCreated", "+", "validityPeriod", "*", "60", "*", "1000", ";", "return", "(", "maxValidity", ">=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ")", ";", "}", "return", "Settings", ".", "ConfirmationKeyValidWithoutTimestamp", ".", "getValue", "(", ")", ";", "}" ]
Determines if the key is valid or not. If the key has no timestamp the configuration setting for keys without timestamp is used @param confirmationKey The confirmation key to check @param validityPeriod The validity period for the key (in minutes) @return
[ "Determines", "if", "the", "key", "is", "valid", "or", "not", ".", "If", "the", "key", "has", "no", "timestamp", "the", "configuration", "setting", "for", "keys", "without", "timestamp", "is", "used" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java#L268-L281
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.handleHttpResponse
private void handleHttpResponse(HttpResponse response, Class<? extends Response> responseClass, KickflipCallback cb) throws IOException { """ Verify HTTP response was successful and pass to handleKickflipResponse. <p/> If we have an HttpResponse at all, it means the status code was < 300, so as far as http inspection goes, this method simply enforces status code of 200 @param response @param responseClass @param cb Must not be null @throws IOException """ //Object parsedResponse = response.parseAs(responseClass); if (isSuccessResponse(response)) { // Http Success handleKickflipResponse(response, responseClass, cb); //cb.onSuccess(responseClass.cast(parsedResponse)); } else { // Http Failure if (VERBOSE) Log.i(TAG, String.format("RESPONSE (F): %s body: %s", shortenUrlString(response.getRequest().getUrl().toString()), response.getContent().toString())); postExceptionToCallback(cb, UNKNOWN_ERROR_CODE); } }
java
private void handleHttpResponse(HttpResponse response, Class<? extends Response> responseClass, KickflipCallback cb) throws IOException { //Object parsedResponse = response.parseAs(responseClass); if (isSuccessResponse(response)) { // Http Success handleKickflipResponse(response, responseClass, cb); //cb.onSuccess(responseClass.cast(parsedResponse)); } else { // Http Failure if (VERBOSE) Log.i(TAG, String.format("RESPONSE (F): %s body: %s", shortenUrlString(response.getRequest().getUrl().toString()), response.getContent().toString())); postExceptionToCallback(cb, UNKNOWN_ERROR_CODE); } }
[ "private", "void", "handleHttpResponse", "(", "HttpResponse", "response", ",", "Class", "<", "?", "extends", "Response", ">", "responseClass", ",", "KickflipCallback", "cb", ")", "throws", "IOException", "{", "//Object parsedResponse = response.parseAs(responseClass);", "if", "(", "isSuccessResponse", "(", "response", ")", ")", "{", "// Http Success", "handleKickflipResponse", "(", "response", ",", "responseClass", ",", "cb", ")", ";", "//cb.onSuccess(responseClass.cast(parsedResponse));", "}", "else", "{", "// Http Failure", "if", "(", "VERBOSE", ")", "Log", ".", "i", "(", "TAG", ",", "String", ".", "format", "(", "\"RESPONSE (F): %s body: %s\"", ",", "shortenUrlString", "(", "response", ".", "getRequest", "(", ")", ".", "getUrl", "(", ")", ".", "toString", "(", ")", ")", ",", "response", ".", "getContent", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "postExceptionToCallback", "(", "cb", ",", "UNKNOWN_ERROR_CODE", ")", ";", "}", "}" ]
Verify HTTP response was successful and pass to handleKickflipResponse. <p/> If we have an HttpResponse at all, it means the status code was < 300, so as far as http inspection goes, this method simply enforces status code of 200 @param response @param responseClass @param cb Must not be null @throws IOException
[ "Verify", "HTTP", "response", "was", "successful", "and", "pass", "to", "handleKickflipResponse", ".", "<p", "/", ">", "If", "we", "have", "an", "HttpResponse", "at", "all", "it", "means", "the", "status", "code", "was", "<", "300", "so", "as", "far", "as", "http", "inspection", "goes", "this", "method", "simply", "enforces", "status", "code", "of", "200" ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L677-L689
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java
UserAttrs.getDoubleAttribute
public static final double getDoubleAttribute(Path path, String attribute, LinkOption... options) throws IOException { """ Returns user-defined-attribute NaN if not found. @param path @param attribute @param options @return @throws IOException @see java.lang.Double#NaN """ return getDoubleAttribute(path, attribute, Double.NaN, options); }
java
public static final double getDoubleAttribute(Path path, String attribute, LinkOption... options) throws IOException { return getDoubleAttribute(path, attribute, Double.NaN, options); }
[ "public", "static", "final", "double", "getDoubleAttribute", "(", "Path", "path", ",", "String", "attribute", ",", "LinkOption", "...", "options", ")", "throws", "IOException", "{", "return", "getDoubleAttribute", "(", "path", ",", "attribute", ",", "Double", ".", "NaN", ",", "options", ")", ";", "}" ]
Returns user-defined-attribute NaN if not found. @param path @param attribute @param options @return @throws IOException @see java.lang.Double#NaN
[ "Returns", "user", "-", "defined", "-", "attribute", "NaN", "if", "not", "found", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java#L267-L270
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setEnterpriseDuration
public void setEnterpriseDuration(int index, Duration value) { """ Set an enterprise duration value. @param index duration index (1-30) @param value duration value """ set(selectField(AssignmentFieldLists.ENTERPRISE_DURATION, index), value); }
java
public void setEnterpriseDuration(int index, Duration value) { set(selectField(AssignmentFieldLists.ENTERPRISE_DURATION, index), value); }
[ "public", "void", "setEnterpriseDuration", "(", "int", "index", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "ENTERPRISE_DURATION", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise duration value. @param index duration index (1-30) @param value duration value
[ "Set", "an", "enterprise", "duration", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1738-L1741
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java
HornSchunckPyramid.process
@Override public void process( ImagePyramid<GrayF32> image1 , ImagePyramid<GrayF32> image2 ) { """ Computes dense optical flow from the provided image pyramid. Image gradient for each layer should be computed directly from the layer images. @param image1 Pyramid of first image @param image2 Pyramid of second image """ // Process the pyramid from low resolution to high resolution boolean first = true; for( int i = image1.getNumLayers()-1; i >= 0; i-- ) { GrayF32 layer1 = image1.getLayer(i); GrayF32 layer2 = image2.getLayer(i); // declare memory for this layer deriv2X.reshape(layer1.width,layer1.height); deriv2Y.reshape(layer1.width,layer1.height); warpDeriv2X.reshape(layer1.width,layer1.height); warpDeriv2Y.reshape(layer1.width,layer1.height); warpImage2.reshape(layer1.width,layer1.height); // compute the gradient for the second image gradient.process(layer2,deriv2X,deriv2Y); if( !first ) { // interpolate initial flow from previous layer interpolateFlowScale(layer1.width, layer1.height); } else { // for the very first layer there is no information on flow so set everything to 0 first = false; initFlowX.reshape(layer1.width,layer1.height); initFlowY.reshape(layer1.width,layer1.height); flowX.reshape(layer1.width,layer1.height); flowY.reshape(layer1.width,layer1.height); ImageMiscOps.fill(flowX,0); ImageMiscOps.fill(flowY,0); ImageMiscOps.fill(initFlowX,0); ImageMiscOps.fill(initFlowY,0); } // compute flow for this layer processLayer(layer1,layer2,deriv2X,deriv2Y); } }
java
@Override public void process( ImagePyramid<GrayF32> image1 , ImagePyramid<GrayF32> image2 ) { // Process the pyramid from low resolution to high resolution boolean first = true; for( int i = image1.getNumLayers()-1; i >= 0; i-- ) { GrayF32 layer1 = image1.getLayer(i); GrayF32 layer2 = image2.getLayer(i); // declare memory for this layer deriv2X.reshape(layer1.width,layer1.height); deriv2Y.reshape(layer1.width,layer1.height); warpDeriv2X.reshape(layer1.width,layer1.height); warpDeriv2Y.reshape(layer1.width,layer1.height); warpImage2.reshape(layer1.width,layer1.height); // compute the gradient for the second image gradient.process(layer2,deriv2X,deriv2Y); if( !first ) { // interpolate initial flow from previous layer interpolateFlowScale(layer1.width, layer1.height); } else { // for the very first layer there is no information on flow so set everything to 0 first = false; initFlowX.reshape(layer1.width,layer1.height); initFlowY.reshape(layer1.width,layer1.height); flowX.reshape(layer1.width,layer1.height); flowY.reshape(layer1.width,layer1.height); ImageMiscOps.fill(flowX,0); ImageMiscOps.fill(flowY,0); ImageMiscOps.fill(initFlowX,0); ImageMiscOps.fill(initFlowY,0); } // compute flow for this layer processLayer(layer1,layer2,deriv2X,deriv2Y); } }
[ "@", "Override", "public", "void", "process", "(", "ImagePyramid", "<", "GrayF32", ">", "image1", ",", "ImagePyramid", "<", "GrayF32", ">", "image2", ")", "{", "// Process the pyramid from low resolution to high resolution", "boolean", "first", "=", "true", ";", "for", "(", "int", "i", "=", "image1", ".", "getNumLayers", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "GrayF32", "layer1", "=", "image1", ".", "getLayer", "(", "i", ")", ";", "GrayF32", "layer2", "=", "image2", ".", "getLayer", "(", "i", ")", ";", "// declare memory for this layer", "deriv2X", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "deriv2Y", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "warpDeriv2X", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "warpDeriv2Y", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "warpImage2", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "// compute the gradient for the second image", "gradient", ".", "process", "(", "layer2", ",", "deriv2X", ",", "deriv2Y", ")", ";", "if", "(", "!", "first", ")", "{", "// interpolate initial flow from previous layer", "interpolateFlowScale", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "}", "else", "{", "// for the very first layer there is no information on flow so set everything to 0", "first", "=", "false", ";", "initFlowX", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "initFlowY", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "flowX", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "flowY", ".", "reshape", "(", "layer1", ".", "width", ",", "layer1", ".", "height", ")", ";", "ImageMiscOps", ".", "fill", "(", "flowX", ",", "0", ")", ";", "ImageMiscOps", ".", "fill", "(", "flowY", ",", "0", ")", ";", "ImageMiscOps", ".", "fill", "(", "initFlowX", ",", "0", ")", ";", "ImageMiscOps", ".", "fill", "(", "initFlowY", ",", "0", ")", ";", "}", "// compute flow for this layer", "processLayer", "(", "layer1", ",", "layer2", ",", "deriv2X", ",", "deriv2Y", ")", ";", "}", "}" ]
Computes dense optical flow from the provided image pyramid. Image gradient for each layer should be computed directly from the layer images. @param image1 Pyramid of first image @param image2 Pyramid of second image
[ "Computes", "dense", "optical", "flow", "from", "the", "provided", "image", "pyramid", ".", "Image", "gradient", "for", "each", "layer", "should", "be", "computed", "directly", "from", "the", "layer", "images", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java#L108-L150
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/TimeoutHelper.java
TimeoutHelper.callWithTimeout
public <T> T callWithTimeout(String description, int timeout, Callable<T> task) { """ Calls task but ensures it ends. @param <T> expected type of return value. @param description description of task. @param timeout timeout in milliseconds. @param task task to execute. @return return value from task. """ Future<T> callFuture = threadPool.submit(task); return getWithTimeout(callFuture, timeout, description); }
java
public <T> T callWithTimeout(String description, int timeout, Callable<T> task) { Future<T> callFuture = threadPool.submit(task); return getWithTimeout(callFuture, timeout, description); }
[ "public", "<", "T", ">", "T", "callWithTimeout", "(", "String", "description", ",", "int", "timeout", ",", "Callable", "<", "T", ">", "task", ")", "{", "Future", "<", "T", ">", "callFuture", "=", "threadPool", ".", "submit", "(", "task", ")", ";", "return", "getWithTimeout", "(", "callFuture", ",", "timeout", ",", "description", ")", ";", "}" ]
Calls task but ensures it ends. @param <T> expected type of return value. @param description description of task. @param timeout timeout in milliseconds. @param task task to execute. @return return value from task.
[ "Calls", "task", "but", "ensures", "it", "ends", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/TimeoutHelper.java#L25-L28
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/ecr/EcrExtendedAuth.java
EcrExtendedAuth.extendedAuth
public AuthConfig extendedAuth(AuthConfig localCredentials) throws IOException, MojoExecutionException { """ Perform extended authentication. Use the provided credentials as IAM credentials and get a temporary ECR token. @param localCredentials IAM id/secret @return ECR base64 encoded username:password @throws IOException @throws MojoExecutionException """ JsonObject jo = getAuthorizationToken(localCredentials); JsonArray authorizationDatas = jo.getAsJsonArray("authorizationData"); JsonObject authorizationData = authorizationDatas.get(0).getAsJsonObject(); String authorizationToken = authorizationData.get("authorizationToken").getAsString(); return new AuthConfig(authorizationToken, "none"); }
java
public AuthConfig extendedAuth(AuthConfig localCredentials) throws IOException, MojoExecutionException { JsonObject jo = getAuthorizationToken(localCredentials); JsonArray authorizationDatas = jo.getAsJsonArray("authorizationData"); JsonObject authorizationData = authorizationDatas.get(0).getAsJsonObject(); String authorizationToken = authorizationData.get("authorizationToken").getAsString(); return new AuthConfig(authorizationToken, "none"); }
[ "public", "AuthConfig", "extendedAuth", "(", "AuthConfig", "localCredentials", ")", "throws", "IOException", ",", "MojoExecutionException", "{", "JsonObject", "jo", "=", "getAuthorizationToken", "(", "localCredentials", ")", ";", "JsonArray", "authorizationDatas", "=", "jo", ".", "getAsJsonArray", "(", "\"authorizationData\"", ")", ";", "JsonObject", "authorizationData", "=", "authorizationDatas", ".", "get", "(", "0", ")", ".", "getAsJsonObject", "(", ")", ";", "String", "authorizationToken", "=", "authorizationData", ".", "get", "(", "\"authorizationToken\"", ")", ".", "getAsString", "(", ")", ";", "return", "new", "AuthConfig", "(", "authorizationToken", ",", "\"none\"", ")", ";", "}" ]
Perform extended authentication. Use the provided credentials as IAM credentials and get a temporary ECR token. @param localCredentials IAM id/secret @return ECR base64 encoded username:password @throws IOException @throws MojoExecutionException
[ "Perform", "extended", "authentication", ".", "Use", "the", "provided", "credentials", "as", "IAM", "credentials", "and", "get", "a", "temporary", "ECR", "token", "." ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/ecr/EcrExtendedAuth.java#L89-L97
alkacon/opencms-core
src/org/opencms/util/CmsParameterEscaper.java
CmsParameterEscaper.createAntiSamy
public AntiSamy createAntiSamy(CmsObject cms, String policyPath) { """ Creates a new AntiSamy instance for a given policy path.<p> @param cms the current CMS context @param policyPath the policy site path @return the new AntiSamy instance """ String rootPath = cms.addSiteRoot(policyPath); Policy policy = null; if (policyPath != null) { Object cacheValue = CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(cms, rootPath); if (cacheValue == null) { policy = readPolicy(cms, policyPath); if (policy != null) { CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(cms, rootPath, policy); } } else { policy = (Policy)cacheValue; } } if (policy == null) { policy = defaultPolicy; } if (policy != null) { return new AntiSamy(policy); } return null; }
java
public AntiSamy createAntiSamy(CmsObject cms, String policyPath) { String rootPath = cms.addSiteRoot(policyPath); Policy policy = null; if (policyPath != null) { Object cacheValue = CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(cms, rootPath); if (cacheValue == null) { policy = readPolicy(cms, policyPath); if (policy != null) { CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(cms, rootPath, policy); } } else { policy = (Policy)cacheValue; } } if (policy == null) { policy = defaultPolicy; } if (policy != null) { return new AntiSamy(policy); } return null; }
[ "public", "AntiSamy", "createAntiSamy", "(", "CmsObject", "cms", ",", "String", "policyPath", ")", "{", "String", "rootPath", "=", "cms", ".", "addSiteRoot", "(", "policyPath", ")", ";", "Policy", "policy", "=", "null", ";", "if", "(", "policyPath", "!=", "null", ")", "{", "Object", "cacheValue", "=", "CmsVfsMemoryObjectCache", ".", "getVfsMemoryObjectCache", "(", ")", ".", "getCachedObject", "(", "cms", ",", "rootPath", ")", ";", "if", "(", "cacheValue", "==", "null", ")", "{", "policy", "=", "readPolicy", "(", "cms", ",", "policyPath", ")", ";", "if", "(", "policy", "!=", "null", ")", "{", "CmsVfsMemoryObjectCache", ".", "getVfsMemoryObjectCache", "(", ")", ".", "putCachedObject", "(", "cms", ",", "rootPath", ",", "policy", ")", ";", "}", "}", "else", "{", "policy", "=", "(", "Policy", ")", "cacheValue", ";", "}", "}", "if", "(", "policy", "==", "null", ")", "{", "policy", "=", "defaultPolicy", ";", "}", "if", "(", "policy", "!=", "null", ")", "{", "return", "new", "AntiSamy", "(", "policy", ")", ";", "}", "return", "null", ";", "}" ]
Creates a new AntiSamy instance for a given policy path.<p> @param cms the current CMS context @param policyPath the policy site path @return the new AntiSamy instance
[ "Creates", "a", "new", "AntiSamy", "instance", "for", "a", "given", "policy", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsParameterEscaper.java#L125-L147
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/metrics/MetricsStore.java
MetricsStore.putWorkerMetrics
public void putWorkerMetrics(String hostname, List<Metric> metrics) { """ Put the metrics from a worker with a hostname. If all the old metrics associated with this instance will be removed and then replaced by the latest. @param hostname the hostname of the instance @param metrics the new worker metrics """ if (metrics.isEmpty()) { return; } synchronized (mWorkerMetrics) { mWorkerMetrics.removeByField(ID_INDEX, getFullInstanceId(hostname, null)); for (Metric metric : metrics) { if (metric.getHostname() == null) { continue; // ignore metrics whose hostname is null } mWorkerMetrics.add(metric); } } }
java
public void putWorkerMetrics(String hostname, List<Metric> metrics) { if (metrics.isEmpty()) { return; } synchronized (mWorkerMetrics) { mWorkerMetrics.removeByField(ID_INDEX, getFullInstanceId(hostname, null)); for (Metric metric : metrics) { if (metric.getHostname() == null) { continue; // ignore metrics whose hostname is null } mWorkerMetrics.add(metric); } } }
[ "public", "void", "putWorkerMetrics", "(", "String", "hostname", ",", "List", "<", "Metric", ">", "metrics", ")", "{", "if", "(", "metrics", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "synchronized", "(", "mWorkerMetrics", ")", "{", "mWorkerMetrics", ".", "removeByField", "(", "ID_INDEX", ",", "getFullInstanceId", "(", "hostname", ",", "null", ")", ")", ";", "for", "(", "Metric", "metric", ":", "metrics", ")", "{", "if", "(", "metric", ".", "getHostname", "(", ")", "==", "null", ")", "{", "continue", ";", "// ignore metrics whose hostname is null", "}", "mWorkerMetrics", ".", "add", "(", "metric", ")", ";", "}", "}", "}" ]
Put the metrics from a worker with a hostname. If all the old metrics associated with this instance will be removed and then replaced by the latest. @param hostname the hostname of the instance @param metrics the new worker metrics
[ "Put", "the", "metrics", "from", "a", "worker", "with", "a", "hostname", ".", "If", "all", "the", "old", "metrics", "associated", "with", "this", "instance", "will", "be", "removed", "and", "then", "replaced", "by", "the", "latest", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/metrics/MetricsStore.java#L91-L104
paypal/SeLion
client/src/main/java/com/paypal/selion/configuration/LocalConfig.java
LocalConfig.setConfigProperty
public synchronized void setConfigProperty(Config.ConfigProperty configProperty, Object configPropertyValue) { """ Sets the SeLion configuration property value. @param configProperty The configuration property to set. @param configPropertyValue The configuration property value to set. """ checkArgument(configProperty != null, "Config property cannot be null"); checkArgument(checkNotInGlobalScope(configProperty), String.format("The configuration property (%s) is not supported in local config.", configProperty)); // NOSONAR checkArgument(configPropertyValue != null, "Config property value cannot be null"); baseConfig.setProperty(configProperty.getName(), configPropertyValue); }
java
public synchronized void setConfigProperty(Config.ConfigProperty configProperty, Object configPropertyValue) { checkArgument(configProperty != null, "Config property cannot be null"); checkArgument(checkNotInGlobalScope(configProperty), String.format("The configuration property (%s) is not supported in local config.", configProperty)); // NOSONAR checkArgument(configPropertyValue != null, "Config property value cannot be null"); baseConfig.setProperty(configProperty.getName(), configPropertyValue); }
[ "public", "synchronized", "void", "setConfigProperty", "(", "Config", ".", "ConfigProperty", "configProperty", ",", "Object", "configPropertyValue", ")", "{", "checkArgument", "(", "configProperty", "!=", "null", ",", "\"Config property cannot be null\"", ")", ";", "checkArgument", "(", "checkNotInGlobalScope", "(", "configProperty", ")", ",", "String", ".", "format", "(", "\"The configuration property (%s) is not supported in local config.\"", ",", "configProperty", ")", ")", ";", "// NOSONAR", "checkArgument", "(", "configPropertyValue", "!=", "null", ",", "\"Config property value cannot be null\"", ")", ";", "baseConfig", ".", "setProperty", "(", "configProperty", ".", "getName", "(", ")", ",", "configPropertyValue", ")", ";", "}" ]
Sets the SeLion configuration property value. @param configProperty The configuration property to set. @param configPropertyValue The configuration property value to set.
[ "Sets", "the", "SeLion", "configuration", "property", "value", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/configuration/LocalConfig.java#L178-L185
esigate/esigate
esigate-core/src/main/java/org/esigate/http/MoveResponseHeader.java
MoveResponseHeader.moveHeader
public static void moveHeader(HttpResponse response, String srcName, String targetName) { """ This method can be used directly to move an header. @param response HTTP response @param srcName source header name @param targetName target header name """ if (response.containsHeader(srcName)) { LOG.info("Moving header {} to {}", srcName, targetName); Header[] headers = response.getHeaders(srcName); response.removeHeaders(targetName); for (Header h : headers) { response.addHeader(targetName, h.getValue()); } response.removeHeaders(srcName); } }
java
public static void moveHeader(HttpResponse response, String srcName, String targetName) { if (response.containsHeader(srcName)) { LOG.info("Moving header {} to {}", srcName, targetName); Header[] headers = response.getHeaders(srcName); response.removeHeaders(targetName); for (Header h : headers) { response.addHeader(targetName, h.getValue()); } response.removeHeaders(srcName); } }
[ "public", "static", "void", "moveHeader", "(", "HttpResponse", "response", ",", "String", "srcName", ",", "String", "targetName", ")", "{", "if", "(", "response", ".", "containsHeader", "(", "srcName", ")", ")", "{", "LOG", ".", "info", "(", "\"Moving header {} to {}\"", ",", "srcName", ",", "targetName", ")", ";", "Header", "[", "]", "headers", "=", "response", ".", "getHeaders", "(", "srcName", ")", ";", "response", ".", "removeHeaders", "(", "targetName", ")", ";", "for", "(", "Header", "h", ":", "headers", ")", "{", "response", ".", "addHeader", "(", "targetName", ",", "h", ".", "getValue", "(", ")", ")", ";", "}", "response", ".", "removeHeaders", "(", "srcName", ")", ";", "}", "}" ]
This method can be used directly to move an header. @param response HTTP response @param srcName source header name @param targetName target header name
[ "This", "method", "can", "be", "used", "directly", "to", "move", "an", "header", "." ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/MoveResponseHeader.java#L73-L84
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/OrderByPlanNode.java
OrderByPlanNode.addSortExpression
public void addSortExpression(AbstractExpression sortExpr, SortDirectionType sortDir) { """ Add a sort expression to the order-by @param sortExpr The input expression on which to order the rows @param sortDir """ assert(sortExpr != null); // PlanNodes all need private deep copies of expressions // so that the resolveColumnIndexes results // don't get bashed by other nodes or subsequent planner runs m_sortExpressions.add(sortExpr.clone()); m_sortDirections.add(sortDir); }
java
public void addSortExpression(AbstractExpression sortExpr, SortDirectionType sortDir) { assert(sortExpr != null); // PlanNodes all need private deep copies of expressions // so that the resolveColumnIndexes results // don't get bashed by other nodes or subsequent planner runs m_sortExpressions.add(sortExpr.clone()); m_sortDirections.add(sortDir); }
[ "public", "void", "addSortExpression", "(", "AbstractExpression", "sortExpr", ",", "SortDirectionType", "sortDir", ")", "{", "assert", "(", "sortExpr", "!=", "null", ")", ";", "// PlanNodes all need private deep copies of expressions", "// so that the resolveColumnIndexes results", "// don't get bashed by other nodes or subsequent planner runs", "m_sortExpressions", ".", "add", "(", "sortExpr", ".", "clone", "(", ")", ")", ";", "m_sortDirections", ".", "add", "(", "sortDir", ")", ";", "}" ]
Add a sort expression to the order-by @param sortExpr The input expression on which to order the rows @param sortDir
[ "Add", "a", "sort", "expression", "to", "the", "order", "-", "by" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/OrderByPlanNode.java#L99-L107
riversun/string-grabber
src/main/java/org/riversun/string_grabber/StringGrabber.java
StringGrabber.appendRepeat
public StringGrabber appendRepeat(String str, int repeatCount) { """ Append a string to be repeated @see StringGrabber#insertRepeat(String); @param str @param repeatCount @return """ for (int i = 0; i < repeatCount; i++) { if (str != null) { sb.append(str); } } return StringGrabber.this; }
java
public StringGrabber appendRepeat(String str, int repeatCount) { for (int i = 0; i < repeatCount; i++) { if (str != null) { sb.append(str); } } return StringGrabber.this; }
[ "public", "StringGrabber", "appendRepeat", "(", "String", "str", ",", "int", "repeatCount", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "repeatCount", ";", "i", "++", ")", "{", "if", "(", "str", "!=", "null", ")", "{", "sb", ".", "append", "(", "str", ")", ";", "}", "}", "return", "StringGrabber", ".", "this", ";", "}" ]
Append a string to be repeated @see StringGrabber#insertRepeat(String); @param str @param repeatCount @return
[ "Append", "a", "string", "to", "be", "repeated" ]
train
https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringGrabber.java#L569-L576
VoltDB/voltdb
src/frontend/org/voltdb/compiler/VoltCompiler.java
VoltCompiler.compileEmptyCatalog
public boolean compileEmptyCatalog(final String jarOutputPath) { """ Compile empty catalog jar @param jarOutputPath output jar path @return true if successful """ // Use a special DDL reader to provide the contents. List<VoltCompilerReader> ddlReaderList = new ArrayList<>(1); ddlReaderList.add(new VoltCompilerStringReader("ddl.sql", m_emptyDDLComment)); // Seed it with the DDL so that a version upgrade hack in compileInternalToFile() // doesn't try to get the DDL file from the path. InMemoryJarfile jarFile = new InMemoryJarfile(); try { ddlReaderList.get(0).putInJar(jarFile, "ddl.sql"); } catch (IOException e) { compilerLog.error("Failed to add DDL file to empty in-memory jar."); return false; } return compileInternalToFile(jarOutputPath, null, null, ddlReaderList, jarFile); }
java
public boolean compileEmptyCatalog(final String jarOutputPath) { // Use a special DDL reader to provide the contents. List<VoltCompilerReader> ddlReaderList = new ArrayList<>(1); ddlReaderList.add(new VoltCompilerStringReader("ddl.sql", m_emptyDDLComment)); // Seed it with the DDL so that a version upgrade hack in compileInternalToFile() // doesn't try to get the DDL file from the path. InMemoryJarfile jarFile = new InMemoryJarfile(); try { ddlReaderList.get(0).putInJar(jarFile, "ddl.sql"); } catch (IOException e) { compilerLog.error("Failed to add DDL file to empty in-memory jar."); return false; } return compileInternalToFile(jarOutputPath, null, null, ddlReaderList, jarFile); }
[ "public", "boolean", "compileEmptyCatalog", "(", "final", "String", "jarOutputPath", ")", "{", "// Use a special DDL reader to provide the contents.", "List", "<", "VoltCompilerReader", ">", "ddlReaderList", "=", "new", "ArrayList", "<>", "(", "1", ")", ";", "ddlReaderList", ".", "add", "(", "new", "VoltCompilerStringReader", "(", "\"ddl.sql\"", ",", "m_emptyDDLComment", ")", ")", ";", "// Seed it with the DDL so that a version upgrade hack in compileInternalToFile()", "// doesn't try to get the DDL file from the path.", "InMemoryJarfile", "jarFile", "=", "new", "InMemoryJarfile", "(", ")", ";", "try", "{", "ddlReaderList", ".", "get", "(", "0", ")", ".", "putInJar", "(", "jarFile", ",", "\"ddl.sql\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "compilerLog", ".", "error", "(", "\"Failed to add DDL file to empty in-memory jar.\"", ")", ";", "return", "false", ";", "}", "return", "compileInternalToFile", "(", "jarOutputPath", ",", "null", ",", "null", ",", "ddlReaderList", ",", "jarFile", ")", ";", "}" ]
Compile empty catalog jar @param jarOutputPath output jar path @return true if successful
[ "Compile", "empty", "catalog", "jar" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompiler.java#L612-L627
GCRC/nunaliit
nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java
Searches.getAudioMediaFromPlaceId
public JSONObject getAudioMediaFromPlaceId(String place_id) throws Exception { """ Finds and returns all audio media associated with a place id. @param place_id Id of associated place @return A JSON object containing all audio media @throws Exception """ List<SelectedColumn> selectFields = new Vector<SelectedColumn>(); selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "id") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "filename") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "mimetype") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "title") ); PreparedStatement stmt = connection.prepareStatement( "SELECT id,place_id,filename,mimetype,title " + "FROM contributions " + "WHERE mimetype LIKE 'audio/%' AND place_id = ?;" ); stmt.setInt(1, Integer.parseInt(place_id)); JSONArray array = executeStatementToJson(stmt, selectFields); JSONObject result = new JSONObject(); result.put("media", array); return result; }
java
public JSONObject getAudioMediaFromPlaceId(String place_id) throws Exception { List<SelectedColumn> selectFields = new Vector<SelectedColumn>(); selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "id") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "filename") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "mimetype") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "title") ); PreparedStatement stmt = connection.prepareStatement( "SELECT id,place_id,filename,mimetype,title " + "FROM contributions " + "WHERE mimetype LIKE 'audio/%' AND place_id = ?;" ); stmt.setInt(1, Integer.parseInt(place_id)); JSONArray array = executeStatementToJson(stmt, selectFields); JSONObject result = new JSONObject(); result.put("media", array); return result; }
[ "public", "JSONObject", "getAudioMediaFromPlaceId", "(", "String", "place_id", ")", "throws", "Exception", "{", "List", "<", "SelectedColumn", ">", "selectFields", "=", "new", "Vector", "<", "SelectedColumn", ">", "(", ")", ";", "selectFields", ".", "add", "(", "new", "SelectedColumn", "(", "SelectedColumn", ".", "Type", ".", "INTEGER", ",", "\"id\"", ")", ")", ";", "selectFields", ".", "add", "(", "new", "SelectedColumn", "(", "SelectedColumn", ".", "Type", ".", "INTEGER", ",", "\"place_id\"", ")", ")", ";", "selectFields", ".", "add", "(", "new", "SelectedColumn", "(", "SelectedColumn", ".", "Type", ".", "STRING", ",", "\"filename\"", ")", ")", ";", "selectFields", ".", "add", "(", "new", "SelectedColumn", "(", "SelectedColumn", ".", "Type", ".", "STRING", ",", "\"mimetype\"", ")", ")", ";", "selectFields", ".", "add", "(", "new", "SelectedColumn", "(", "SelectedColumn", ".", "Type", ".", "STRING", ",", "\"title\"", ")", ")", ";", "PreparedStatement", "stmt", "=", "connection", ".", "prepareStatement", "(", "\"SELECT id,place_id,filename,mimetype,title \"", "+", "\"FROM contributions \"", "+", "\"WHERE mimetype LIKE 'audio/%' AND place_id = ?;\"", ")", ";", "stmt", ".", "setInt", "(", "1", ",", "Integer", ".", "parseInt", "(", "place_id", ")", ")", ";", "JSONArray", "array", "=", "executeStatementToJson", "(", "stmt", ",", "selectFields", ")", ";", "JSONObject", "result", "=", "new", "JSONObject", "(", ")", ";", "result", ".", "put", "(", "\"media\"", ",", "array", ")", ";", "return", "result", ";", "}" ]
Finds and returns all audio media associated with a place id. @param place_id Id of associated place @return A JSON object containing all audio media @throws Exception
[ "Finds", "and", "returns", "all", "audio", "media", "associated", "with", "a", "place", "id", "." ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java#L663-L685
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/api/CustomAPI.java
CustomAPI.uploadHeadImg
public ResultType uploadHeadImg(String accountName, File file) { """ 设置客服帐号头像 @param accountName 客服帐号名 @param file 头像文件 @return 设置结果 """ LOG.debug("设置客服帐号头像....."); BeanUtil.requireNonNull(accountName, "帐号必填"); BeanUtil.requireNonNull(file, "文件为空"); String fileName = file.getName().toLowerCase(); if (!fileName.endsWith("jpg")) { throw new WeixinException("头像必须是jpg格式"); } String url = BASE_API_URL + "customservice/kfaccount/uploadheadimg?access_token=#&kf_account=" + accountName; BaseResponse response = executePost(url, null, file); return ResultType.get(response.getErrcode()); }
java
public ResultType uploadHeadImg(String accountName, File file) { LOG.debug("设置客服帐号头像....."); BeanUtil.requireNonNull(accountName, "帐号必填"); BeanUtil.requireNonNull(file, "文件为空"); String fileName = file.getName().toLowerCase(); if (!fileName.endsWith("jpg")) { throw new WeixinException("头像必须是jpg格式"); } String url = BASE_API_URL + "customservice/kfaccount/uploadheadimg?access_token=#&kf_account=" + accountName; BaseResponse response = executePost(url, null, file); return ResultType.get(response.getErrcode()); }
[ "public", "ResultType", "uploadHeadImg", "(", "String", "accountName", ",", "File", "file", ")", "{", "LOG", ".", "debug", "(", "\"设置客服帐号头像.....\");", "", "", "BeanUtil", ".", "requireNonNull", "(", "accountName", ",", "\"帐号必填\");", "", "", "BeanUtil", ".", "requireNonNull", "(", "file", ",", "\"文件为空\");", "", "", "String", "fileName", "=", "file", ".", "getName", "(", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "!", "fileName", ".", "endsWith", "(", "\"jpg\"", ")", ")", "{", "throw", "new", "WeixinException", "(", "\"头像必须是jpg格式\");", "", "", "}", "String", "url", "=", "BASE_API_URL", "+", "\"customservice/kfaccount/uploadheadimg?access_token=#&kf_account=\"", "+", "accountName", ";", "BaseResponse", "response", "=", "executePost", "(", "url", ",", "null", ",", "file", ")", ";", "return", "ResultType", ".", "get", "(", "response", ".", "getErrcode", "(", ")", ")", ";", "}" ]
设置客服帐号头像 @param accountName 客服帐号名 @param file 头像文件 @return 设置结果
[ "设置客服帐号头像" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/CustomAPI.java#L175-L187
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listMetricsWithServiceResponseAsync
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsWithServiceResponseAsync(final String resourceGroupName, final String name) { """ Get metrics for an App Serice plan. Get metrics for an App Serice plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object """ return listMetricsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMetricsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", ">", "listMetricsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listMetricsSinglePageAsync", "(", "resourceGroupName", ",", "name", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listMetricsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Get metrics for an App Serice plan. Get metrics for an App Serice plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object
[ "Get", "metrics", "for", "an", "App", "Serice", "plan", ".", "Get", "metrics", "for", "an", "App", "Serice", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1995-L2007
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/RedmineManagerFactory.java
RedmineManagerFactory.createWithApiKey
public static RedmineManager createWithApiKey(String uri, String apiAccessKey) { """ Creates an instance of RedmineManager class. Host and apiAccessKey are not checked at this moment. @param uri complete Redmine server web URI, including protocol and port number. Example: http://demo.redmine.org:8080 @param apiAccessKey Redmine API access key. It is shown on "My Account" / "API access key" webpage (check <i>http://redmine_server_url/my/account</i> URL). This parameter is <strong>optional</strong> (can be set to NULL) for Redmine projects, which are "public". """ return createWithApiKey(uri, apiAccessKey, createDefaultHttpClient(uri)); }
java
public static RedmineManager createWithApiKey(String uri, String apiAccessKey) { return createWithApiKey(uri, apiAccessKey, createDefaultHttpClient(uri)); }
[ "public", "static", "RedmineManager", "createWithApiKey", "(", "String", "uri", ",", "String", "apiAccessKey", ")", "{", "return", "createWithApiKey", "(", "uri", ",", "apiAccessKey", ",", "createDefaultHttpClient", "(", "uri", ")", ")", ";", "}" ]
Creates an instance of RedmineManager class. Host and apiAccessKey are not checked at this moment. @param uri complete Redmine server web URI, including protocol and port number. Example: http://demo.redmine.org:8080 @param apiAccessKey Redmine API access key. It is shown on "My Account" / "API access key" webpage (check <i>http://redmine_server_url/my/account</i> URL). This parameter is <strong>optional</strong> (can be set to NULL) for Redmine projects, which are "public".
[ "Creates", "an", "instance", "of", "RedmineManager", "class", ".", "Host", "and", "apiAccessKey", "are", "not", "checked", "at", "this", "moment", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/RedmineManagerFactory.java#L92-L96
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.deleteHistoricalVersions
public void deleteHistoricalVersions(int versionsToKeep, int versionsDeleted, long timeDeleted) throws Exception { """ Deletes the versions from the history tables that are older then the given number of versions.<p> @param versionsToKeep number of versions to keep, is ignored if negative @param versionsDeleted number of versions to keep for deleted resources, is ignored if negative @param timeDeleted deleted resources older than this will also be deleted, is ignored if negative @throws Exception if something goes wrong @see CmsObject#deleteHistoricalVersions( int, int, long, I_CmsReport) """ m_cms.deleteHistoricalVersions( versionsToKeep, versionsDeleted, timeDeleted, new CmsShellReport(m_cms.getRequestContext().getLocale())); }
java
public void deleteHistoricalVersions(int versionsToKeep, int versionsDeleted, long timeDeleted) throws Exception { m_cms.deleteHistoricalVersions( versionsToKeep, versionsDeleted, timeDeleted, new CmsShellReport(m_cms.getRequestContext().getLocale())); }
[ "public", "void", "deleteHistoricalVersions", "(", "int", "versionsToKeep", ",", "int", "versionsDeleted", ",", "long", "timeDeleted", ")", "throws", "Exception", "{", "m_cms", ".", "deleteHistoricalVersions", "(", "versionsToKeep", ",", "versionsDeleted", ",", "timeDeleted", ",", "new", "CmsShellReport", "(", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ")", ";", "}" ]
Deletes the versions from the history tables that are older then the given number of versions.<p> @param versionsToKeep number of versions to keep, is ignored if negative @param versionsDeleted number of versions to keep for deleted resources, is ignored if negative @param timeDeleted deleted resources older than this will also be deleted, is ignored if negative @throws Exception if something goes wrong @see CmsObject#deleteHistoricalVersions( int, int, long, I_CmsReport)
[ "Deletes", "the", "versions", "from", "the", "history", "tables", "that", "are", "older", "then", "the", "given", "number", "of", "versions", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L462-L469
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/utils/BuilderUtils.java
BuilderUtils.methodHasArgument
public static boolean methodHasArgument(Method method, Property property) { """ Checks if method has a specific argument. @param method The method. @param property The argument. @return True if matching argument if found. """ for (Property candidate : method.getArguments()) { if (candidate.equals(property)) { return true; } } return false; }
java
public static boolean methodHasArgument(Method method, Property property) { for (Property candidate : method.getArguments()) { if (candidate.equals(property)) { return true; } } return false; }
[ "public", "static", "boolean", "methodHasArgument", "(", "Method", "method", ",", "Property", "property", ")", "{", "for", "(", "Property", "candidate", ":", "method", ".", "getArguments", "(", ")", ")", "{", "if", "(", "candidate", ".", "equals", "(", "property", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if method has a specific argument. @param method The method. @param property The argument. @return True if matching argument if found.
[ "Checks", "if", "method", "has", "a", "specific", "argument", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/utils/BuilderUtils.java#L195-L202
zaproxy/zaproxy
src/org/parosproxy/paros/network/HttpHeader.java
HttpHeader.addInternalHeaderFields
private void addInternalHeaderFields(String name, String value) { """ Add the header stored in internal hashtable @param name @param value """ String key = normalisedHeaderName(name); Vector<String> v = getHeaders(key); if (v == null) { v = new Vector<>(); mHeaderFields.put(key, v); } if (value != null) { v.add(value); } else { mHeaderFields.remove(key); } }
java
private void addInternalHeaderFields(String name, String value) { String key = normalisedHeaderName(name); Vector<String> v = getHeaders(key); if (v == null) { v = new Vector<>(); mHeaderFields.put(key, v); } if (value != null) { v.add(value); } else { mHeaderFields.remove(key); } }
[ "private", "void", "addInternalHeaderFields", "(", "String", "name", ",", "String", "value", ")", "{", "String", "key", "=", "normalisedHeaderName", "(", "name", ")", ";", "Vector", "<", "String", ">", "v", "=", "getHeaders", "(", "key", ")", ";", "if", "(", "v", "==", "null", ")", "{", "v", "=", "new", "Vector", "<>", "(", ")", ";", "mHeaderFields", ".", "put", "(", "key", ",", "v", ")", ";", "}", "if", "(", "value", "!=", "null", ")", "{", "v", ".", "add", "(", "value", ")", ";", "}", "else", "{", "mHeaderFields", ".", "remove", "(", "key", ")", ";", "}", "}" ]
Add the header stored in internal hashtable @param name @param value
[ "Add", "the", "header", "stored", "in", "internal", "hashtable" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/HttpHeader.java#L483-L496
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java
TimeZone.getFrozenICUTimeZone
static BasicTimeZone getFrozenICUTimeZone(String id, boolean trySystem) { """ Returns a frozen ICU type TimeZone object given a time zone ID. @param id the time zone ID @param trySystem if true tries the system time zones first otherwise skip to the custom time zones. @return the frozen ICU TimeZone or null if one could not be created. """ BasicTimeZone result = null; if (trySystem) { result = ZoneMeta.getSystemTimeZone(id); } if (result == null) { result = ZoneMeta.getCustomTimeZone(id); } return result; }
java
static BasicTimeZone getFrozenICUTimeZone(String id, boolean trySystem) { BasicTimeZone result = null; if (trySystem) { result = ZoneMeta.getSystemTimeZone(id); } if (result == null) { result = ZoneMeta.getCustomTimeZone(id); } return result; }
[ "static", "BasicTimeZone", "getFrozenICUTimeZone", "(", "String", "id", ",", "boolean", "trySystem", ")", "{", "BasicTimeZone", "result", "=", "null", ";", "if", "(", "trySystem", ")", "{", "result", "=", "ZoneMeta", ".", "getSystemTimeZone", "(", "id", ")", ";", "}", "if", "(", "result", "==", "null", ")", "{", "result", "=", "ZoneMeta", ".", "getCustomTimeZone", "(", "id", ")", ";", "}", "return", "result", ";", "}" ]
Returns a frozen ICU type TimeZone object given a time zone ID. @param id the time zone ID @param trySystem if true tries the system time zones first otherwise skip to the custom time zones. @return the frozen ICU TimeZone or null if one could not be created.
[ "Returns", "a", "frozen", "ICU", "type", "TimeZone", "object", "given", "a", "time", "zone", "ID", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L708-L717
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/converter/AbstractConverter.java
AbstractConverter.convertToType
@Deprecated protected <G extends T> G convertToType(Class<G> type, Object value) { """ Convert the input object into an output object of the specified type. <p> Typical implementations will provide a minimum of {@code String --> type} conversion. @param <G> the type in which the provided value has o be converted @param type Data type to which this value should be converted. @param value The input value to be converted. @return The converted value. @deprecated since 3.0M1 overwrite {@link #convertToType(Type, Object)} instead """ return convertToType((Type) type, value); }
java
@Deprecated protected <G extends T> G convertToType(Class<G> type, Object value) { return convertToType((Type) type, value); }
[ "@", "Deprecated", "protected", "<", "G", "extends", "T", ">", "G", "convertToType", "(", "Class", "<", "G", ">", "type", ",", "Object", "value", ")", "{", "return", "convertToType", "(", "(", "Type", ")", "type", ",", "value", ")", ";", "}" ]
Convert the input object into an output object of the specified type. <p> Typical implementations will provide a minimum of {@code String --> type} conversion. @param <G> the type in which the provided value has o be converted @param type Data type to which this value should be converted. @param value The input value to be converted. @return The converted value. @deprecated since 3.0M1 overwrite {@link #convertToType(Type, Object)} instead
[ "Convert", "the", "input", "object", "into", "an", "output", "object", "of", "the", "specified", "type", ".", "<p", ">", "Typical", "implementations", "will", "provide", "a", "minimum", "of", "{", "@code", "String", "--", ">", "type", "}", "conversion", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/converter/AbstractConverter.java#L102-L106
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.readInt
public static int readInt(byte[] source, int position) { """ Reads a 32-bit integer from the given byte array starting at the given position. @param source The byte array to read from. @param position The position in the byte array to start reading at. @return The read number. """ return (source[position] & 0xFF) << 24 | (source[position + 1] & 0xFF) << 16 | (source[position + 2] & 0xFF) << 8 | (source[position + 3] & 0xFF); }
java
public static int readInt(byte[] source, int position) { return (source[position] & 0xFF) << 24 | (source[position + 1] & 0xFF) << 16 | (source[position + 2] & 0xFF) << 8 | (source[position + 3] & 0xFF); }
[ "public", "static", "int", "readInt", "(", "byte", "[", "]", "source", ",", "int", "position", ")", "{", "return", "(", "source", "[", "position", "]", "&", "0xFF", ")", "<<", "24", "|", "(", "source", "[", "position", "+", "1", "]", "&", "0xFF", ")", "<<", "16", "|", "(", "source", "[", "position", "+", "2", "]", "&", "0xFF", ")", "<<", "8", "|", "(", "source", "[", "position", "+", "3", "]", "&", "0xFF", ")", ";", "}" ]
Reads a 32-bit integer from the given byte array starting at the given position. @param source The byte array to read from. @param position The position in the byte array to start reading at. @return The read number.
[ "Reads", "a", "32", "-", "bit", "integer", "from", "the", "given", "byte", "array", "starting", "at", "the", "given", "position", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L123-L128
phax/ph-web
ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java
CSP2SourceList.addHash
@Nonnull public CSP2SourceList addHash (@Nonnull final EMessageDigestAlgorithm eMDAlgo, @Nonnull @Nonempty final byte [] aHashValue) { """ Add the provided nonce value. The {@value #HASH_PREFIX} and {@link #HASH_SUFFIX} are added automatically. The byte array is automatically Bas64 encoded! @param eMDAlgo The message digest algorithm used. May only {@link EMessageDigestAlgorithm#SHA_256}, {@link EMessageDigestAlgorithm#SHA_384} or {@link EMessageDigestAlgorithm#SHA_512}. May not be <code>null</code>. @param aHashValue The plain hash digest value. May not be <code>null</code>. @return this for chaining """ ValueEnforcer.notEmpty (aHashValue, "HashValue"); return addHash (eMDAlgo, Base64.safeEncodeBytes (aHashValue)); }
java
@Nonnull public CSP2SourceList addHash (@Nonnull final EMessageDigestAlgorithm eMDAlgo, @Nonnull @Nonempty final byte [] aHashValue) { ValueEnforcer.notEmpty (aHashValue, "HashValue"); return addHash (eMDAlgo, Base64.safeEncodeBytes (aHashValue)); }
[ "@", "Nonnull", "public", "CSP2SourceList", "addHash", "(", "@", "Nonnull", "final", "EMessageDigestAlgorithm", "eMDAlgo", ",", "@", "Nonnull", "@", "Nonempty", "final", "byte", "[", "]", "aHashValue", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "aHashValue", ",", "\"HashValue\"", ")", ";", "return", "addHash", "(", "eMDAlgo", ",", "Base64", ".", "safeEncodeBytes", "(", "aHashValue", ")", ")", ";", "}" ]
Add the provided nonce value. The {@value #HASH_PREFIX} and {@link #HASH_SUFFIX} are added automatically. The byte array is automatically Bas64 encoded! @param eMDAlgo The message digest algorithm used. May only {@link EMessageDigestAlgorithm#SHA_256}, {@link EMessageDigestAlgorithm#SHA_384} or {@link EMessageDigestAlgorithm#SHA_512}. May not be <code>null</code>. @param aHashValue The plain hash digest value. May not be <code>null</code>. @return this for chaining
[ "Add", "the", "provided", "nonce", "value", ".", "The", "{", "@value", "#HASH_PREFIX", "}", "and", "{", "@link", "#HASH_SUFFIX", "}", "are", "added", "automatically", ".", "The", "byte", "array", "is", "automatically", "Bas64", "encoded!" ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java#L219-L225
iwgang/CountdownView
library/src/main/java/cn/iwgang/countdownview/CountdownView.java
CountdownView.measureSize
private int measureSize(int specType, int contentSize, int measureSpec) { """ measure view Size @param specType 1 width 2 height @param contentSize all content view size @param measureSpec spec @return measureSize """ int result; int specMode = MeasureSpec.getMode(measureSpec); int specSize = MeasureSpec.getSize(measureSpec); if (specMode == MeasureSpec.EXACTLY) { result = Math.max(contentSize, specSize); } else { result = contentSize; if (specType == 1) { // width result += (getPaddingLeft() + getPaddingRight()); } else { // height result += (getPaddingTop() + getPaddingBottom()); } } return result; }
java
private int measureSize(int specType, int contentSize, int measureSpec) { int result; int specMode = MeasureSpec.getMode(measureSpec); int specSize = MeasureSpec.getSize(measureSpec); if (specMode == MeasureSpec.EXACTLY) { result = Math.max(contentSize, specSize); } else { result = contentSize; if (specType == 1) { // width result += (getPaddingLeft() + getPaddingRight()); } else { // height result += (getPaddingTop() + getPaddingBottom()); } } return result; }
[ "private", "int", "measureSize", "(", "int", "specType", ",", "int", "contentSize", ",", "int", "measureSpec", ")", "{", "int", "result", ";", "int", "specMode", "=", "MeasureSpec", ".", "getMode", "(", "measureSpec", ")", ";", "int", "specSize", "=", "MeasureSpec", ".", "getSize", "(", "measureSpec", ")", ";", "if", "(", "specMode", "==", "MeasureSpec", ".", "EXACTLY", ")", "{", "result", "=", "Math", ".", "max", "(", "contentSize", ",", "specSize", ")", ";", "}", "else", "{", "result", "=", "contentSize", ";", "if", "(", "specType", "==", "1", ")", "{", "// width", "result", "+=", "(", "getPaddingLeft", "(", ")", "+", "getPaddingRight", "(", ")", ")", ";", "}", "else", "{", "// height", "result", "+=", "(", "getPaddingTop", "(", ")", "+", "getPaddingBottom", "(", ")", ")", ";", "}", "}", "return", "result", ";", "}" ]
measure view Size @param specType 1 width 2 height @param contentSize all content view size @param measureSpec spec @return measureSize
[ "measure", "view", "Size" ]
train
https://github.com/iwgang/CountdownView/blob/3433615826b6e0a38b92e3362ba032947d9e8be7/library/src/main/java/cn/iwgang/countdownview/CountdownView.java#L66-L86
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getPKEnumerationByQuery
public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException { """ returns an Enumeration of PrimaryKey Objects for objects of class DataClass. The Elements returned come from a SELECT ... WHERE Statement that is defined by the fields and their coresponding values of listFields and listValues. Useful for EJB Finder Methods... @param primaryKeyClass the pk class for the searched objects @param query the query """ if (logger.isDebugEnabled()) logger.debug("getPKEnumerationByQuery " + query); query.setFetchSize(1); ClassDescriptor cld = getClassDescriptor(query.getSearchClass()); return new PkEnumeration(query, cld, primaryKeyClass, this); }
java
public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException { if (logger.isDebugEnabled()) logger.debug("getPKEnumerationByQuery " + query); query.setFetchSize(1); ClassDescriptor cld = getClassDescriptor(query.getSearchClass()); return new PkEnumeration(query, cld, primaryKeyClass, this); }
[ "public", "Enumeration", "getPKEnumerationByQuery", "(", "Class", "primaryKeyClass", ",", "Query", "query", ")", "throws", "PersistenceBrokerException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"getPKEnumerationByQuery \"", "+", "query", ")", ";", "query", ".", "setFetchSize", "(", "1", ")", ";", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "query", ".", "getSearchClass", "(", ")", ")", ";", "return", "new", "PkEnumeration", "(", "query", ",", "cld", ",", "primaryKeyClass", ",", "this", ")", ";", "}" ]
returns an Enumeration of PrimaryKey Objects for objects of class DataClass. The Elements returned come from a SELECT ... WHERE Statement that is defined by the fields and their coresponding values of listFields and listValues. Useful for EJB Finder Methods... @param primaryKeyClass the pk class for the searched objects @param query the query
[ "returns", "an", "Enumeration", "of", "PrimaryKey", "Objects", "for", "objects", "of", "class", "DataClass", ".", "The", "Elements", "returned", "come", "from", "a", "SELECT", "...", "WHERE", "Statement", "that", "is", "defined", "by", "the", "fields", "and", "their", "coresponding", "values", "of", "listFields", "and", "listValues", ".", "Useful", "for", "EJB", "Finder", "Methods", "..." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1830-L1837
taimos/dvalin
jaxrs-jwtauth/src/main/java/de/taimos/dvalin/jaxrs/security/jwt/JWTAuth.java
JWTAuth.signToken
public SignedJWT signToken(JWTClaimsSet claims) { """ Sign the given claims @param claims the claims to sign @return the created and signed JSON Web Token """ try { SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claims); signedJWT.sign(new MACSigner(this.jwtSharedSecret)); return signedJWT; } catch (JOSEException e) { throw new RuntimeException("Error signing JSON Web Token", e); } }
java
public SignedJWT signToken(JWTClaimsSet claims) { try { SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claims); signedJWT.sign(new MACSigner(this.jwtSharedSecret)); return signedJWT; } catch (JOSEException e) { throw new RuntimeException("Error signing JSON Web Token", e); } }
[ "public", "SignedJWT", "signToken", "(", "JWTClaimsSet", "claims", ")", "{", "try", "{", "SignedJWT", "signedJWT", "=", "new", "SignedJWT", "(", "new", "JWSHeader", "(", "JWSAlgorithm", ".", "HS256", ")", ",", "claims", ")", ";", "signedJWT", ".", "sign", "(", "new", "MACSigner", "(", "this", ".", "jwtSharedSecret", ")", ")", ";", "return", "signedJWT", ";", "}", "catch", "(", "JOSEException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error signing JSON Web Token\"", ",", "e", ")", ";", "}", "}" ]
Sign the given claims @param claims the claims to sign @return the created and signed JSON Web Token
[ "Sign", "the", "given", "claims" ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/jaxrs-jwtauth/src/main/java/de/taimos/dvalin/jaxrs/security/jwt/JWTAuth.java#L67-L75
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java
Startup.defaultStartup
static Startup defaultStartup(MessageHandler mh) { """ Factory method: The default Startup ("-default."). @param mh handler for error messages @return The default Startup, or empty startup when error (message has been printed) """ if (defaultStartup != null) { return defaultStartup; } try { String content = readResource(DEFAULT_STARTUP_NAME); return defaultStartup = new Startup( new StartupEntry(true, DEFAULT_STARTUP_NAME, content)); } catch (AccessDeniedException e) { mh.errormsg("jshell.err.file.not.accessible", "jshell", DEFAULT_STARTUP_NAME, e.getMessage()); } catch (NoSuchFileException e) { mh.errormsg("jshell.err.file.not.found", "jshell", DEFAULT_STARTUP_NAME); } catch (Exception e) { mh.errormsg("jshell.err.file.exception", "jshell", DEFAULT_STARTUP_NAME, e); } return defaultStartup = noStartup(); }
java
static Startup defaultStartup(MessageHandler mh) { if (defaultStartup != null) { return defaultStartup; } try { String content = readResource(DEFAULT_STARTUP_NAME); return defaultStartup = new Startup( new StartupEntry(true, DEFAULT_STARTUP_NAME, content)); } catch (AccessDeniedException e) { mh.errormsg("jshell.err.file.not.accessible", "jshell", DEFAULT_STARTUP_NAME, e.getMessage()); } catch (NoSuchFileException e) { mh.errormsg("jshell.err.file.not.found", "jshell", DEFAULT_STARTUP_NAME); } catch (Exception e) { mh.errormsg("jshell.err.file.exception", "jshell", DEFAULT_STARTUP_NAME, e); } return defaultStartup = noStartup(); }
[ "static", "Startup", "defaultStartup", "(", "MessageHandler", "mh", ")", "{", "if", "(", "defaultStartup", "!=", "null", ")", "{", "return", "defaultStartup", ";", "}", "try", "{", "String", "content", "=", "readResource", "(", "DEFAULT_STARTUP_NAME", ")", ";", "return", "defaultStartup", "=", "new", "Startup", "(", "new", "StartupEntry", "(", "true", ",", "DEFAULT_STARTUP_NAME", ",", "content", ")", ")", ";", "}", "catch", "(", "AccessDeniedException", "e", ")", "{", "mh", ".", "errormsg", "(", "\"jshell.err.file.not.accessible\"", ",", "\"jshell\"", ",", "DEFAULT_STARTUP_NAME", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "NoSuchFileException", "e", ")", "{", "mh", ".", "errormsg", "(", "\"jshell.err.file.not.found\"", ",", "\"jshell\"", ",", "DEFAULT_STARTUP_NAME", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "mh", ".", "errormsg", "(", "\"jshell.err.file.exception\"", ",", "\"jshell\"", ",", "DEFAULT_STARTUP_NAME", ",", "e", ")", ";", "}", "return", "defaultStartup", "=", "noStartup", "(", ")", ";", "}" ]
Factory method: The default Startup ("-default."). @param mh handler for error messages @return The default Startup, or empty startup when error (message has been printed)
[ "Factory", "method", ":", "The", "default", "Startup", "(", "-", "default", ".", ")", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java#L334-L350
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ReflectionUtil.java
ReflectionUtil.invokeNoArgMethod
public static Object invokeNoArgMethod(Object obj, String methodName) { """ Invoke the specified method (with no argument) on the object. @param obj the object to call. @param methodName the name of the method (with no argument) @return the returned object from the invocation. @throws RateLimiterException that wraps any exception during reflection """ try { return obj.getClass().getMethod(methodName).invoke(obj); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new RateLimiterReflectionException( "Failed to reflect method \"" + methodName + "\" on object: " + obj, e); } catch (InvocationTargetException e) { throw new RateLimiterException( "Failed to invoke method \"" + methodName + "\" on object: " + obj, e); } }
java
public static Object invokeNoArgMethod(Object obj, String methodName) { try { return obj.getClass().getMethod(methodName).invoke(obj); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new RateLimiterReflectionException( "Failed to reflect method \"" + methodName + "\" on object: " + obj, e); } catch (InvocationTargetException e) { throw new RateLimiterException( "Failed to invoke method \"" + methodName + "\" on object: " + obj, e); } }
[ "public", "static", "Object", "invokeNoArgMethod", "(", "Object", "obj", ",", "String", "methodName", ")", "{", "try", "{", "return", "obj", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ")", ".", "invoke", "(", "obj", ")", ";", "}", "catch", "(", "NoSuchMethodException", "|", "SecurityException", "|", "IllegalAccessException", "|", "IllegalArgumentException", "e", ")", "{", "throw", "new", "RateLimiterReflectionException", "(", "\"Failed to reflect method \\\"\"", "+", "methodName", "+", "\"\\\" on object: \"", "+", "obj", ",", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "RateLimiterException", "(", "\"Failed to invoke method \\\"\"", "+", "methodName", "+", "\"\\\" on object: \"", "+", "obj", ",", "e", ")", ";", "}", "}" ]
Invoke the specified method (with no argument) on the object. @param obj the object to call. @param methodName the name of the method (with no argument) @return the returned object from the invocation. @throws RateLimiterException that wraps any exception during reflection
[ "Invoke", "the", "specified", "method", "(", "with", "no", "argument", ")", "on", "the", "object", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ReflectionUtil.java#L54-L67
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java
Retryer.stopAfterDelay
public Retryer<R> stopAfterDelay(final long delayInMillis) { """ Sets the stop strategy which stops after a given delay milliseconds @param delayInMillis @return """ checkArgument(delayInMillis >= 0L, "delayInMillis must be >= 0 but is %d", delayInMillis); return withStopStrategy(new StopStrategy() { @Override public boolean shouldStop(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { return delaySinceFirstAttemptInMillis >= delayInMillis; } }); }
java
public Retryer<R> stopAfterDelay(final long delayInMillis) { checkArgument(delayInMillis >= 0L, "delayInMillis must be >= 0 but is %d", delayInMillis); return withStopStrategy(new StopStrategy() { @Override public boolean shouldStop(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { return delaySinceFirstAttemptInMillis >= delayInMillis; } }); }
[ "public", "Retryer", "<", "R", ">", "stopAfterDelay", "(", "final", "long", "delayInMillis", ")", "{", "checkArgument", "(", "delayInMillis", ">=", "0L", ",", "\"delayInMillis must be >= 0 but is %d\"", ",", "delayInMillis", ")", ";", "return", "withStopStrategy", "(", "new", "StopStrategy", "(", ")", "{", "@", "Override", "public", "boolean", "shouldStop", "(", "int", "previousAttemptNumber", ",", "long", "delaySinceFirstAttemptInMillis", ")", "{", "return", "delaySinceFirstAttemptInMillis", ">=", "delayInMillis", ";", "}", "}", ")", ";", "}" ]
Sets the stop strategy which stops after a given delay milliseconds @param delayInMillis @return
[ "Sets", "the", "stop", "strategy", "which", "stops", "after", "a", "given", "delay", "milliseconds" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java#L325-L333
openbase/jul
extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/ProtoBufBuilderProcessor.java
ProtoBufBuilderProcessor.addDefaultInstanceToRepeatedField
public static Message.Builder addDefaultInstanceToRepeatedField(final int repeatedFieldNumber, final Message.Builder builder) throws CouldNotPerformException { """ Method adds a new default message instance to the repeated field and return it's builder instance. @param repeatedFieldNumber The field number of the repeated field. @param builder The builder instance of the message which contains the repeated field. @return The builder instance of the new added message is returned. @throws CouldNotPerformException """ return addDefaultInstanceToRepeatedField(builder.getDescriptorForType().findFieldByNumber(repeatedFieldNumber), builder); }
java
public static Message.Builder addDefaultInstanceToRepeatedField(final int repeatedFieldNumber, final Message.Builder builder) throws CouldNotPerformException { return addDefaultInstanceToRepeatedField(builder.getDescriptorForType().findFieldByNumber(repeatedFieldNumber), builder); }
[ "public", "static", "Message", ".", "Builder", "addDefaultInstanceToRepeatedField", "(", "final", "int", "repeatedFieldNumber", ",", "final", "Message", ".", "Builder", "builder", ")", "throws", "CouldNotPerformException", "{", "return", "addDefaultInstanceToRepeatedField", "(", "builder", ".", "getDescriptorForType", "(", ")", ".", "findFieldByNumber", "(", "repeatedFieldNumber", ")", ",", "builder", ")", ";", "}" ]
Method adds a new default message instance to the repeated field and return it's builder instance. @param repeatedFieldNumber The field number of the repeated field. @param builder The builder instance of the message which contains the repeated field. @return The builder instance of the new added message is returned. @throws CouldNotPerformException
[ "Method", "adds", "a", "new", "default", "message", "instance", "to", "the", "repeated", "field", "and", "return", "it", "s", "builder", "instance", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/ProtoBufBuilderProcessor.java#L113-L115
VoltDB/voltdb
src/frontend/org/voltdb/RealVoltDB.java
RealVoltDB.setupDefaultDeployment
static String setupDefaultDeployment(VoltLogger logger, File voltdbroot) throws IOException { """ Create default deployment.xml file in voltdbroot if the deployment path is null. @return pathto default deployment file @throws IOException """ File configInfoDir = new VoltFile(voltdbroot, Constants.CONFIG_DIR); configInfoDir.mkdirs(); File depFH = new VoltFile(configInfoDir, "deployment.xml"); if (!depFH.exists()) { logger.info("Generating default deployment file \"" + depFH.getAbsolutePath() + "\""); try (BufferedWriter bw = new BufferedWriter(new FileWriter(depFH))) { for (String line : defaultDeploymentXML) { bw.write(line); bw.newLine(); } } finally { } } return depFH.getAbsolutePath(); }
java
static String setupDefaultDeployment(VoltLogger logger, File voltdbroot) throws IOException { File configInfoDir = new VoltFile(voltdbroot, Constants.CONFIG_DIR); configInfoDir.mkdirs(); File depFH = new VoltFile(configInfoDir, "deployment.xml"); if (!depFH.exists()) { logger.info("Generating default deployment file \"" + depFH.getAbsolutePath() + "\""); try (BufferedWriter bw = new BufferedWriter(new FileWriter(depFH))) { for (String line : defaultDeploymentXML) { bw.write(line); bw.newLine(); } } finally { } } return depFH.getAbsolutePath(); }
[ "static", "String", "setupDefaultDeployment", "(", "VoltLogger", "logger", ",", "File", "voltdbroot", ")", "throws", "IOException", "{", "File", "configInfoDir", "=", "new", "VoltFile", "(", "voltdbroot", ",", "Constants", ".", "CONFIG_DIR", ")", ";", "configInfoDir", ".", "mkdirs", "(", ")", ";", "File", "depFH", "=", "new", "VoltFile", "(", "configInfoDir", ",", "\"deployment.xml\"", ")", ";", "if", "(", "!", "depFH", ".", "exists", "(", ")", ")", "{", "logger", ".", "info", "(", "\"Generating default deployment file \\\"\"", "+", "depFH", ".", "getAbsolutePath", "(", ")", "+", "\"\\\"\"", ")", ";", "try", "(", "BufferedWriter", "bw", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "depFH", ")", ")", ")", "{", "for", "(", "String", "line", ":", "defaultDeploymentXML", ")", "{", "bw", ".", "write", "(", "line", ")", ";", "bw", ".", "newLine", "(", ")", ";", "}", "}", "finally", "{", "}", "}", "return", "depFH", ".", "getAbsolutePath", "(", ")", ";", "}" ]
Create default deployment.xml file in voltdbroot if the deployment path is null. @return pathto default deployment file @throws IOException
[ "Create", "default", "deployment", ".", "xml", "file", "in", "voltdbroot", "if", "the", "deployment", "path", "is", "null", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/RealVoltDB.java#L4818-L4836
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java
PathFileObject.forSimplePath
static PathFileObject forSimplePath(BaseFileManager fileManager, Path path, Path userPath) { """ Create a PathFileObject for a file whose binary name must be inferred from its position on a search path. The binary name is inferred by finding an enclosing directory in the sequence of paths associated with the location given to {@link JavaFileManager#inferBinaryName). The name is derived from {@code userPath}. @param fileManager the file manager creating this file object @param path the path referred to by this file object @param userPath the "user-friendly" name for this path. """ return new SimpleFileObject(fileManager, path, userPath); }
java
static PathFileObject forSimplePath(BaseFileManager fileManager, Path path, Path userPath) { return new SimpleFileObject(fileManager, path, userPath); }
[ "static", "PathFileObject", "forSimplePath", "(", "BaseFileManager", "fileManager", ",", "Path", "path", ",", "Path", "userPath", ")", "{", "return", "new", "SimpleFileObject", "(", "fileManager", ",", "path", ",", "userPath", ")", ";", "}" ]
Create a PathFileObject for a file whose binary name must be inferred from its position on a search path. The binary name is inferred by finding an enclosing directory in the sequence of paths associated with the location given to {@link JavaFileManager#inferBinaryName). The name is derived from {@code userPath}. @param fileManager the file manager creating this file object @param path the path referred to by this file object @param userPath the "user-friendly" name for this path.
[ "Create", "a", "PathFileObject", "for", "a", "file", "whose", "binary", "name", "must", "be", "inferred", "from", "its", "position", "on", "a", "search", "path", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java#L274-L277
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesValue
public static void escapePropertiesValue(final Reader reader, final Writer writer) throws IOException { """ <p> Perform a Java Properties Value level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The Java Properties basic escape set: <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using the Single Escape Chars whenever possible. For escaped characters that do not have an associated SEC, default to <tt>&#92;uFFFF</tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapePropertiesValue(Reader, Writer, PropertiesValueEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link PropertiesValueEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ escapePropertiesValue(reader, writer, PropertiesValueEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
java
public static void escapePropertiesValue(final Reader reader, final Writer writer) throws IOException { escapePropertiesValue(reader, writer, PropertiesValueEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapePropertiesValue", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapePropertiesValue", "(", "reader", ",", "writer", ",", "PropertiesValueEscapeLevel", ".", "LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET", ")", ";", "}" ]
<p> Perform a Java Properties Value level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The Java Properties basic escape set: <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using the Single Escape Chars whenever possible. For escaped characters that do not have an associated SEC, default to <tt>&#92;uFFFF</tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapePropertiesValue(Reader, Writer, PropertiesValueEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link PropertiesValueEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "Java", "Properties", "Value", "level", "2", "(", "basic", "set", "and", "all", "non", "-", "ASCII", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "2<", "/", "em", ">", "means", "this", "method", "will", "escape", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "The", "Java", "Properties", "basic", "escape", "set", ":", "<ul", ">", "<li", ">", "The", "<em", ">", "Single", "Escape", "Characters<", "/", "em", ">", ":", "<tt", ">", "&#92", ";", "t<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "0009<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "n<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000A<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "f<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000C<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "r<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000D<", "/", "tt", ">", ")", "and", "<tt", ">", "&#92", ";", "&#92", ";", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "005C<", "/", "tt", ">", ")", ".", "<", "/", "li", ">", "<li", ">", "Two", "ranges", "of", "non", "-", "displayable", "control", "characters", "(", "some", "of", "which", "are", "already", "part", "of", "the", "<em", ">", "single", "escape", "characters<", "/", "em", ">", "list", ")", ":", "<tt", ">", "U", "+", "0000<", "/", "tt", ">", "to", "<tt", ">", "U", "+", "001F<", "/", "tt", ">", "and", "<tt", ">", "U", "+", "007F<", "/", "tt", ">", "to", "<tt", ">", "U", "+", "009F<", "/", "tt", ">", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<", "/", "li", ">", "<li", ">", "All", "non", "ASCII", "characters", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "escape", "will", "be", "performed", "by", "using", "the", "Single", "Escape", "Chars", "whenever", "possible", ".", "For", "escaped", "characters", "that", "do", "not", "have", "an", "associated", "SEC", "default", "to", "<tt", ">", "&#92", ";", "uFFFF<", "/", "tt", ">", "Hexadecimal", "Escapes", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapePropertiesValue", "(", "Reader", "Writer", "PropertiesValueEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "PropertiesValueEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L540-L543
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.duplicateDataMember
public static MapPro duplicateDataMember(ComponentImpl c, MapPro map, MapPro newMap, boolean deepCopy) { """ duplicate the datamember in the map, ignores the udfs @param c @param map @param newMap @param deepCopy @return """ Iterator it = map.entrySet().iterator(); Map.Entry entry; Object value; while (it.hasNext()) { entry = (Entry) it.next(); value = entry.getValue(); if (!(value instanceof UDF)) { if (deepCopy) value = Duplicator.duplicate(value, deepCopy); newMap.put(entry.getKey(), value); } } return newMap; }
java
public static MapPro duplicateDataMember(ComponentImpl c, MapPro map, MapPro newMap, boolean deepCopy) { Iterator it = map.entrySet().iterator(); Map.Entry entry; Object value; while (it.hasNext()) { entry = (Entry) it.next(); value = entry.getValue(); if (!(value instanceof UDF)) { if (deepCopy) value = Duplicator.duplicate(value, deepCopy); newMap.put(entry.getKey(), value); } } return newMap; }
[ "public", "static", "MapPro", "duplicateDataMember", "(", "ComponentImpl", "c", ",", "MapPro", "map", ",", "MapPro", "newMap", ",", "boolean", "deepCopy", ")", "{", "Iterator", "it", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "Map", ".", "Entry", "entry", ";", "Object", "value", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "entry", "=", "(", "Entry", ")", "it", ".", "next", "(", ")", ";", "value", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "!", "(", "value", "instanceof", "UDF", ")", ")", "{", "if", "(", "deepCopy", ")", "value", "=", "Duplicator", ".", "duplicate", "(", "value", ",", "deepCopy", ")", ";", "newMap", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "value", ")", ";", "}", "}", "return", "newMap", ";", "}" ]
duplicate the datamember in the map, ignores the udfs @param c @param map @param newMap @param deepCopy @return
[ "duplicate", "the", "datamember", "in", "the", "map", "ignores", "the", "udfs" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L326-L340
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java
EJSContainer.getCurrentSessionalUOW
public ContainerAS getCurrentSessionalUOW(boolean checkMarkedReset) throws CSIException, CSITransactionRolledbackException { """ Added checMarkedRest parameter. d348420 """ ContainerAS result = null; Object currASKey = uowCtrl.getCurrentSessionalUOW(checkMarkedReset); //--------------------------------------------------------- // No activity session available in after_completion callbacks. // Okay to return null in this case. //--------------------------------------------------------- if (currASKey == null) { return null; } result = containerASMap.get(currASKey); if (result == null) { result = new ContainerAS(this, currASKey); uowCtrl.enlistWithSession(result); containerASMap.put(currASKey, result); } return result; }
java
public ContainerAS getCurrentSessionalUOW(boolean checkMarkedReset) throws CSIException, CSITransactionRolledbackException { ContainerAS result = null; Object currASKey = uowCtrl.getCurrentSessionalUOW(checkMarkedReset); //--------------------------------------------------------- // No activity session available in after_completion callbacks. // Okay to return null in this case. //--------------------------------------------------------- if (currASKey == null) { return null; } result = containerASMap.get(currASKey); if (result == null) { result = new ContainerAS(this, currASKey); uowCtrl.enlistWithSession(result); containerASMap.put(currASKey, result); } return result; }
[ "public", "ContainerAS", "getCurrentSessionalUOW", "(", "boolean", "checkMarkedReset", ")", "throws", "CSIException", ",", "CSITransactionRolledbackException", "{", "ContainerAS", "result", "=", "null", ";", "Object", "currASKey", "=", "uowCtrl", ".", "getCurrentSessionalUOW", "(", "checkMarkedReset", ")", ";", "//---------------------------------------------------------", "// No activity session available in after_completion callbacks.", "// Okay to return null in this case.", "//---------------------------------------------------------", "if", "(", "currASKey", "==", "null", ")", "{", "return", "null", ";", "}", "result", "=", "containerASMap", ".", "get", "(", "currASKey", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "new", "ContainerAS", "(", "this", ",", "currASKey", ")", ";", "uowCtrl", ".", "enlistWithSession", "(", "result", ")", ";", "containerASMap", ".", "put", "(", "currASKey", ",", "result", ")", ";", "}", "return", "result", ";", "}" ]
Added checMarkedRest parameter. d348420
[ "Added", "checMarkedRest", "parameter", ".", "d348420" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L1343-L1364
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/StatementManager.java
StatementManager.bindStatement
private int bindStatement(PreparedStatement stmt, int index, InCriteria crit, ClassDescriptor cld) throws SQLException { """ bind InCriteria @param stmt the PreparedStatement @param index the position of the parameter to bind @param crit the Criteria containing the parameter @param cld the ClassDescriptor @return next index for PreparedStatement """ if (crit.getValue() instanceof Collection) { Collection values = (Collection) crit.getValue(); Iterator iter = values.iterator(); while (iter.hasNext()) { index = bindStatementValue(stmt, index, crit.getAttribute(), iter.next(), cld); } } else { index = bindStatementValue(stmt, index, crit.getAttribute(), crit.getValue(), cld); } return index; }
java
private int bindStatement(PreparedStatement stmt, int index, InCriteria crit, ClassDescriptor cld) throws SQLException { if (crit.getValue() instanceof Collection) { Collection values = (Collection) crit.getValue(); Iterator iter = values.iterator(); while (iter.hasNext()) { index = bindStatementValue(stmt, index, crit.getAttribute(), iter.next(), cld); } } else { index = bindStatementValue(stmt, index, crit.getAttribute(), crit.getValue(), cld); } return index; }
[ "private", "int", "bindStatement", "(", "PreparedStatement", "stmt", ",", "int", "index", ",", "InCriteria", "crit", ",", "ClassDescriptor", "cld", ")", "throws", "SQLException", "{", "if", "(", "crit", ".", "getValue", "(", ")", "instanceof", "Collection", ")", "{", "Collection", "values", "=", "(", "Collection", ")", "crit", ".", "getValue", "(", ")", ";", "Iterator", "iter", "=", "values", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "index", "=", "bindStatementValue", "(", "stmt", ",", "index", ",", "crit", ".", "getAttribute", "(", ")", ",", "iter", ".", "next", "(", ")", ",", "cld", ")", ";", "}", "}", "else", "{", "index", "=", "bindStatementValue", "(", "stmt", ",", "index", ",", "crit", ".", "getAttribute", "(", ")", ",", "crit", ".", "getValue", "(", ")", ",", "cld", ")", ";", "}", "return", "index", ";", "}" ]
bind InCriteria @param stmt the PreparedStatement @param index the position of the parameter to bind @param crit the Criteria containing the parameter @param cld the ClassDescriptor @return next index for PreparedStatement
[ "bind", "InCriteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L310-L327
aalmiray/Json-lib
src/main/java/net/sf/json/JSONArray.java
JSONArray.toList
public static List toList( JSONArray jsonArray, Class objectClass, Map classMap ) { """ Creates a List from a JSONArray.<br> Any attribute is a JSONObject and matches a key in the classMap, it will be converted to that target class.<br> The classMap has the following conventions: <ul> <li>Every key must be an String.</li> <li>Every value must be a Class.</li> <li>A key may be a regular expression.</li> </ul> @deprecated replaced by toCollection @see #toCollection(JSONArray,Class,Map) """ JsonConfig jsonConfig = new JsonConfig(); jsonConfig.setRootClass( objectClass ); jsonConfig.setClassMap( classMap ); return toList( jsonArray, jsonConfig ); }
java
public static List toList( JSONArray jsonArray, Class objectClass, Map classMap ) { JsonConfig jsonConfig = new JsonConfig(); jsonConfig.setRootClass( objectClass ); jsonConfig.setClassMap( classMap ); return toList( jsonArray, jsonConfig ); }
[ "public", "static", "List", "toList", "(", "JSONArray", "jsonArray", ",", "Class", "objectClass", ",", "Map", "classMap", ")", "{", "JsonConfig", "jsonConfig", "=", "new", "JsonConfig", "(", ")", ";", "jsonConfig", ".", "setRootClass", "(", "objectClass", ")", ";", "jsonConfig", ".", "setClassMap", "(", "classMap", ")", ";", "return", "toList", "(", "jsonArray", ",", "jsonConfig", ")", ";", "}" ]
Creates a List from a JSONArray.<br> Any attribute is a JSONObject and matches a key in the classMap, it will be converted to that target class.<br> The classMap has the following conventions: <ul> <li>Every key must be an String.</li> <li>Every value must be a Class.</li> <li>A key may be a regular expression.</li> </ul> @deprecated replaced by toCollection @see #toCollection(JSONArray,Class,Map)
[ "Creates", "a", "List", "from", "a", "JSONArray", ".", "<br", ">", "Any", "attribute", "is", "a", "JSONObject", "and", "matches", "a", "key", "in", "the", "classMap", "it", "will", "be", "converted", "to", "that", "target", "class", ".", "<br", ">", "The", "classMap", "has", "the", "following", "conventions", ":", "<ul", ">", "<li", ">", "Every", "key", "must", "be", "an", "String", ".", "<", "/", "li", ">", "<li", ">", "Every", "value", "must", "be", "a", "Class", ".", "<", "/", "li", ">", "<li", ">", "A", "key", "may", "be", "a", "regular", "expression", ".", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONArray.java#L441-L446
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.pressImage
public Img pressImage(Image pressImg, Rectangle rectangle, float alpha) { """ 给图片添加图片水印 @param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件 @param rectangle 矩形对象,表示矩形区域的x,y,width,height,x,y从背景图片中心计算 @param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 @return this @since 4.1.14 """ final BufferedImage targetImg = getValidSrcImg(); rectangle = fixRectangle(rectangle, targetImg.getWidth(), targetImg.getHeight()); draw(targetImg, pressImg, rectangle, alpha); this.targetImage = targetImg; return this; }
java
public Img pressImage(Image pressImg, Rectangle rectangle, float alpha) { final BufferedImage targetImg = getValidSrcImg(); rectangle = fixRectangle(rectangle, targetImg.getWidth(), targetImg.getHeight()); draw(targetImg, pressImg, rectangle, alpha); this.targetImage = targetImg; return this; }
[ "public", "Img", "pressImage", "(", "Image", "pressImg", ",", "Rectangle", "rectangle", ",", "float", "alpha", ")", "{", "final", "BufferedImage", "targetImg", "=", "getValidSrcImg", "(", ")", ";", "rectangle", "=", "fixRectangle", "(", "rectangle", ",", "targetImg", ".", "getWidth", "(", ")", ",", "targetImg", ".", "getHeight", "(", ")", ")", ";", "draw", "(", "targetImg", ",", "pressImg", ",", "rectangle", ",", "alpha", ")", ";", "this", ".", "targetImage", "=", "targetImg", ";", "return", "this", ";", "}" ]
给图片添加图片水印 @param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件 @param rectangle 矩形对象,表示矩形区域的x,y,width,height,x,y从背景图片中心计算 @param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 @return this @since 4.1.14
[ "给图片添加图片水印" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L449-L456
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.setResult
public void setResult(Result result) throws IllegalArgumentException { """ Enables the user of the TransformerHandler to set the to set the Result for the transformation. @param result A Result instance, should not be null. @throws IllegalArgumentException if result is invalid for some reason. """ if(null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"Result should not be null"); m_result = result; }
java
public void setResult(Result result) throws IllegalArgumentException { if(null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"Result should not be null"); m_result = result; }
[ "public", "void", "setResult", "(", "Result", "result", ")", "throws", "IllegalArgumentException", "{", "if", "(", "null", "==", "result", ")", "throw", "new", "IllegalArgumentException", "(", "XSLMessages", ".", "createMessage", "(", "XSLTErrorResources", ".", "ER_RESULT_NULL", ",", "null", ")", ")", ";", "//\"Result should not be null\"); ", "m_result", "=", "result", ";", "}" ]
Enables the user of the TransformerHandler to set the to set the Result for the transformation. @param result A Result instance, should not be null. @throws IllegalArgumentException if result is invalid for some reason.
[ "Enables", "the", "user", "of", "the", "TransformerHandler", "to", "set", "the", "to", "set", "the", "Result", "for", "the", "transformation", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L109-L114
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.div
public static BigDecimal div(Number v1, Number v2, int scale, RoundingMode roundingMode) { """ 提供(相对)精确的除法运算,当发生除不尽的情况时,由scale指定精确度 @param v1 被除数 @param v2 除数 @param scale 精确度,如果为负值,取绝对值 @param roundingMode 保留小数的模式 {@link RoundingMode} @return 两个参数的商 @since 3.1.0 """ return div(v1.toString(), v2.toString(), scale, roundingMode); }
java
public static BigDecimal div(Number v1, Number v2, int scale, RoundingMode roundingMode) { return div(v1.toString(), v2.toString(), scale, roundingMode); }
[ "public", "static", "BigDecimal", "div", "(", "Number", "v1", ",", "Number", "v2", ",", "int", "scale", ",", "RoundingMode", "roundingMode", ")", "{", "return", "div", "(", "v1", ".", "toString", "(", ")", ",", "v2", ".", "toString", "(", ")", ",", "scale", ",", "roundingMode", ")", ";", "}" ]
提供(相对)精确的除法运算,当发生除不尽的情况时,由scale指定精确度 @param v1 被除数 @param v2 除数 @param scale 精确度,如果为负值,取绝对值 @param roundingMode 保留小数的模式 {@link RoundingMode} @return 两个参数的商 @since 3.1.0
[ "提供", "(", "相对", ")", "精确的除法运算", "当发生除不尽的情况时", "由scale指定精确度" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L714-L716
openbase/jul
exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java
ExceptionPrinter.printHistoryAndExit
public static <T extends Throwable> void printHistoryAndExit(final String message, final T th, final PrintStream stream) { """ Print Exception messages without stack trace in non debug mode and call system exit afterwards. Method prints recursive all messages of the given exception stack to get a history overview of the causes. In verbose mode (app -v) the stacktrace is printed in the end of history. The given message and the exception are bundled as new CouldNotPerformException and further processed. After printing the system exit routine with error code 255 is triggered. @param <T> Exception type @param message the reason why this exception occurs. @param th the exception cause. @param stream the stream used for printing the message history e.g. System.out or. System.err """ printHistory(new CouldNotPerformException(message, th), new SystemPrinter(stream)); if (JPService.testMode()) { assert false; return; } exit(255); }
java
public static <T extends Throwable> void printHistoryAndExit(final String message, final T th, final PrintStream stream) { printHistory(new CouldNotPerformException(message, th), new SystemPrinter(stream)); if (JPService.testMode()) { assert false; return; } exit(255); }
[ "public", "static", "<", "T", "extends", "Throwable", ">", "void", "printHistoryAndExit", "(", "final", "String", "message", ",", "final", "T", "th", ",", "final", "PrintStream", "stream", ")", "{", "printHistory", "(", "new", "CouldNotPerformException", "(", "message", ",", "th", ")", ",", "new", "SystemPrinter", "(", "stream", ")", ")", ";", "if", "(", "JPService", ".", "testMode", "(", ")", ")", "{", "assert", "false", ";", "return", ";", "}", "exit", "(", "255", ")", ";", "}" ]
Print Exception messages without stack trace in non debug mode and call system exit afterwards. Method prints recursive all messages of the given exception stack to get a history overview of the causes. In verbose mode (app -v) the stacktrace is printed in the end of history. The given message and the exception are bundled as new CouldNotPerformException and further processed. After printing the system exit routine with error code 255 is triggered. @param <T> Exception type @param message the reason why this exception occurs. @param th the exception cause. @param stream the stream used for printing the message history e.g. System.out or. System.err
[ "Print", "Exception", "messages", "without", "stack", "trace", "in", "non", "debug", "mode", "and", "call", "system", "exit", "afterwards", ".", "Method", "prints", "recursive", "all", "messages", "of", "the", "given", "exception", "stack", "to", "get", "a", "history", "overview", "of", "the", "causes", ".", "In", "verbose", "mode", "(", "app", "-", "v", ")", "the", "stacktrace", "is", "printed", "in", "the", "end", "of", "history", ".", "The", "given", "message", "and", "the", "exception", "are", "bundled", "as", "new", "CouldNotPerformException", "and", "further", "processed", ".", "After", "printing", "the", "system", "exit", "routine", "with", "error", "code", "255", "is", "triggered", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java#L251-L258
apache/groovy
src/main/java/org/codehaus/groovy/ast/ClassNode.java
ClassNode.makeArray
public ClassNode makeArray() { """ Returns a ClassNode representing an array of the class represented by this ClassNode """ if (redirect!=null) { ClassNode res = redirect().makeArray(); res.componentType = this; return res; } ClassNode cn; if (clazz!=null) { Class ret = Array.newInstance(clazz,0).getClass(); // don't use the ClassHelper here! cn = new ClassNode(ret,this); } else { cn = new ClassNode(this); } return cn; }
java
public ClassNode makeArray() { if (redirect!=null) { ClassNode res = redirect().makeArray(); res.componentType = this; return res; } ClassNode cn; if (clazz!=null) { Class ret = Array.newInstance(clazz,0).getClass(); // don't use the ClassHelper here! cn = new ClassNode(ret,this); } else { cn = new ClassNode(this); } return cn; }
[ "public", "ClassNode", "makeArray", "(", ")", "{", "if", "(", "redirect", "!=", "null", ")", "{", "ClassNode", "res", "=", "redirect", "(", ")", ".", "makeArray", "(", ")", ";", "res", ".", "componentType", "=", "this", ";", "return", "res", ";", "}", "ClassNode", "cn", ";", "if", "(", "clazz", "!=", "null", ")", "{", "Class", "ret", "=", "Array", ".", "newInstance", "(", "clazz", ",", "0", ")", ".", "getClass", "(", ")", ";", "// don't use the ClassHelper here!", "cn", "=", "new", "ClassNode", "(", "ret", ",", "this", ")", ";", "}", "else", "{", "cn", "=", "new", "ClassNode", "(", "this", ")", ";", "}", "return", "cn", ";", "}" ]
Returns a ClassNode representing an array of the class represented by this ClassNode
[ "Returns", "a", "ClassNode", "representing", "an", "array", "of", "the", "class", "represented", "by", "this", "ClassNode" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/ClassNode.java#L214-L229
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.postEdit
public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException { """ Save edits for a given post @param blogName The blog name of the post @param id the Post id @param detail The detail to save @throws IOException if any file specified in detail cannot be read """ Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail); sdetail.put("id", id); requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail); }
java
public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException { Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail); sdetail.put("id", id); requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail); }
[ "public", "void", "postEdit", "(", "String", "blogName", ",", "Long", "id", ",", "Map", "<", "String", ",", "?", ">", "detail", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Object", ">", "sdetail", "=", "JumblrClient", ".", "safeOptionMap", "(", "detail", ")", ";", "sdetail", ".", "put", "(", "\"id\"", ",", "id", ")", ";", "requestBuilder", ".", "postMultipart", "(", "JumblrClient", ".", "blogPath", "(", "blogName", ",", "\"/post/edit\"", ")", ",", "sdetail", ")", ";", "}" ]
Save edits for a given post @param blogName The blog name of the post @param id the Post id @param detail The detail to save @throws IOException if any file specified in detail cannot be read
[ "Save", "edits", "for", "a", "given", "post" ]
train
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L371-L375
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java
AuditorFactory.getAuditor
public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, boolean useGlobalContext) { """ Get an auditor instance for the specified auditor class name, module configuration. Auditor will use a standalone context if a non-global context is requested @param className Class name of the auditor class to instantiate @param config Auditor configuration to use @param useGlobalContext Whether to use the global (true) or standalone (false) context @return Instance of an IHE Auditor """ Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className); return getAuditor(clazz, config, useGlobalContext); }
java
public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, boolean useGlobalContext) { Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className); return getAuditor(clazz, config, useGlobalContext); }
[ "public", "static", "IHEAuditor", "getAuditor", "(", "String", "className", ",", "AuditorModuleConfig", "config", ",", "boolean", "useGlobalContext", ")", "{", "Class", "<", "?", "extends", "IHEAuditor", ">", "clazz", "=", "AuditorFactory", ".", "getAuditorClassForClassName", "(", "className", ")", ";", "return", "getAuditor", "(", "clazz", ",", "config", ",", "useGlobalContext", ")", ";", "}" ]
Get an auditor instance for the specified auditor class name, module configuration. Auditor will use a standalone context if a non-global context is requested @param className Class name of the auditor class to instantiate @param config Auditor configuration to use @param useGlobalContext Whether to use the global (true) or standalone (false) context @return Instance of an IHE Auditor
[ "Get", "an", "auditor", "instance", "for", "the", "specified", "auditor", "class", "name", "module", "configuration", ".", "Auditor", "will", "use", "a", "standalone", "context", "if", "a", "non", "-", "global", "context", "is", "requested" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L121-L125
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java
DrawerUIUtils.getBooleanStyleable
public static boolean getBooleanStyleable(Context ctx, @StyleableRes int styleable, boolean def) { """ Get the boolean value of a given styleable. @param ctx @param styleable @param def @return """ TypedArray ta = ctx.getTheme().obtainStyledAttributes(R.styleable.MaterialDrawer); return ta.getBoolean(styleable, def); }
java
public static boolean getBooleanStyleable(Context ctx, @StyleableRes int styleable, boolean def) { TypedArray ta = ctx.getTheme().obtainStyledAttributes(R.styleable.MaterialDrawer); return ta.getBoolean(styleable, def); }
[ "public", "static", "boolean", "getBooleanStyleable", "(", "Context", "ctx", ",", "@", "StyleableRes", "int", "styleable", ",", "boolean", "def", ")", "{", "TypedArray", "ta", "=", "ctx", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "R", ".", "styleable", ".", "MaterialDrawer", ")", ";", "return", "ta", ".", "getBoolean", "(", "styleable", ",", "def", ")", ";", "}" ]
Get the boolean value of a given styleable. @param ctx @param styleable @param def @return
[ "Get", "the", "boolean", "value", "of", "a", "given", "styleable", "." ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java#L42-L45
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/util/RenderUtils.java
RenderUtils.renderClassLine
public static String renderClassLine(final Class<?> type, final List<String> markers) { """ Renders class as: class-simple-name (class-package) *markers. For anonymous class simple name will be Class$1. @param type class @param markers markers @return rendered class line """ return String.format("%-28s %-26s %s", getClassName(type), brackets(renderPackage(type)), markers(markers)); }
java
public static String renderClassLine(final Class<?> type, final List<String> markers) { return String.format("%-28s %-26s %s", getClassName(type), brackets(renderPackage(type)), markers(markers)); }
[ "public", "static", "String", "renderClassLine", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "List", "<", "String", ">", "markers", ")", "{", "return", "String", ".", "format", "(", "\"%-28s %-26s %s\"", ",", "getClassName", "(", "type", ")", ",", "brackets", "(", "renderPackage", "(", "type", ")", ")", ",", "markers", "(", "markers", ")", ")", ";", "}" ]
Renders class as: class-simple-name (class-package) *markers. For anonymous class simple name will be Class$1. @param type class @param markers markers @return rendered class line
[ "Renders", "class", "as", ":", "class", "-", "simple", "-", "name", "(", "class", "-", "package", ")", "*", "markers", ".", "For", "anonymous", "class", "simple", "name", "will", "be", "Class$1", "." ]
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/util/RenderUtils.java#L62-L64
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java
MainScene.removeChildObjectFromCamera
public void removeChildObjectFromCamera(final Widget child, int camera) { """ Removes a scene object from one or both of the left and right cameras. @param child The {@link Widget} to remove. @param camera {@link #LEFT_CAMERA} or {@link #RIGHT_CAMERA}; these can be or'd together to remove {@code child} from both cameras. """ switch (camera) { case LEFT_CAMERA: mLeftCameraRootWidget.removeChild(child); break; case RIGHT_CAMERA: mRightCameraRootWidget.removeChild(child); break; default: mMainCameraRootWidget.removeChild(child); break; } }
java
public void removeChildObjectFromCamera(final Widget child, int camera) { switch (camera) { case LEFT_CAMERA: mLeftCameraRootWidget.removeChild(child); break; case RIGHT_CAMERA: mRightCameraRootWidget.removeChild(child); break; default: mMainCameraRootWidget.removeChild(child); break; } }
[ "public", "void", "removeChildObjectFromCamera", "(", "final", "Widget", "child", ",", "int", "camera", ")", "{", "switch", "(", "camera", ")", "{", "case", "LEFT_CAMERA", ":", "mLeftCameraRootWidget", ".", "removeChild", "(", "child", ")", ";", "break", ";", "case", "RIGHT_CAMERA", ":", "mRightCameraRootWidget", ".", "removeChild", "(", "child", ")", ";", "break", ";", "default", ":", "mMainCameraRootWidget", ".", "removeChild", "(", "child", ")", ";", "break", ";", "}", "}" ]
Removes a scene object from one or both of the left and right cameras. @param child The {@link Widget} to remove. @param camera {@link #LEFT_CAMERA} or {@link #RIGHT_CAMERA}; these can be or'd together to remove {@code child} from both cameras.
[ "Removes", "a", "scene", "object", "from", "one", "or", "both", "of", "the", "left", "and", "right", "cameras", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java#L408-L420
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java
ConverterRegistry.putCustom
public ConverterRegistry putCustom(Type type, Converter<?> converter) { """ 登记自定义转换器 @param type 转换的目标类型 @param converter 转换器 @return {@link ConverterRegistry} """ if (null == customConverterMap) { synchronized (this) { if (null == customConverterMap) { customConverterMap = new ConcurrentHashMap<>(); } } } customConverterMap.put(type, converter); return this; }
java
public ConverterRegistry putCustom(Type type, Converter<?> converter) { if (null == customConverterMap) { synchronized (this) { if (null == customConverterMap) { customConverterMap = new ConcurrentHashMap<>(); } } } customConverterMap.put(type, converter); return this; }
[ "public", "ConverterRegistry", "putCustom", "(", "Type", "type", ",", "Converter", "<", "?", ">", "converter", ")", "{", "if", "(", "null", "==", "customConverterMap", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "null", "==", "customConverterMap", ")", "{", "customConverterMap", "=", "new", "ConcurrentHashMap", "<>", "(", ")", ";", "}", "}", "}", "customConverterMap", ".", "put", "(", "type", ",", "converter", ")", ";", "return", "this", ";", "}" ]
登记自定义转换器 @param type 转换的目标类型 @param converter 转换器 @return {@link ConverterRegistry}
[ "登记自定义转换器" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java#L114-L124
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java
InMemoryLockMapImpl.removeReader
public void removeReader(TransactionImpl tx, Object obj) { """ remove a reader lock entry for transaction tx on object obj from the persistent storage. """ checkTimedOutLocks(); Identity oid = new Identity(obj, getBroker()); String oidString = oid.toString(); String txGuid = tx.getGUID(); removeReaderInternal(oidString, txGuid); }
java
public void removeReader(TransactionImpl tx, Object obj) { checkTimedOutLocks(); Identity oid = new Identity(obj, getBroker()); String oidString = oid.toString(); String txGuid = tx.getGUID(); removeReaderInternal(oidString, txGuid); }
[ "public", "void", "removeReader", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "checkTimedOutLocks", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "getBroker", "(", ")", ")", ";", "String", "oidString", "=", "oid", ".", "toString", "(", ")", ";", "String", "txGuid", "=", "tx", ".", "getGUID", "(", ")", ";", "removeReaderInternal", "(", "oidString", ",", "txGuid", ")", ";", "}" ]
remove a reader lock entry for transaction tx on object obj from the persistent storage.
[ "remove", "a", "reader", "lock", "entry", "for", "transaction", "tx", "on", "object", "obj", "from", "the", "persistent", "storage", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java#L171-L179
phax/ph-commons
ph-tree/src/main/java/com/helger/tree/util/TreeWithIDBuilder.java
TreeWithIDBuilder.buildTree
@Nonnull public static <KEYTYPE, DATATYPE extends IHasParent <DATATYPE> & IHasID <KEYTYPE>> DefaultTreeWithID <KEYTYPE, DATATYPE> buildTree (@Nonnull final Collection <? extends DATATYPE> aAll) { """ A generic method to build a tree of objects. @param <KEYTYPE> The tree key type. @param <DATATYPE> The tree item value type. @param aAll A linear list of objects to build the tree from. May not be <code>null</code>. @return A tree with all the objects. Never <code>null</code>. @throws IllegalStateException if the hierarchy cannot be determined because an object references a parent that is not in the list! """ ValueEnforcer.notNull (aAll, "All"); return buildTree (aAll, IParentProvider.parentProviderHasParent ()); }
java
@Nonnull public static <KEYTYPE, DATATYPE extends IHasParent <DATATYPE> & IHasID <KEYTYPE>> DefaultTreeWithID <KEYTYPE, DATATYPE> buildTree (@Nonnull final Collection <? extends DATATYPE> aAll) { ValueEnforcer.notNull (aAll, "All"); return buildTree (aAll, IParentProvider.parentProviderHasParent ()); }
[ "@", "Nonnull", "public", "static", "<", "KEYTYPE", ",", "DATATYPE", "extends", "IHasParent", "<", "DATATYPE", ">", "&", "IHasID", "<", "KEYTYPE", ">", ">", "DefaultTreeWithID", "<", "KEYTYPE", ",", "DATATYPE", ">", "buildTree", "(", "@", "Nonnull", "final", "Collection", "<", "?", "extends", "DATATYPE", ">", "aAll", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aAll", ",", "\"All\"", ")", ";", "return", "buildTree", "(", "aAll", ",", "IParentProvider", ".", "parentProviderHasParent", "(", ")", ")", ";", "}" ]
A generic method to build a tree of objects. @param <KEYTYPE> The tree key type. @param <DATATYPE> The tree item value type. @param aAll A linear list of objects to build the tree from. May not be <code>null</code>. @return A tree with all the objects. Never <code>null</code>. @throws IllegalStateException if the hierarchy cannot be determined because an object references a parent that is not in the list!
[ "A", "generic", "method", "to", "build", "a", "tree", "of", "objects", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/util/TreeWithIDBuilder.java#L170-L176
tango-controls/JTango
server/src/main/java/org/tango/server/device/DeviceManager.java
DeviceManager.pushDataReadyEvent
public void pushDataReadyEvent(final String attributeName, final int counter) throws DevFailed { """ Push a DATA_READY event if some client had registered it @param attributeName The attribute name @param counter @throws DevFailed """ EventManager.getInstance().pushAttributeDataReadyEvent(name, attributeName, counter); }
java
public void pushDataReadyEvent(final String attributeName, final int counter) throws DevFailed { EventManager.getInstance().pushAttributeDataReadyEvent(name, attributeName, counter); }
[ "public", "void", "pushDataReadyEvent", "(", "final", "String", "attributeName", ",", "final", "int", "counter", ")", "throws", "DevFailed", "{", "EventManager", ".", "getInstance", "(", ")", ".", "pushAttributeDataReadyEvent", "(", "name", ",", "attributeName", ",", "counter", ")", ";", "}" ]
Push a DATA_READY event if some client had registered it @param attributeName The attribute name @param counter @throws DevFailed
[ "Push", "a", "DATA_READY", "event", "if", "some", "client", "had", "registered", "it" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L296-L298
apereo/cas
core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java
AbstractCentralAuthenticationService.getAuthenticationSatisfiedByPolicy
protected Authentication getAuthenticationSatisfiedByPolicy(final Authentication authentication, final ServiceContext context) throws AbstractTicketException { """ Gets the authentication satisfied by policy. @param authentication the authentication @param context the context @return the authentication satisfied by policy @throws AbstractTicketException the ticket exception """ val policy = this.serviceContextAuthenticationPolicyFactory.createPolicy(context); try { if (policy.isSatisfiedBy(authentication)) { return authentication; } } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } throw new UnsatisfiedAuthenticationPolicyException(policy); }
java
protected Authentication getAuthenticationSatisfiedByPolicy(final Authentication authentication, final ServiceContext context) throws AbstractTicketException { val policy = this.serviceContextAuthenticationPolicyFactory.createPolicy(context); try { if (policy.isSatisfiedBy(authentication)) { return authentication; } } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } throw new UnsatisfiedAuthenticationPolicyException(policy); }
[ "protected", "Authentication", "getAuthenticationSatisfiedByPolicy", "(", "final", "Authentication", "authentication", ",", "final", "ServiceContext", "context", ")", "throws", "AbstractTicketException", "{", "val", "policy", "=", "this", ".", "serviceContextAuthenticationPolicyFactory", ".", "createPolicy", "(", "context", ")", ";", "try", "{", "if", "(", "policy", ".", "isSatisfiedBy", "(", "authentication", ")", ")", "{", "return", "authentication", ";", "}", "}", "catch", "(", "final", "Exception", "e", ")", "{", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "throw", "new", "UnsatisfiedAuthenticationPolicyException", "(", "policy", ")", ";", "}" ]
Gets the authentication satisfied by policy. @param authentication the authentication @param context the context @return the authentication satisfied by policy @throws AbstractTicketException the ticket exception
[ "Gets", "the", "authentication", "satisfied", "by", "policy", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java#L164-L174
alkacon/opencms-core
src/org/opencms/mail/CmsMailUtil.java
CmsMailUtil.configureMail
public static void configureMail(CmsMailHost host, Email mail) { """ Configures the mail from the given mail host configuration data.<p> @param host the mail host configuration @param mail the email instance """ // set the host to the default mail host mail.setHostName(host.getHostname()); mail.setSmtpPort(host.getPort()); // check if username and password are provided String userName = host.getUsername(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { // authentication needed, set user name and password mail.setAuthentication(userName, host.getPassword()); } String security = host.getSecurity() != null ? host.getSecurity().trim() : null; if (SECURITY_SSL.equalsIgnoreCase(security)) { mail.setSslSmtpPort("" + host.getPort()); mail.setSSLOnConnect(true); } else if (SECURITY_STARTTLS.equalsIgnoreCase(security)) { mail.setStartTLSEnabled(true); } try { // set default mail from address mail.setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault()); } catch (EmailException e) { // default email address is not valid, log error LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e); } }
java
public static void configureMail(CmsMailHost host, Email mail) { // set the host to the default mail host mail.setHostName(host.getHostname()); mail.setSmtpPort(host.getPort()); // check if username and password are provided String userName = host.getUsername(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { // authentication needed, set user name and password mail.setAuthentication(userName, host.getPassword()); } String security = host.getSecurity() != null ? host.getSecurity().trim() : null; if (SECURITY_SSL.equalsIgnoreCase(security)) { mail.setSslSmtpPort("" + host.getPort()); mail.setSSLOnConnect(true); } else if (SECURITY_STARTTLS.equalsIgnoreCase(security)) { mail.setStartTLSEnabled(true); } try { // set default mail from address mail.setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault()); } catch (EmailException e) { // default email address is not valid, log error LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e); } }
[ "public", "static", "void", "configureMail", "(", "CmsMailHost", "host", ",", "Email", "mail", ")", "{", "// set the host to the default mail host", "mail", ".", "setHostName", "(", "host", ".", "getHostname", "(", ")", ")", ";", "mail", ".", "setSmtpPort", "(", "host", ".", "getPort", "(", ")", ")", ";", "// check if username and password are provided", "String", "userName", "=", "host", ".", "getUsername", "(", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "userName", ")", ")", "{", "// authentication needed, set user name and password", "mail", ".", "setAuthentication", "(", "userName", ",", "host", ".", "getPassword", "(", ")", ")", ";", "}", "String", "security", "=", "host", ".", "getSecurity", "(", ")", "!=", "null", "?", "host", ".", "getSecurity", "(", ")", ".", "trim", "(", ")", ":", "null", ";", "if", "(", "SECURITY_SSL", ".", "equalsIgnoreCase", "(", "security", ")", ")", "{", "mail", ".", "setSslSmtpPort", "(", "\"\"", "+", "host", ".", "getPort", "(", ")", ")", ";", "mail", ".", "setSSLOnConnect", "(", "true", ")", ";", "}", "else", "if", "(", "SECURITY_STARTTLS", ".", "equalsIgnoreCase", "(", "security", ")", ")", "{", "mail", ".", "setStartTLSEnabled", "(", "true", ")", ";", "}", "try", "{", "// set default mail from address", "mail", ".", "setFrom", "(", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getMailSettings", "(", ")", ".", "getMailFromDefault", "(", ")", ")", ";", "}", "catch", "(", "EmailException", "e", ")", "{", "// default email address is not valid, log error", "LOG", ".", "error", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_INVALID_SENDER_ADDRESS_0", ")", ",", "e", ")", ";", "}", "}" ]
Configures the mail from the given mail host configuration data.<p> @param host the mail host configuration @param mail the email instance
[ "Configures", "the", "mail", "from", "the", "given", "mail", "host", "configuration", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/mail/CmsMailUtil.java#L65-L92
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java
SparkExport.exportCSVSequenceLocal
public static void exportCSVSequenceLocal(File baseDir, JavaRDD<List<List<Writable>>> sequences, long seed) throws Exception { """ Quick and dirty CSV export: one file per sequence, with shuffling of the order of sequences """ baseDir.mkdirs(); if (!baseDir.isDirectory()) throw new IllegalArgumentException("File is not a directory: " + baseDir.toString()); String baseDirStr = baseDir.toString(); List<String> fileContents = sequences.map(new SequenceToStringFunction(",")).collect(); if (!(fileContents instanceof ArrayList)) fileContents = new ArrayList<>(fileContents); Collections.shuffle(fileContents, new Random(seed)); int i = 0; for (String s : fileContents) { String path = FilenameUtils.concat(baseDirStr, i + ".csv"); File f = new File(path); FileUtils.writeStringToFile(f, s); i++; } }
java
public static void exportCSVSequenceLocal(File baseDir, JavaRDD<List<List<Writable>>> sequences, long seed) throws Exception { baseDir.mkdirs(); if (!baseDir.isDirectory()) throw new IllegalArgumentException("File is not a directory: " + baseDir.toString()); String baseDirStr = baseDir.toString(); List<String> fileContents = sequences.map(new SequenceToStringFunction(",")).collect(); if (!(fileContents instanceof ArrayList)) fileContents = new ArrayList<>(fileContents); Collections.shuffle(fileContents, new Random(seed)); int i = 0; for (String s : fileContents) { String path = FilenameUtils.concat(baseDirStr, i + ".csv"); File f = new File(path); FileUtils.writeStringToFile(f, s); i++; } }
[ "public", "static", "void", "exportCSVSequenceLocal", "(", "File", "baseDir", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "sequences", ",", "long", "seed", ")", "throws", "Exception", "{", "baseDir", ".", "mkdirs", "(", ")", ";", "if", "(", "!", "baseDir", ".", "isDirectory", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"File is not a directory: \"", "+", "baseDir", ".", "toString", "(", ")", ")", ";", "String", "baseDirStr", "=", "baseDir", ".", "toString", "(", ")", ";", "List", "<", "String", ">", "fileContents", "=", "sequences", ".", "map", "(", "new", "SequenceToStringFunction", "(", "\",\"", ")", ")", ".", "collect", "(", ")", ";", "if", "(", "!", "(", "fileContents", "instanceof", "ArrayList", ")", ")", "fileContents", "=", "new", "ArrayList", "<>", "(", "fileContents", ")", ";", "Collections", ".", "shuffle", "(", "fileContents", ",", "new", "Random", "(", "seed", ")", ")", ";", "int", "i", "=", "0", ";", "for", "(", "String", "s", ":", "fileContents", ")", "{", "String", "path", "=", "FilenameUtils", ".", "concat", "(", "baseDirStr", ",", "i", "+", "\".csv\"", ")", ";", "File", "f", "=", "new", "File", "(", "path", ")", ";", "FileUtils", ".", "writeStringToFile", "(", "f", ",", "s", ")", ";", "i", "++", ";", "}", "}" ]
Quick and dirty CSV export: one file per sequence, with shuffling of the order of sequences
[ "Quick", "and", "dirty", "CSV", "export", ":", "one", "file", "per", "sequence", "with", "shuffling", "of", "the", "order", "of", "sequences" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java#L163-L182
looly/hutool
hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java
NetUtil.createAddress
public static InetSocketAddress createAddress(String host, int port) { """ 创建 {@link InetSocketAddress} @param host 域名或IP地址,空表示任意地址 @param port 端口,0表示系统分配临时端口 @return {@link InetSocketAddress} @since 3.3.0 """ if (StrUtil.isBlank(host)) { return new InetSocketAddress(port); } return new InetSocketAddress(host, port); }
java
public static InetSocketAddress createAddress(String host, int port) { if (StrUtil.isBlank(host)) { return new InetSocketAddress(port); } return new InetSocketAddress(host, port); }
[ "public", "static", "InetSocketAddress", "createAddress", "(", "String", "host", ",", "int", "port", ")", "{", "if", "(", "StrUtil", ".", "isBlank", "(", "host", ")", ")", "{", "return", "new", "InetSocketAddress", "(", "port", ")", ";", "}", "return", "new", "InetSocketAddress", "(", "host", ",", "port", ")", ";", "}" ]
创建 {@link InetSocketAddress} @param host 域名或IP地址,空表示任意地址 @param port 端口,0表示系统分配临时端口 @return {@link InetSocketAddress} @since 3.3.0
[ "创建", "{", "@link", "InetSocketAddress", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L467-L472
opencypher/openCypher
tools/grammar/src/main/java/org/opencypher/tools/Functions.java
Functions.requireNonNull
public static <T> T requireNonNull( Class<T> type, T value ) { """ Require an instance not to be null, using the (simple) name of the required type as an error message if it is. @param type the required type. @param value the value that must not be null. @param <T> the type. @return the value, that is guaranteed not to be null. @see Objects#requireNonNull(Object, Supplier) """ return Objects.requireNonNull( value, type::getSimpleName ); }
java
public static <T> T requireNonNull( Class<T> type, T value ) { return Objects.requireNonNull( value, type::getSimpleName ); }
[ "public", "static", "<", "T", ">", "T", "requireNonNull", "(", "Class", "<", "T", ">", "type", ",", "T", "value", ")", "{", "return", "Objects", ".", "requireNonNull", "(", "value", ",", "type", "::", "getSimpleName", ")", ";", "}" ]
Require an instance not to be null, using the (simple) name of the required type as an error message if it is. @param type the required type. @param value the value that must not be null. @param <T> the type. @return the value, that is guaranteed not to be null. @see Objects#requireNonNull(Object, Supplier)
[ "Require", "an", "instance", "not", "to", "be", "null", "using", "the", "(", "simple", ")", "name", "of", "the", "required", "type", "as", "an", "error", "message", "if", "it", "is", "." ]
train
https://github.com/opencypher/openCypher/blob/eb780caea625900ddbedd28a1eac9a5dbe09c5f0/tools/grammar/src/main/java/org/opencypher/tools/Functions.java#L58-L61
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java
GeoJsonWriteDriver.write
private void write(MultiPoint points, JsonGenerator gen) throws IOException { """ Coordinates of a MultiPoint are an array of positions: { "type": "MultiPoint", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] } @param points @param gen @throws IOException """ gen.writeStringField("type", "MultiPoint"); gen.writeFieldName("coordinates"); writeCoordinates(points.getCoordinates(), gen); }
java
private void write(MultiPoint points, JsonGenerator gen) throws IOException { gen.writeStringField("type", "MultiPoint"); gen.writeFieldName("coordinates"); writeCoordinates(points.getCoordinates(), gen); }
[ "private", "void", "write", "(", "MultiPoint", "points", ",", "JsonGenerator", "gen", ")", "throws", "IOException", "{", "gen", ".", "writeStringField", "(", "\"type\"", ",", "\"MultiPoint\"", ")", ";", "gen", ".", "writeFieldName", "(", "\"coordinates\"", ")", ";", "writeCoordinates", "(", "points", ".", "getCoordinates", "(", ")", ",", "gen", ")", ";", "}" ]
Coordinates of a MultiPoint are an array of positions: { "type": "MultiPoint", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] } @param points @param gen @throws IOException
[ "Coordinates", "of", "a", "MultiPoint", "are", "an", "array", "of", "positions", ":" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L382-L386
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/TargetsApi.java
TargetsApi.getTarget
public TargetsResponse getTarget(BigDecimal id, String type) throws ApiException { """ Get a target Get a specific target by type and ID. Targets can be agents, agent groups, queues, route points, skills, and custom contacts. @param id The ID of the target. (required) @param type The type of target to retrieve. (required) @return TargetsResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<TargetsResponse> resp = getTargetWithHttpInfo(id, type); return resp.getData(); }
java
public TargetsResponse getTarget(BigDecimal id, String type) throws ApiException { ApiResponse<TargetsResponse> resp = getTargetWithHttpInfo(id, type); return resp.getData(); }
[ "public", "TargetsResponse", "getTarget", "(", "BigDecimal", "id", ",", "String", "type", ")", "throws", "ApiException", "{", "ApiResponse", "<", "TargetsResponse", ">", "resp", "=", "getTargetWithHttpInfo", "(", "id", ",", "type", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Get a target Get a specific target by type and ID. Targets can be agents, agent groups, queues, route points, skills, and custom contacts. @param id The ID of the target. (required) @param type The type of target to retrieve. (required) @return TargetsResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "a", "target", "Get", "a", "specific", "target", "by", "type", "and", "ID", ".", "Targets", "can", "be", "agents", "agent", "groups", "queues", "route", "points", "skills", "and", "custom", "contacts", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/TargetsApi.java#L747-L750
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.addToPath
public static String addToPath(String basePath, String fileName) { """ Add this param to this path. @param strOldURL The original URL to add this param to. @param strParam The parameter to add. @param strData The data this parameter is set to. @param bAddIfNull Add an empty param if the data is null? @return The new URL string. """ return Util.addToPath(basePath, fileName, '\0'); }
java
public static String addToPath(String basePath, String fileName) { return Util.addToPath(basePath, fileName, '\0'); }
[ "public", "static", "String", "addToPath", "(", "String", "basePath", ",", "String", "fileName", ")", "{", "return", "Util", ".", "addToPath", "(", "basePath", ",", "fileName", ",", "'", "'", ")", ";", "}" ]
Add this param to this path. @param strOldURL The original URL to add this param to. @param strParam The parameter to add. @param strData The data this parameter is set to. @param bAddIfNull Add an empty param if the data is null? @return The new URL string.
[ "Add", "this", "param", "to", "this", "path", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L57-L60
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addDays
public static <T extends Calendar> T addDays(final T calendar, final int amount) { """ Adds a number of days to a calendar returning a new object. The original {@code Date} is unchanged. @param calendar the calendar, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the calendar is null """ return roll(calendar, amount, CalendarUnit.DAY); }
java
public static <T extends Calendar> T addDays(final T calendar, final int amount) { return roll(calendar, amount, CalendarUnit.DAY); }
[ "public", "static", "<", "T", "extends", "Calendar", ">", "T", "addDays", "(", "final", "T", "calendar", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "calendar", ",", "amount", ",", "CalendarUnit", ".", "DAY", ")", ";", "}" ]
Adds a number of days to a calendar returning a new object. The original {@code Date} is unchanged. @param calendar the calendar, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the calendar is null
[ "Adds", "a", "number", "of", "days", "to", "a", "calendar", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1105-L1107
looly/hutool
hutool-db/src/main/java/cn/hutool/db/AbstractDb.java
AbstractDb.query
public <T> T query(String sql, RsHandler<T> rsh, Object... params) throws SQLException { """ 查询 @param <T> 结果集需要处理的对象类型 @param sql 查询语句 @param rsh 结果集处理对象 @param params 参数 @return 结果对象 @throws SQLException SQL执行异常 """ Connection conn = null; try { conn = this.getConnection(); return SqlExecutor.query(conn, sql, rsh, params); } catch (SQLException e) { throw e; } finally { this.closeConnection(conn); } }
java
public <T> T query(String sql, RsHandler<T> rsh, Object... params) throws SQLException { Connection conn = null; try { conn = this.getConnection(); return SqlExecutor.query(conn, sql, rsh, params); } catch (SQLException e) { throw e; } finally { this.closeConnection(conn); } }
[ "public", "<", "T", ">", "T", "query", "(", "String", "sql", ",", "RsHandler", "<", "T", ">", "rsh", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "try", "{", "conn", "=", "this", ".", "getConnection", "(", ")", ";", "return", "SqlExecutor", ".", "query", "(", "conn", ",", "sql", ",", "rsh", ",", "params", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "e", ";", "}", "finally", "{", "this", ".", "closeConnection", "(", "conn", ")", ";", "}", "}" ]
查询 @param <T> 结果集需要处理的对象类型 @param sql 查询语句 @param rsh 结果集处理对象 @param params 参数 @return 结果对象 @throws SQLException SQL执行异常
[ "查询" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L144-L154
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/RegionMergeTree.java
RegionMergeTree.markMerge
protected void markMerge(int regionA, int regionB) { """ <p>This function will mark two regions for merger. Equivalent to set-union operation.</p> <p> If the two regions have yet to be merged into any others then regionB will become a member of regionA. Otherwise a quick heck is done to see if they are already marked for merging. If that fails it will traverse down the tree for each region until it gets to their roots. If the roots are not the same then they are merged. Either way the path is updated such that the quick check will pass. </p> """ int dA = mergeList.data[regionA]; int dB = mergeList.data[regionB]; // Quick check to see if they reference the same node if( dA == dB ) { return; } // search down to the root node (set-find) int rootA = regionA; while( dA != rootA ) { rootA = dA; dA = mergeList.data[rootA]; } int rootB = regionB; while( dB != rootB ) { rootB = dB; dB = mergeList.data[rootB]; } // make rootA the parent. This allows the quick test to pass in the future mergeList.data[regionA] = rootA; mergeList.data[regionB] = rootA; mergeList.data[rootB] = rootA; }
java
protected void markMerge(int regionA, int regionB) { int dA = mergeList.data[regionA]; int dB = mergeList.data[regionB]; // Quick check to see if they reference the same node if( dA == dB ) { return; } // search down to the root node (set-find) int rootA = regionA; while( dA != rootA ) { rootA = dA; dA = mergeList.data[rootA]; } int rootB = regionB; while( dB != rootB ) { rootB = dB; dB = mergeList.data[rootB]; } // make rootA the parent. This allows the quick test to pass in the future mergeList.data[regionA] = rootA; mergeList.data[regionB] = rootA; mergeList.data[rootB] = rootA; }
[ "protected", "void", "markMerge", "(", "int", "regionA", ",", "int", "regionB", ")", "{", "int", "dA", "=", "mergeList", ".", "data", "[", "regionA", "]", ";", "int", "dB", "=", "mergeList", ".", "data", "[", "regionB", "]", ";", "// Quick check to see if they reference the same node", "if", "(", "dA", "==", "dB", ")", "{", "return", ";", "}", "// search down to the root node (set-find)", "int", "rootA", "=", "regionA", ";", "while", "(", "dA", "!=", "rootA", ")", "{", "rootA", "=", "dA", ";", "dA", "=", "mergeList", ".", "data", "[", "rootA", "]", ";", "}", "int", "rootB", "=", "regionB", ";", "while", "(", "dB", "!=", "rootB", ")", "{", "rootB", "=", "dB", ";", "dB", "=", "mergeList", ".", "data", "[", "rootB", "]", ";", "}", "// make rootA the parent. This allows the quick test to pass in the future", "mergeList", ".", "data", "[", "regionA", "]", "=", "rootA", ";", "mergeList", ".", "data", "[", "regionB", "]", "=", "rootA", ";", "mergeList", ".", "data", "[", "rootB", "]", "=", "rootA", ";", "}" ]
<p>This function will mark two regions for merger. Equivalent to set-union operation.</p> <p> If the two regions have yet to be merged into any others then regionB will become a member of regionA. Otherwise a quick heck is done to see if they are already marked for merging. If that fails it will traverse down the tree for each region until it gets to their roots. If the roots are not the same then they are merged. Either way the path is updated such that the quick check will pass. </p>
[ "<p", ">", "This", "function", "will", "mark", "two", "regions", "for", "merger", ".", "Equivalent", "to", "set", "-", "union", "operation", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/RegionMergeTree.java#L146-L173