repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_individualcipher_binding.java
sslcipher_individualcipher_binding.count_filtered
public static long count_filtered(nitro_service service, String ciphergroupname, String filter) throws Exception { """ Use this API to count the filtered set of sslcipher_individualcipher_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ sslcipher_individualcipher_binding obj = new sslcipher_individualcipher_binding(); obj.set_ciphergroupname(ciphergroupname); options option = new options(); option.set_count(true); option.set_filter(filter); sslcipher_individualcipher_binding[] response = (sslcipher_individualcipher_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String ciphergroupname, String filter) throws Exception{ sslcipher_individualcipher_binding obj = new sslcipher_individualcipher_binding(); obj.set_ciphergroupname(ciphergroupname); options option = new options(); option.set_count(true); option.set_filter(filter); sslcipher_individualcipher_binding[] response = (sslcipher_individualcipher_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "ciphergroupname", ",", "String", "filter", ")", "throws", "Exception", "{", "sslcipher_individualcipher_binding", "obj", "=", "new", "sslcipher_individualcipher_binding", "(", ")", ";", "obj", ".", "set_ciphergroupname", "(", "ciphergroupname", ")", ";", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_count", "(", "true", ")", ";", "option", ".", "set_filter", "(", "filter", ")", ";", "sslcipher_individualcipher_binding", "[", "]", "response", "=", "(", "sslcipher_individualcipher_binding", "[", "]", ")", "obj", ".", "getfiltered", "(", "service", ",", "option", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "return", "response", "[", "0", "]", ".", "__count", ";", "}", "return", "0", ";", "}" ]
Use this API to count the filtered set of sslcipher_individualcipher_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "sslcipher_individualcipher_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_individualcipher_binding.java#L231-L242
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/images/ImageUtilities.java
ImageUtilities.scaleImage
public static BufferedImage scaleImage( BufferedImage image, int newSize ) throws Exception { """ Scale an image to a given size maintaining the ratio. @param image the image to scale. @param newSize the size of the new image (it will be used for the longer side). @return the scaled image. @throws Exception """ int imageWidth = image.getWidth(); int imageHeight = image.getHeight(); int width; int height; if (imageWidth > imageHeight) { width = newSize; height = imageHeight * width / imageWidth; } else { height = newSize; width = height * imageWidth / imageHeight; } BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(image, 0, 0, width, height, null); g.dispose(); return resizedImage; }
java
public static BufferedImage scaleImage( BufferedImage image, int newSize ) throws Exception { int imageWidth = image.getWidth(); int imageHeight = image.getHeight(); int width; int height; if (imageWidth > imageHeight) { width = newSize; height = imageHeight * width / imageWidth; } else { height = newSize; width = height * imageWidth / imageHeight; } BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(image, 0, 0, width, height, null); g.dispose(); return resizedImage; }
[ "public", "static", "BufferedImage", "scaleImage", "(", "BufferedImage", "image", ",", "int", "newSize", ")", "throws", "Exception", "{", "int", "imageWidth", "=", "image", ".", "getWidth", "(", ")", ";", "int", "imageHeight", "=", "image", ".", "getHeight", "(", ")", ";", "int", "width", ";", "int", "height", ";", "if", "(", "imageWidth", ">", "imageHeight", ")", "{", "width", "=", "newSize", ";", "height", "=", "imageHeight", "*", "width", "/", "imageWidth", ";", "}", "else", "{", "height", "=", "newSize", ";", "width", "=", "height", "*", "imageWidth", "/", "imageHeight", ";", "}", "BufferedImage", "resizedImage", "=", "new", "BufferedImage", "(", "width", ",", "height", ",", "BufferedImage", ".", "TYPE_INT_RGB", ")", ";", "Graphics2D", "g", "=", "resizedImage", ".", "createGraphics", "(", ")", ";", "g", ".", "drawImage", "(", "image", ",", "0", ",", "0", ",", "width", ",", "height", ",", "null", ")", ";", "g", ".", "dispose", "(", ")", ";", "return", "resizedImage", ";", "}" ]
Scale an image to a given size maintaining the ratio. @param image the image to scale. @param newSize the size of the new image (it will be used for the longer side). @return the scaled image. @throws Exception
[ "Scale", "an", "image", "to", "a", "given", "size", "maintaining", "the", "ratio", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/images/ImageUtilities.java#L65-L85
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallApi
public static ApiBean unmarshallApi(Map<String, Object> source) { """ Unmarshals the given map source into a bean. @param source the source @return the API """ if (source == null) { return null; } ApiBean bean = new ApiBean(); bean.setId(asString(source.get("id"))); bean.setName(asString(source.get("name"))); bean.setDescription(asString(source.get("description"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setNumPublished(asInt(source.get("numPublished"))); postMarshall(bean); return bean; }
java
public static ApiBean unmarshallApi(Map<String, Object> source) { if (source == null) { return null; } ApiBean bean = new ApiBean(); bean.setId(asString(source.get("id"))); bean.setName(asString(source.get("name"))); bean.setDescription(asString(source.get("description"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setNumPublished(asInt(source.get("numPublished"))); postMarshall(bean); return bean; }
[ "public", "static", "ApiBean", "unmarshallApi", "(", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "ApiBean", "bean", "=", "new", "ApiBean", "(", ")", ";", "bean", ".", "setId", "(", "asString", "(", "source", ".", "get", "(", "\"id\"", ")", ")", ")", ";", "bean", ".", "setName", "(", "asString", "(", "source", ".", "get", "(", "\"name\"", ")", ")", ")", ";", "bean", ".", "setDescription", "(", "asString", "(", "source", ".", "get", "(", "\"description\"", ")", ")", ")", ";", "bean", ".", "setCreatedBy", "(", "asString", "(", "source", ".", "get", "(", "\"createdBy\"", ")", ")", ")", ";", "bean", ".", "setCreatedOn", "(", "asDate", "(", "source", ".", "get", "(", "\"createdOn\"", ")", ")", ")", ";", "bean", ".", "setNumPublished", "(", "asInt", "(", "source", ".", "get", "(", "\"numPublished\"", ")", ")", ")", ";", "postMarshall", "(", "bean", ")", ";", "return", "bean", ";", "}" ]
Unmarshals the given map source into a bean. @param source the source @return the API
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L906-L919
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java
CmsSitemapHoverbar.installHoverbar
private static void installHoverbar(final CmsSitemapHoverbar hoverbar, CmsListItemWidget widget) { """ Installs the given hover bar.<p> @param hoverbar the hover bar @param widget the list item widget """ hoverbar.setVisible(false); widget.getContentPanel().add(hoverbar); A_CmsHoverHandler handler = new A_CmsHoverHandler() { /** * @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverIn(com.google.gwt.event.dom.client.MouseOverEvent) */ @Override protected void onHoverIn(MouseOverEvent event) { hoverbar.setHovered(true); if (hoverbar.isVisible()) { // prevent show when not needed return; } hoverbar.show(); } /** * @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverOut(com.google.gwt.event.dom.client.MouseOutEvent) */ @Override protected void onHoverOut(MouseOutEvent event) { hoverbar.setHovered(false); if (!hoverbar.isLocked()) { hoverbar.hide(); } } }; widget.addMouseOutHandler(handler); widget.addMouseOverHandler(handler); }
java
private static void installHoverbar(final CmsSitemapHoverbar hoverbar, CmsListItemWidget widget) { hoverbar.setVisible(false); widget.getContentPanel().add(hoverbar); A_CmsHoverHandler handler = new A_CmsHoverHandler() { /** * @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverIn(com.google.gwt.event.dom.client.MouseOverEvent) */ @Override protected void onHoverIn(MouseOverEvent event) { hoverbar.setHovered(true); if (hoverbar.isVisible()) { // prevent show when not needed return; } hoverbar.show(); } /** * @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverOut(com.google.gwt.event.dom.client.MouseOutEvent) */ @Override protected void onHoverOut(MouseOutEvent event) { hoverbar.setHovered(false); if (!hoverbar.isLocked()) { hoverbar.hide(); } } }; widget.addMouseOutHandler(handler); widget.addMouseOverHandler(handler); }
[ "private", "static", "void", "installHoverbar", "(", "final", "CmsSitemapHoverbar", "hoverbar", ",", "CmsListItemWidget", "widget", ")", "{", "hoverbar", ".", "setVisible", "(", "false", ")", ";", "widget", ".", "getContentPanel", "(", ")", ".", "add", "(", "hoverbar", ")", ";", "A_CmsHoverHandler", "handler", "=", "new", "A_CmsHoverHandler", "(", ")", "{", "/**\n * @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverIn(com.google.gwt.event.dom.client.MouseOverEvent)\n */", "@", "Override", "protected", "void", "onHoverIn", "(", "MouseOverEvent", "event", ")", "{", "hoverbar", ".", "setHovered", "(", "true", ")", ";", "if", "(", "hoverbar", ".", "isVisible", "(", ")", ")", "{", "// prevent show when not needed", "return", ";", "}", "hoverbar", ".", "show", "(", ")", ";", "}", "/**\n * @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverOut(com.google.gwt.event.dom.client.MouseOutEvent)\n */", "@", "Override", "protected", "void", "onHoverOut", "(", "MouseOutEvent", "event", ")", "{", "hoverbar", ".", "setHovered", "(", "false", ")", ";", "if", "(", "!", "hoverbar", ".", "isLocked", "(", ")", ")", "{", "hoverbar", ".", "hide", "(", ")", ";", "}", "}", "}", ";", "widget", ".", "addMouseOutHandler", "(", "handler", ")", ";", "widget", ".", "addMouseOverHandler", "(", "handler", ")", ";", "}" ]
Installs the given hover bar.<p> @param hoverbar the hover bar @param widget the list item widget
[ "Installs", "the", "given", "hover", "bar", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java#L249-L283
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readUser
public CmsUser readUser(CmsRequestContext context, CmsUUID id) throws CmsException { """ Returns a user object based on the id of a user.<p> @param context the current request context @param id the id of the user to read @return the user read @throws CmsException if something goes wrong """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUser result = null; try { result = m_driverManager.readUser(dbc, id); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_USER_FOR_ID_1, id.toString()), e); } finally { dbc.clear(); } return result; }
java
public CmsUser readUser(CmsRequestContext context, CmsUUID id) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUser result = null; try { result = m_driverManager.readUser(dbc, id); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_USER_FOR_ID_1, id.toString()), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsUser", "readUser", "(", "CmsRequestContext", "context", ",", "CmsUUID", "id", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "CmsUser", "result", "=", "null", ";", "try", "{", "result", "=", "m_driverManager", ".", "readUser", "(", "dbc", ",", "id", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_READ_USER_FOR_ID_1", ",", "id", ".", "toString", "(", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "return", "result", ";", "}" ]
Returns a user object based on the id of a user.<p> @param context the current request context @param id the id of the user to read @return the user read @throws CmsException if something goes wrong
[ "Returns", "a", "user", "object", "based", "on", "the", "id", "of", "a", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5472-L5484
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java
ESJPCompiler.readESJPPrograms
protected void readESJPPrograms() throws InstallationException { """ All EJSP programs in the eFaps database are read and stored in the mapping {@link #name2Source} for further using. @see #name2Source @throws InstallationException if ESJP Java programs could not be read """ try { final QueryBuilder queryBldr = new QueryBuilder(this.esjpType); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute("Name"); multi.executeWithoutAccessCheck(); while (multi.next()) { final String name = multi.<String>getAttribute("Name"); final Long id = multi.getCurrentInstance().getId(); final String path = "/" + name.replaceAll("\\.", Matcher.quoteReplacement("/")) + JavaFileObject.Kind.SOURCE.extension; final URI uri; try { uri = new URI("efaps", null, path, null, null); } catch (final URISyntaxException e) { throw new InstallationException("Could not create an URI for " + path, e); } this.name2Source.put(name, new SourceObject(uri, name, id)); } } catch (final EFapsException e) { throw new InstallationException("Could not fetch the information about installed ESJP's", e); } }
java
protected void readESJPPrograms() throws InstallationException { try { final QueryBuilder queryBldr = new QueryBuilder(this.esjpType); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute("Name"); multi.executeWithoutAccessCheck(); while (multi.next()) { final String name = multi.<String>getAttribute("Name"); final Long id = multi.getCurrentInstance().getId(); final String path = "/" + name.replaceAll("\\.", Matcher.quoteReplacement("/")) + JavaFileObject.Kind.SOURCE.extension; final URI uri; try { uri = new URI("efaps", null, path, null, null); } catch (final URISyntaxException e) { throw new InstallationException("Could not create an URI for " + path, e); } this.name2Source.put(name, new SourceObject(uri, name, id)); } } catch (final EFapsException e) { throw new InstallationException("Could not fetch the information about installed ESJP's", e); } }
[ "protected", "void", "readESJPPrograms", "(", ")", "throws", "InstallationException", "{", "try", "{", "final", "QueryBuilder", "queryBldr", "=", "new", "QueryBuilder", "(", "this", ".", "esjpType", ")", ";", "final", "MultiPrintQuery", "multi", "=", "queryBldr", ".", "getPrint", "(", ")", ";", "multi", ".", "addAttribute", "(", "\"Name\"", ")", ";", "multi", ".", "executeWithoutAccessCheck", "(", ")", ";", "while", "(", "multi", ".", "next", "(", ")", ")", "{", "final", "String", "name", "=", "multi", ".", "<", "String", ">", "getAttribute", "(", "\"Name\"", ")", ";", "final", "Long", "id", "=", "multi", ".", "getCurrentInstance", "(", ")", ".", "getId", "(", ")", ";", "final", "String", "path", "=", "\"/\"", "+", "name", ".", "replaceAll", "(", "\"\\\\.\"", ",", "Matcher", ".", "quoteReplacement", "(", "\"/\"", ")", ")", "+", "JavaFileObject", ".", "Kind", ".", "SOURCE", ".", "extension", ";", "final", "URI", "uri", ";", "try", "{", "uri", "=", "new", "URI", "(", "\"efaps\"", ",", "null", ",", "path", ",", "null", ",", "null", ")", ";", "}", "catch", "(", "final", "URISyntaxException", "e", ")", "{", "throw", "new", "InstallationException", "(", "\"Could not create an URI for \"", "+", "path", ",", "e", ")", ";", "}", "this", ".", "name2Source", ".", "put", "(", "name", ",", "new", "SourceObject", "(", "uri", ",", "name", ",", "id", ")", ")", ";", "}", "}", "catch", "(", "final", "EFapsException", "e", ")", "{", "throw", "new", "InstallationException", "(", "\"Could not fetch the information about installed ESJP's\"", ",", "e", ")", ";", "}", "}" ]
All EJSP programs in the eFaps database are read and stored in the mapping {@link #name2Source} for further using. @see #name2Source @throws InstallationException if ESJP Java programs could not be read
[ "All", "EJSP", "programs", "in", "the", "eFaps", "database", "are", "read", "and", "stored", "in", "the", "mapping", "{", "@link", "#name2Source", "}", "for", "further", "using", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java#L246-L270
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java
DifferentialFunctionFactory.randomExponential
public SDVariable randomExponential(double lambda, SDVariable shape) { """ Exponential distribution: P(x) = lambda * exp(-lambda * x) @param lambda Must be > 0 @param shape Shape of the output """ return new RandomExponential(sameDiff(), shape, lambda).outputVariable(); }
java
public SDVariable randomExponential(double lambda, SDVariable shape) { return new RandomExponential(sameDiff(), shape, lambda).outputVariable(); }
[ "public", "SDVariable", "randomExponential", "(", "double", "lambda", ",", "SDVariable", "shape", ")", "{", "return", "new", "RandomExponential", "(", "sameDiff", "(", ")", ",", "shape", ",", "lambda", ")", ".", "outputVariable", "(", ")", ";", "}" ]
Exponential distribution: P(x) = lambda * exp(-lambda * x) @param lambda Must be > 0 @param shape Shape of the output
[ "Exponential", "distribution", ":", "P", "(", "x", ")", "=", "lambda", "*", "exp", "(", "-", "lambda", "*", "x", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L240-L242
spring-cloud/spring-cloud-contract
spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/GitRepo.java
GitRepo.cloneProject
File cloneProject(URI projectUri) { """ Clones the project. @param projectUri - URI of the project @return file where the project was cloned """ try { log.info("Cloning repo from [" + projectUri + "] to [" + this.basedir + "]"); Git git = cloneToBasedir(projectUri, this.basedir); if (git != null) { git.close(); } File clonedRepo = git.getRepository().getWorkTree(); log.info("Cloned repo to [" + clonedRepo + "]"); return clonedRepo; } catch (Exception e) { throw new IllegalStateException("Exception occurred while cloning repo", e); } }
java
File cloneProject(URI projectUri) { try { log.info("Cloning repo from [" + projectUri + "] to [" + this.basedir + "]"); Git git = cloneToBasedir(projectUri, this.basedir); if (git != null) { git.close(); } File clonedRepo = git.getRepository().getWorkTree(); log.info("Cloned repo to [" + clonedRepo + "]"); return clonedRepo; } catch (Exception e) { throw new IllegalStateException("Exception occurred while cloning repo", e); } }
[ "File", "cloneProject", "(", "URI", "projectUri", ")", "{", "try", "{", "log", ".", "info", "(", "\"Cloning repo from [\"", "+", "projectUri", "+", "\"] to [\"", "+", "this", ".", "basedir", "+", "\"]\"", ")", ";", "Git", "git", "=", "cloneToBasedir", "(", "projectUri", ",", "this", ".", "basedir", ")", ";", "if", "(", "git", "!=", "null", ")", "{", "git", ".", "close", "(", ")", ";", "}", "File", "clonedRepo", "=", "git", ".", "getRepository", "(", ")", ".", "getWorkTree", "(", ")", ";", "log", ".", "info", "(", "\"Cloned repo to [\"", "+", "clonedRepo", "+", "\"]\"", ")", ";", "return", "clonedRepo", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Exception occurred while cloning repo\"", ",", "e", ")", ";", "}", "}" ]
Clones the project. @param projectUri - URI of the project @return file where the project was cloned
[ "Clones", "the", "project", "." ]
train
https://github.com/spring-cloud/spring-cloud-contract/blob/857da51950a87b393286e3bb1b2208c420c01087/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/GitRepo.java#L104-L118
spring-projects/spring-retry
src/main/java/org/springframework/retry/policy/CompositeRetryPolicy.java
CompositeRetryPolicy.registerThrowable
@Override public void registerThrowable(RetryContext context, Throwable throwable) { """ Delegate to the policies that were in operation when the context was created. @see org.springframework.retry.RetryPolicy#close(org.springframework.retry.RetryContext) """ RetryContext[] contexts = ((CompositeRetryContext) context).contexts; RetryPolicy[] policies = ((CompositeRetryContext) context).policies; for (int i = 0; i < contexts.length; i++) { policies[i].registerThrowable(contexts[i], throwable); } ((RetryContextSupport) context).registerThrowable(throwable); }
java
@Override public void registerThrowable(RetryContext context, Throwable throwable) { RetryContext[] contexts = ((CompositeRetryContext) context).contexts; RetryPolicy[] policies = ((CompositeRetryContext) context).policies; for (int i = 0; i < contexts.length; i++) { policies[i].registerThrowable(contexts[i], throwable); } ((RetryContextSupport) context).registerThrowable(throwable); }
[ "@", "Override", "public", "void", "registerThrowable", "(", "RetryContext", "context", ",", "Throwable", "throwable", ")", "{", "RetryContext", "[", "]", "contexts", "=", "(", "(", "CompositeRetryContext", ")", "context", ")", ".", "contexts", ";", "RetryPolicy", "[", "]", "policies", "=", "(", "(", "CompositeRetryContext", ")", "context", ")", ".", "policies", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "contexts", ".", "length", ";", "i", "++", ")", "{", "policies", "[", "i", "]", ".", "registerThrowable", "(", "contexts", "[", "i", "]", ",", "throwable", ")", ";", "}", "(", "(", "RetryContextSupport", ")", "context", ")", ".", "registerThrowable", "(", "throwable", ")", ";", "}" ]
Delegate to the policies that were in operation when the context was created. @see org.springframework.retry.RetryPolicy#close(org.springframework.retry.RetryContext)
[ "Delegate", "to", "the", "policies", "that", "were", "in", "operation", "when", "the", "context", "was", "created", "." ]
train
https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/retry/policy/CompositeRetryPolicy.java#L138-L146
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/MissingFail.java
MissingFail.exceptionToString
private static String exceptionToString(TryTree tree, VisitorState state) { """ Returns a string describing the exception type caught by the given try tree's catch statement(s), defaulting to {@code "Exception"} if more than one exception type is caught. """ if (tree.getCatches().size() != 1) { return "Exception"; } Tree exceptionType = tree.getCatches().iterator().next().getParameter().getType(); Type type = ASTHelpers.getType(exceptionType); if (type != null && type.isUnion()) { return "Exception"; } return state.getSourceForNode(exceptionType); }
java
private static String exceptionToString(TryTree tree, VisitorState state) { if (tree.getCatches().size() != 1) { return "Exception"; } Tree exceptionType = tree.getCatches().iterator().next().getParameter().getType(); Type type = ASTHelpers.getType(exceptionType); if (type != null && type.isUnion()) { return "Exception"; } return state.getSourceForNode(exceptionType); }
[ "private", "static", "String", "exceptionToString", "(", "TryTree", "tree", ",", "VisitorState", "state", ")", "{", "if", "(", "tree", ".", "getCatches", "(", ")", ".", "size", "(", ")", "!=", "1", ")", "{", "return", "\"Exception\"", ";", "}", "Tree", "exceptionType", "=", "tree", ".", "getCatches", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ".", "getParameter", "(", ")", ".", "getType", "(", ")", ";", "Type", "type", "=", "ASTHelpers", ".", "getType", "(", "exceptionType", ")", ";", "if", "(", "type", "!=", "null", "&&", "type", ".", "isUnion", "(", ")", ")", "{", "return", "\"Exception\"", ";", "}", "return", "state", ".", "getSourceForNode", "(", "exceptionType", ")", ";", "}" ]
Returns a string describing the exception type caught by the given try tree's catch statement(s), defaulting to {@code "Exception"} if more than one exception type is caught.
[ "Returns", "a", "string", "describing", "the", "exception", "type", "caught", "by", "the", "given", "try", "tree", "s", "catch", "statement", "(", "s", ")", "defaulting", "to", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/MissingFail.java#L255-L265
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java
WorkflowClient.getRunningWorkflow
public List<String> getRunningWorkflow(String workflowName, Integer version) { """ Retrieve all running workflow instances for a given name and version @param workflowName the name of the workflow @param version the version of the wokflow definition. Defaults to 1. @return the list of running workflow instances """ Preconditions.checkArgument(StringUtils.isNotBlank(workflowName), "Workflow name cannot be blank"); return getForEntity("workflow/running/{name}", new Object[]{"version", version}, new GenericType<List<String>>() { }, workflowName); }
java
public List<String> getRunningWorkflow(String workflowName, Integer version) { Preconditions.checkArgument(StringUtils.isNotBlank(workflowName), "Workflow name cannot be blank"); return getForEntity("workflow/running/{name}", new Object[]{"version", version}, new GenericType<List<String>>() { }, workflowName); }
[ "public", "List", "<", "String", ">", "getRunningWorkflow", "(", "String", "workflowName", ",", "Integer", "version", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "workflowName", ")", ",", "\"Workflow name cannot be blank\"", ")", ";", "return", "getForEntity", "(", "\"workflow/running/{name}\"", ",", "new", "Object", "[", "]", "{", "\"version\"", ",", "version", "}", ",", "new", "GenericType", "<", "List", "<", "String", ">", ">", "(", ")", "{", "}", ",", "workflowName", ")", ";", "}" ]
Retrieve all running workflow instances for a given name and version @param workflowName the name of the workflow @param version the version of the wokflow definition. Defaults to 1. @return the list of running workflow instances
[ "Retrieve", "all", "running", "workflow", "instances", "for", "a", "given", "name", "and", "version" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java#L203-L207
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/perceptron/cli/Args.java
Args.parseOrExit
public static List<String> parseOrExit(Object target, String[] args) { """ A convenience method for parsing and automatically producing error messages. @param target Either an instance or a class @param args The arguments you want to parse and populate @return The list of arguments that were not consumed """ try { return parse(target, args); } catch (IllegalArgumentException e) { System.err.println(e.getMessage()); Args.usage(target); System.exit(1); throw e; } }
java
public static List<String> parseOrExit(Object target, String[] args) { try { return parse(target, args); } catch (IllegalArgumentException e) { System.err.println(e.getMessage()); Args.usage(target); System.exit(1); throw e; } }
[ "public", "static", "List", "<", "String", ">", "parseOrExit", "(", "Object", "target", ",", "String", "[", "]", "args", ")", "{", "try", "{", "return", "parse", "(", "target", ",", "args", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "Args", ".", "usage", "(", "target", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "throw", "e", ";", "}", "}" ]
A convenience method for parsing and automatically producing error messages. @param target Either an instance or a class @param args The arguments you want to parse and populate @return The list of arguments that were not consumed
[ "A", "convenience", "method", "for", "parsing", "and", "automatically", "producing", "error", "messages", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/cli/Args.java#L30-L43
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java
BufferPoolMgr.pinNew
Buffer pinNew(String fileName, PageFormatter fmtr) { """ Allocates a new block in the specified file, and pins a buffer to it. Returns null (without allocating the block) if there are no available buffers. @param fileName the name of the file @param fmtr a pageformatter object, used to format the new block @return the pinned buffer """ // Only the txs acquiring to append the block on the same file will be blocked synchronized (prepareAnchor(fileName)) { // Choose Unpinned Buffer int lastReplacedBuff = this.lastReplacedBuff; int currBlk = (lastReplacedBuff + 1) % bufferPool.length; while (currBlk != lastReplacedBuff) { Buffer buff = bufferPool[currBlk]; // Get the lock of buffer if it is free if (buff.getExternalLock().tryLock()) { try { if (!buff.isPinned()) { this.lastReplacedBuff = currBlk; // Swap BlockId oldBlk = buff.block(); if (oldBlk != null) blockMap.remove(oldBlk); buff.assignToNew(fileName, fmtr); blockMap.put(buff.block(), buff); if (!buff.isPinned()) numAvailable.decrementAndGet(); // Pin this buffer buff.pin(); return buff; } } finally { // Release the lock of buffer buff.getExternalLock().unlock(); } } currBlk = (currBlk + 1) % bufferPool.length; } return null; } }
java
Buffer pinNew(String fileName, PageFormatter fmtr) { // Only the txs acquiring to append the block on the same file will be blocked synchronized (prepareAnchor(fileName)) { // Choose Unpinned Buffer int lastReplacedBuff = this.lastReplacedBuff; int currBlk = (lastReplacedBuff + 1) % bufferPool.length; while (currBlk != lastReplacedBuff) { Buffer buff = bufferPool[currBlk]; // Get the lock of buffer if it is free if (buff.getExternalLock().tryLock()) { try { if (!buff.isPinned()) { this.lastReplacedBuff = currBlk; // Swap BlockId oldBlk = buff.block(); if (oldBlk != null) blockMap.remove(oldBlk); buff.assignToNew(fileName, fmtr); blockMap.put(buff.block(), buff); if (!buff.isPinned()) numAvailable.decrementAndGet(); // Pin this buffer buff.pin(); return buff; } } finally { // Release the lock of buffer buff.getExternalLock().unlock(); } } currBlk = (currBlk + 1) % bufferPool.length; } return null; } }
[ "Buffer", "pinNew", "(", "String", "fileName", ",", "PageFormatter", "fmtr", ")", "{", "// Only the txs acquiring to append the block on the same file will be blocked\r", "synchronized", "(", "prepareAnchor", "(", "fileName", ")", ")", "{", "// Choose Unpinned Buffer\r", "int", "lastReplacedBuff", "=", "this", ".", "lastReplacedBuff", ";", "int", "currBlk", "=", "(", "lastReplacedBuff", "+", "1", ")", "%", "bufferPool", ".", "length", ";", "while", "(", "currBlk", "!=", "lastReplacedBuff", ")", "{", "Buffer", "buff", "=", "bufferPool", "[", "currBlk", "]", ";", "// Get the lock of buffer if it is free\r", "if", "(", "buff", ".", "getExternalLock", "(", ")", ".", "tryLock", "(", ")", ")", "{", "try", "{", "if", "(", "!", "buff", ".", "isPinned", "(", ")", ")", "{", "this", ".", "lastReplacedBuff", "=", "currBlk", ";", "// Swap\r", "BlockId", "oldBlk", "=", "buff", ".", "block", "(", ")", ";", "if", "(", "oldBlk", "!=", "null", ")", "blockMap", ".", "remove", "(", "oldBlk", ")", ";", "buff", ".", "assignToNew", "(", "fileName", ",", "fmtr", ")", ";", "blockMap", ".", "put", "(", "buff", ".", "block", "(", ")", ",", "buff", ")", ";", "if", "(", "!", "buff", ".", "isPinned", "(", ")", ")", "numAvailable", ".", "decrementAndGet", "(", ")", ";", "// Pin this buffer\r", "buff", ".", "pin", "(", ")", ";", "return", "buff", ";", "}", "}", "finally", "{", "// Release the lock of buffer\r", "buff", ".", "getExternalLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}", "currBlk", "=", "(", "currBlk", "+", "1", ")", "%", "bufferPool", ".", "length", ";", "}", "return", "null", ";", "}", "}" ]
Allocates a new block in the specified file, and pins a buffer to it. Returns null (without allocating the block) if there are no available buffers. @param fileName the name of the file @param fmtr a pageformatter object, used to format the new block @return the pinned buffer
[ "Allocates", "a", "new", "block", "in", "the", "specified", "file", "and", "pins", "a", "buffer", "to", "it", ".", "Returns", "null", "(", "without", "allocating", "the", "block", ")", "if", "there", "are", "no", "available", "buffers", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java#L191-L229
geomajas/geomajas-project-client-gwt2
plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java
TmsClient.createLayer
public TmsLayer createLayer(String id, TileConfiguration tileConfiguration, TmsLayerConfiguration layerConfiguration) { """ Create a new TMS layer instance. @param id The unique layer ID. @param tileConfiguration The tile configuration object. @param layerConfiguration The layer configuration object. @return A new TMS layer. """ return new TmsLayer(id, tileConfiguration, layerConfiguration); }
java
public TmsLayer createLayer(String id, TileConfiguration tileConfiguration, TmsLayerConfiguration layerConfiguration) { return new TmsLayer(id, tileConfiguration, layerConfiguration); }
[ "public", "TmsLayer", "createLayer", "(", "String", "id", ",", "TileConfiguration", "tileConfiguration", ",", "TmsLayerConfiguration", "layerConfiguration", ")", "{", "return", "new", "TmsLayer", "(", "id", ",", "tileConfiguration", ",", "layerConfiguration", ")", ";", "}" ]
Create a new TMS layer instance. @param id The unique layer ID. @param tileConfiguration The tile configuration object. @param layerConfiguration The layer configuration object. @return A new TMS layer.
[ "Create", "a", "new", "TMS", "layer", "instance", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java#L171-L174
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/JobDetailsInner.java
JobDetailsInner.getAsync
public Observable<JobResourceInner> getAsync(String vaultName, String resourceGroupName, String jobName) { """ Gets exteded information associated with the job. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param jobName Name of the job whose details are to be fetched. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobResourceInner object """ return getWithServiceResponseAsync(vaultName, resourceGroupName, jobName).map(new Func1<ServiceResponse<JobResourceInner>, JobResourceInner>() { @Override public JobResourceInner call(ServiceResponse<JobResourceInner> response) { return response.body(); } }); }
java
public Observable<JobResourceInner> getAsync(String vaultName, String resourceGroupName, String jobName) { return getWithServiceResponseAsync(vaultName, resourceGroupName, jobName).map(new Func1<ServiceResponse<JobResourceInner>, JobResourceInner>() { @Override public JobResourceInner call(ServiceResponse<JobResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobResourceInner", ">", "getAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "jobName", ")", "{", "return", "getWithServiceResponseAsync", "(", "vaultName", ",", "resourceGroupName", ",", "jobName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "JobResourceInner", ">", ",", "JobResourceInner", ">", "(", ")", "{", "@", "Override", "public", "JobResourceInner", "call", "(", "ServiceResponse", "<", "JobResourceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets exteded information associated with the job. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param jobName Name of the job whose details are to be fetched. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobResourceInner object
[ "Gets", "exteded", "information", "associated", "with", "the", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/JobDetailsInner.java#L98-L105
GoogleCloudPlatform/appengine-pipelines
java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java
PipelineManager.querySlotOrAbandonTask
private static Slot querySlotOrAbandonTask(Key key, boolean inflate) { """ Queries the Slot with the given Key from the data store and if the Slot is not found then throws an {@link AbandonTaskException}. @param key The Key of the slot to fetch. @param inflate If this is {@code true} then the Barriers that are waiting on the Slot and the other Slots that those Barriers are waiting on will also be fetched from the data store and used to partially populate the graph of objects attached to the returned Slot. In particular: {@link Slot#getWaitingOnMeInflated()} will not return {@code null} and also that for each of the {@link Barrier Barriers} returned from that method {@link Barrier#getWaitingOnInflated()} will not return {@code null}. @return A {@code Slot}, possibly with a partially-inflated associated graph of objects. @throws AbandonTaskException If either the Slot or the associated Barriers and slots are not found in the data store. """ try { return backEnd.querySlot(key, inflate); } catch (NoSuchObjectException e) { logger.log(Level.WARNING, "Cannot find the slot: " + key + ". Ignoring the task.", e); throw new AbandonTaskException(); } }
java
private static Slot querySlotOrAbandonTask(Key key, boolean inflate) { try { return backEnd.querySlot(key, inflate); } catch (NoSuchObjectException e) { logger.log(Level.WARNING, "Cannot find the slot: " + key + ". Ignoring the task.", e); throw new AbandonTaskException(); } }
[ "private", "static", "Slot", "querySlotOrAbandonTask", "(", "Key", "key", ",", "boolean", "inflate", ")", "{", "try", "{", "return", "backEnd", ".", "querySlot", "(", "key", ",", "inflate", ")", ";", "}", "catch", "(", "NoSuchObjectException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Cannot find the slot: \"", "+", "key", "+", "\". Ignoring the task.\"", ",", "e", ")", ";", "throw", "new", "AbandonTaskException", "(", ")", ";", "}", "}" ]
Queries the Slot with the given Key from the data store and if the Slot is not found then throws an {@link AbandonTaskException}. @param key The Key of the slot to fetch. @param inflate If this is {@code true} then the Barriers that are waiting on the Slot and the other Slots that those Barriers are waiting on will also be fetched from the data store and used to partially populate the graph of objects attached to the returned Slot. In particular: {@link Slot#getWaitingOnMeInflated()} will not return {@code null} and also that for each of the {@link Barrier Barriers} returned from that method {@link Barrier#getWaitingOnInflated()} will not return {@code null}. @return A {@code Slot}, possibly with a partially-inflated associated graph of objects. @throws AbandonTaskException If either the Slot or the associated Barriers and slots are not found in the data store.
[ "Queries", "the", "Slot", "with", "the", "given", "Key", "from", "the", "data", "store", "and", "if", "the", "Slot", "is", "not", "found", "then", "throws", "an", "{", "@link", "AbandonTaskException", "}", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L1214-L1221
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java
QrCodeUtil.decode
public static String decode(Image image, boolean isTryHarder, boolean isPureBarcode) { """ 将二维码图片解码为文本 @param image {@link Image} 二维码图片 @param isTryHarder 是否优化精度 @param isPureBarcode 是否使用复杂模式,扫描带logo的二维码设为true @return 解码后的文本 @since 4.3.1 """ final MultiFormatReader formatReader = new MultiFormatReader(); final LuminanceSource source = new BufferedImageLuminanceSource(ImgUtil.toBufferedImage(image)); final Binarizer binarizer = new HybridBinarizer(source); final BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer); final HashMap<DecodeHintType, Object> hints = new HashMap<>(); hints.put(DecodeHintType.CHARACTER_SET, CharsetUtil.UTF_8); // 优化精度 hints.put(DecodeHintType.TRY_HARDER, Boolean.valueOf(isTryHarder)); // 复杂模式,开启PURE_BARCODE模式 hints.put(DecodeHintType.PURE_BARCODE, Boolean.valueOf(isPureBarcode)); Result result; try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e) { // 报错尝试关闭复杂模式 hints.remove(DecodeHintType.PURE_BARCODE); try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e1) { throw new QrCodeException(e1); } } return result.getText(); }
java
public static String decode(Image image, boolean isTryHarder, boolean isPureBarcode) { final MultiFormatReader formatReader = new MultiFormatReader(); final LuminanceSource source = new BufferedImageLuminanceSource(ImgUtil.toBufferedImage(image)); final Binarizer binarizer = new HybridBinarizer(source); final BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer); final HashMap<DecodeHintType, Object> hints = new HashMap<>(); hints.put(DecodeHintType.CHARACTER_SET, CharsetUtil.UTF_8); // 优化精度 hints.put(DecodeHintType.TRY_HARDER, Boolean.valueOf(isTryHarder)); // 复杂模式,开启PURE_BARCODE模式 hints.put(DecodeHintType.PURE_BARCODE, Boolean.valueOf(isPureBarcode)); Result result; try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e) { // 报错尝试关闭复杂模式 hints.remove(DecodeHintType.PURE_BARCODE); try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e1) { throw new QrCodeException(e1); } } return result.getText(); }
[ "public", "static", "String", "decode", "(", "Image", "image", ",", "boolean", "isTryHarder", ",", "boolean", "isPureBarcode", ")", "{", "final", "MultiFormatReader", "formatReader", "=", "new", "MultiFormatReader", "(", ")", ";", "final", "LuminanceSource", "source", "=", "new", "BufferedImageLuminanceSource", "(", "ImgUtil", ".", "toBufferedImage", "(", "image", ")", ")", ";", "final", "Binarizer", "binarizer", "=", "new", "HybridBinarizer", "(", "source", ")", ";", "final", "BinaryBitmap", "binaryBitmap", "=", "new", "BinaryBitmap", "(", "binarizer", ")", ";", "final", "HashMap", "<", "DecodeHintType", ",", "Object", ">", "hints", "=", "new", "HashMap", "<>", "(", ")", ";", "hints", ".", "put", "(", "DecodeHintType", ".", "CHARACTER_SET", ",", "CharsetUtil", ".", "UTF_8", ")", ";", "// 优化精度\r", "hints", ".", "put", "(", "DecodeHintType", ".", "TRY_HARDER", ",", "Boolean", ".", "valueOf", "(", "isTryHarder", ")", ")", ";", "// 复杂模式,开启PURE_BARCODE模式\r", "hints", ".", "put", "(", "DecodeHintType", ".", "PURE_BARCODE", ",", "Boolean", ".", "valueOf", "(", "isPureBarcode", ")", ")", ";", "Result", "result", ";", "try", "{", "result", "=", "formatReader", ".", "decode", "(", "binaryBitmap", ",", "hints", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "// 报错尝试关闭复杂模式\r", "hints", ".", "remove", "(", "DecodeHintType", ".", "PURE_BARCODE", ")", ";", "try", "{", "result", "=", "formatReader", ".", "decode", "(", "binaryBitmap", ",", "hints", ")", ";", "}", "catch", "(", "NotFoundException", "e1", ")", "{", "throw", "new", "QrCodeException", "(", "e1", ")", ";", "}", "}", "return", "result", ".", "getText", "(", ")", ";", "}" ]
将二维码图片解码为文本 @param image {@link Image} 二维码图片 @param isTryHarder 是否优化精度 @param isPureBarcode 是否使用复杂模式,扫描带logo的二维码设为true @return 解码后的文本 @since 4.3.1
[ "将二维码图片解码为文本" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L303-L330
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/map/ViewPortImpl.java
ViewPortImpl.getBounds
public Bbox getBounds() { """ Given the information in this ViewPort object, what is the currently visible area? This value is expressed in world coordinates. @return Returns the bounding box that covers the currently visible area on the map. """ double w = mapWidth * getResolution(); double h = mapHeight * getResolution(); double x = getPosition().getX() - w / 2; double y = getPosition().getY() - h / 2; return new Bbox(x, y, w, h); }
java
public Bbox getBounds() { double w = mapWidth * getResolution(); double h = mapHeight * getResolution(); double x = getPosition().getX() - w / 2; double y = getPosition().getY() - h / 2; return new Bbox(x, y, w, h); }
[ "public", "Bbox", "getBounds", "(", ")", "{", "double", "w", "=", "mapWidth", "*", "getResolution", "(", ")", ";", "double", "h", "=", "mapHeight", "*", "getResolution", "(", ")", ";", "double", "x", "=", "getPosition", "(", ")", ".", "getX", "(", ")", "-", "w", "/", "2", ";", "double", "y", "=", "getPosition", "(", ")", ".", "getY", "(", ")", "-", "h", "/", "2", ";", "return", "new", "Bbox", "(", "x", ",", "y", ",", "w", ",", "h", ")", ";", "}" ]
Given the information in this ViewPort object, what is the currently visible area? This value is expressed in world coordinates. @return Returns the bounding box that covers the currently visible area on the map.
[ "Given", "the", "information", "in", "this", "ViewPort", "object", "what", "is", "the", "currently", "visible", "area?", "This", "value", "is", "expressed", "in", "world", "coordinates", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/map/ViewPortImpl.java#L252-L258
kevoree/kevoree-library
mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java
ProtocolProcessor.processPubRel
void processPubRel(String clientID, int messageID) { """ Second phase of a publish QoS2 protocol, sent by publisher to the broker. Search the stored message and publish to all interested subscribers. """ Log.trace("PUB --PUBREL--> SRV processPubRel invoked for clientID {} ad messageID {}", clientID, messageID); String publishKey = String.format("%s%d", clientID, messageID); PublishEvent evt = m_storageService.retrieveQoS2Message(publishKey); final String topic = evt.getTopic(); final AbstractMessage.QOSType qos = evt.getQos(); publish2Subscribers(topic, qos, evt.getMessage(), evt.isRetain(), evt.getMessageID()); m_storageService.removeQoS2Message(publishKey); if (evt.isRetain()) { m_storageService.storeRetained(topic, evt.getMessage(), qos); } sendPubComp(clientID, messageID); }
java
void processPubRel(String clientID, int messageID) { Log.trace("PUB --PUBREL--> SRV processPubRel invoked for clientID {} ad messageID {}", clientID, messageID); String publishKey = String.format("%s%d", clientID, messageID); PublishEvent evt = m_storageService.retrieveQoS2Message(publishKey); final String topic = evt.getTopic(); final AbstractMessage.QOSType qos = evt.getQos(); publish2Subscribers(topic, qos, evt.getMessage(), evt.isRetain(), evt.getMessageID()); m_storageService.removeQoS2Message(publishKey); if (evt.isRetain()) { m_storageService.storeRetained(topic, evt.getMessage(), qos); } sendPubComp(clientID, messageID); }
[ "void", "processPubRel", "(", "String", "clientID", ",", "int", "messageID", ")", "{", "Log", ".", "trace", "(", "\"PUB --PUBREL--> SRV processPubRel invoked for clientID {} ad messageID {}\"", ",", "clientID", ",", "messageID", ")", ";", "String", "publishKey", "=", "String", ".", "format", "(", "\"%s%d\"", ",", "clientID", ",", "messageID", ")", ";", "PublishEvent", "evt", "=", "m_storageService", ".", "retrieveQoS2Message", "(", "publishKey", ")", ";", "final", "String", "topic", "=", "evt", ".", "getTopic", "(", ")", ";", "final", "AbstractMessage", ".", "QOSType", "qos", "=", "evt", ".", "getQos", "(", ")", ";", "publish2Subscribers", "(", "topic", ",", "qos", ",", "evt", ".", "getMessage", "(", ")", ",", "evt", ".", "isRetain", "(", ")", ",", "evt", ".", "getMessageID", "(", ")", ")", ";", "m_storageService", ".", "removeQoS2Message", "(", "publishKey", ")", ";", "if", "(", "evt", ".", "isRetain", "(", ")", ")", "{", "m_storageService", ".", "storeRetained", "(", "topic", ",", "evt", ".", "getMessage", "(", ")", ",", "qos", ")", ";", "}", "sendPubComp", "(", "clientID", ",", "messageID", ")", ";", "}" ]
Second phase of a publish QoS2 protocol, sent by publisher to the broker. Search the stored message and publish to all interested subscribers.
[ "Second", "phase", "of", "a", "publish", "QoS2", "protocol", "sent", "by", "publisher", "to", "the", "broker", ".", "Search", "the", "stored", "message", "and", "publish", "to", "all", "interested", "subscribers", "." ]
train
https://github.com/kevoree/kevoree-library/blob/617460e6c5881902ebc488a31ecdea179024d8f1/mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java#L400-L417
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java
Duration.minus
public Duration minus(long amountToSubtract, TemporalUnit unit) { """ Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an {@linkplain TemporalUnit#isDurationEstimated() exact duration} or be {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception. <p> This instance is immutable and unaffected by this method call. @param amountToSubtract the amount to subtract, measured in terms of the unit, positive or negative @param unit the unit that the amount is measured in, must have an exact duration, not null @return a {@code Duration} based on this duration with the specified duration subtracted, not null @throws ArithmeticException if numeric overflow occurs """ return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, unit)); }
java
public Duration minus(long amountToSubtract, TemporalUnit unit) { return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, unit)); }
[ "public", "Duration", "minus", "(", "long", "amountToSubtract", ",", "TemporalUnit", "unit", ")", "{", "return", "(", "amountToSubtract", "==", "Long", ".", "MIN_VALUE", "?", "plus", "(", "Long", ".", "MAX_VALUE", ",", "unit", ")", ".", "plus", "(", "1", ",", "unit", ")", ":", "plus", "(", "-", "amountToSubtract", ",", "unit", ")", ")", ";", "}" ]
Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an {@linkplain TemporalUnit#isDurationEstimated() exact duration} or be {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception. <p> This instance is immutable and unaffected by this method call. @param amountToSubtract the amount to subtract, measured in terms of the unit, positive or negative @param unit the unit that the amount is measured in, must have an exact duration, not null @return a {@code Duration} based on this duration with the specified duration subtracted, not null @throws ArithmeticException if numeric overflow occurs
[ "Returns", "a", "copy", "of", "this", "duration", "with", "the", "specified", "duration", "subtracted", ".", "<p", ">", "The", "duration", "amount", "is", "measured", "in", "terms", "of", "the", "specified", "unit", ".", "Only", "a", "subset", "of", "units", "are", "accepted", "by", "this", "method", ".", "The", "unit", "must", "either", "have", "an", "{", "@linkplain", "TemporalUnit#isDurationEstimated", "()", "exact", "duration", "}", "or", "be", "{", "@link", "ChronoUnit#DAYS", "}", "which", "is", "treated", "as", "24", "hours", ".", "Other", "units", "throw", "an", "exception", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java#L850-L852
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/io/IO.java
IO.skipFully
public static void skipFully(InputStream in, long bytes) throws IOException { """ Provide a skip fully method. Either skips the requested number of bytes or throws an IOException; @param in The input stream on which to perform the skip @param bytes Number of bytes to skip @throws EOFException if we reach EOF and still need to skip more bytes @throws IOException if in.skip throws an IOException """ if (bytes < 0) { throw new IllegalArgumentException("Can't skip " + bytes + " bytes"); } long remaining = bytes; while (remaining > 0) { long skipped = in.skip(remaining); if (skipped <= 0) { throw new EOFException("Reached EOF while trying to skip a total of " + bytes); } remaining -= skipped; } }
java
public static void skipFully(InputStream in, long bytes) throws IOException { if (bytes < 0) { throw new IllegalArgumentException("Can't skip " + bytes + " bytes"); } long remaining = bytes; while (remaining > 0) { long skipped = in.skip(remaining); if (skipped <= 0) { throw new EOFException("Reached EOF while trying to skip a total of " + bytes); } remaining -= skipped; } }
[ "public", "static", "void", "skipFully", "(", "InputStream", "in", ",", "long", "bytes", ")", "throws", "IOException", "{", "if", "(", "bytes", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't skip \"", "+", "bytes", "+", "\" bytes\"", ")", ";", "}", "long", "remaining", "=", "bytes", ";", "while", "(", "remaining", ">", "0", ")", "{", "long", "skipped", "=", "in", ".", "skip", "(", "remaining", ")", ";", "if", "(", "skipped", "<=", "0", ")", "{", "throw", "new", "EOFException", "(", "\"Reached EOF while trying to skip a total of \"", "+", "bytes", ")", ";", "}", "remaining", "-=", "skipped", ";", "}", "}" ]
Provide a skip fully method. Either skips the requested number of bytes or throws an IOException; @param in The input stream on which to perform the skip @param bytes Number of bytes to skip @throws EOFException if we reach EOF and still need to skip more bytes @throws IOException if in.skip throws an IOException
[ "Provide", "a", "skip", "fully", "method", ".", "Either", "skips", "the", "requested", "number", "of", "bytes", "or", "throws", "an", "IOException", ";" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/io/IO.java#L245-L258
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridResourceProvider.java
DataGridResourceProvider.internalFormatMessage
protected String internalFormatMessage(String pattern, Object[] args) { """ Internal convenience method that is used to format a message given a pattern and a set of arguments. @param pattern the pattern to format @param args the arguments to use when formatting @return the formatted string """ /* todo: perf -- could the MessageFormat objects be cached? */ MessageFormat format = new MessageFormat(pattern); String msg = format.format(args).toString(); return msg; }
java
protected String internalFormatMessage(String pattern, Object[] args) { /* todo: perf -- could the MessageFormat objects be cached? */ MessageFormat format = new MessageFormat(pattern); String msg = format.format(args).toString(); return msg; }
[ "protected", "String", "internalFormatMessage", "(", "String", "pattern", ",", "Object", "[", "]", "args", ")", "{", "/* todo: perf -- could the MessageFormat objects be cached? */", "MessageFormat", "format", "=", "new", "MessageFormat", "(", "pattern", ")", ";", "String", "msg", "=", "format", ".", "format", "(", "args", ")", ".", "toString", "(", ")", ";", "return", "msg", ";", "}" ]
Internal convenience method that is used to format a message given a pattern and a set of arguments. @param pattern the pattern to format @param args the arguments to use when formatting @return the formatted string
[ "Internal", "convenience", "method", "that", "is", "used", "to", "format", "a", "message", "given", "a", "pattern", "and", "a", "set", "of", "arguments", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridResourceProvider.java#L127-L132
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointImpl.java
HttpEndpointImpl.modified
@Modified protected void modified(Map<String, Object> config) { """ Process new configuration: call updateChains to push out new configuration. @param config """ boolean endpointEnabled = MetatypeUtils.parseBoolean(HttpServiceConstants.ENPOINT_FPID_ALIAS, HttpServiceConstants.ENABLED, config.get(HttpServiceConstants.ENABLED), true); onError = (OnError) config.get(OnErrorUtil.CFG_KEY_ON_ERROR); // Find and resolve host names. host = ((String) config.get("host")).toLowerCase(Locale.ENGLISH); String cfgDefaultHost = ((String) config.get(HttpServiceConstants.DEFAULT_HOSTNAME)).toLowerCase(Locale.ENGLISH); resolvedHostName = resolveHostName(host, cfgDefaultHost); if (resolvedHostName == null) { if (HttpServiceConstants.WILDCARD.equals(host)) { // On some platforms, or if the networking stack is disabled: // getNetworkInterfaces will not be able to return a useful value. // If the wildcard is specified (without a fully qualified value for // the defaultHostName), we have to be able to fall back to localhost // without throwing an error. resolvedHostName = HttpServiceConstants.LOCALHOST; } else { // If the host name was configured to something other than the wildcard, and // that host name value can not be resolved back to a NIC on this machine, // issue an error message. The endpoint will not be started until the // configuration is corrected (the bind would have failed, anyway..) // Z changes to support VIPARANGE and DVIPA. yeah, me neither. // endpointEnabled = false; // Tr.error(tc, "unresolveableHost", host, name); // if (onError == OnError.FAIL) { // shutdownFramework(); // } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "unresolved hostname right now: " + host + "setting resolvedHostName to this host for VIPA"); } resolvedHostName = host; } } //Find and resolve the protocolVersion if has been defined. protocolVersion = (String) config.get("protocolVersion"); httpPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpPort", config.get("httpPort"), -1); httpsPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpsPort", config.get("httpsPort"), -1); String id = (String) config.get("id"); Object cid = config.get("component.id"); // Notification Topics for chain start/stop topicString = HttpServiceConstants.TOPIC_PFX + id + "/" + cid; if (httpPort < 0 && httpsPort < 0) { endpointEnabled = false; Tr.warning(tc, "missingPorts.endpointDisabled", id); } // Store the configuration endpointConfig = config; processHttpChainWork(endpointEnabled, false); }
java
@Modified protected void modified(Map<String, Object> config) { boolean endpointEnabled = MetatypeUtils.parseBoolean(HttpServiceConstants.ENPOINT_FPID_ALIAS, HttpServiceConstants.ENABLED, config.get(HttpServiceConstants.ENABLED), true); onError = (OnError) config.get(OnErrorUtil.CFG_KEY_ON_ERROR); // Find and resolve host names. host = ((String) config.get("host")).toLowerCase(Locale.ENGLISH); String cfgDefaultHost = ((String) config.get(HttpServiceConstants.DEFAULT_HOSTNAME)).toLowerCase(Locale.ENGLISH); resolvedHostName = resolveHostName(host, cfgDefaultHost); if (resolvedHostName == null) { if (HttpServiceConstants.WILDCARD.equals(host)) { // On some platforms, or if the networking stack is disabled: // getNetworkInterfaces will not be able to return a useful value. // If the wildcard is specified (without a fully qualified value for // the defaultHostName), we have to be able to fall back to localhost // without throwing an error. resolvedHostName = HttpServiceConstants.LOCALHOST; } else { // If the host name was configured to something other than the wildcard, and // that host name value can not be resolved back to a NIC on this machine, // issue an error message. The endpoint will not be started until the // configuration is corrected (the bind would have failed, anyway..) // Z changes to support VIPARANGE and DVIPA. yeah, me neither. // endpointEnabled = false; // Tr.error(tc, "unresolveableHost", host, name); // if (onError == OnError.FAIL) { // shutdownFramework(); // } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "unresolved hostname right now: " + host + "setting resolvedHostName to this host for VIPA"); } resolvedHostName = host; } } //Find and resolve the protocolVersion if has been defined. protocolVersion = (String) config.get("protocolVersion"); httpPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpPort", config.get("httpPort"), -1); httpsPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpsPort", config.get("httpsPort"), -1); String id = (String) config.get("id"); Object cid = config.get("component.id"); // Notification Topics for chain start/stop topicString = HttpServiceConstants.TOPIC_PFX + id + "/" + cid; if (httpPort < 0 && httpsPort < 0) { endpointEnabled = false; Tr.warning(tc, "missingPorts.endpointDisabled", id); } // Store the configuration endpointConfig = config; processHttpChainWork(endpointEnabled, false); }
[ "@", "Modified", "protected", "void", "modified", "(", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "boolean", "endpointEnabled", "=", "MetatypeUtils", ".", "parseBoolean", "(", "HttpServiceConstants", ".", "ENPOINT_FPID_ALIAS", ",", "HttpServiceConstants", ".", "ENABLED", ",", "config", ".", "get", "(", "HttpServiceConstants", ".", "ENABLED", ")", ",", "true", ")", ";", "onError", "=", "(", "OnError", ")", "config", ".", "get", "(", "OnErrorUtil", ".", "CFG_KEY_ON_ERROR", ")", ";", "// Find and resolve host names.", "host", "=", "(", "(", "String", ")", "config", ".", "get", "(", "\"host\"", ")", ")", ".", "toLowerCase", "(", "Locale", ".", "ENGLISH", ")", ";", "String", "cfgDefaultHost", "=", "(", "(", "String", ")", "config", ".", "get", "(", "HttpServiceConstants", ".", "DEFAULT_HOSTNAME", ")", ")", ".", "toLowerCase", "(", "Locale", ".", "ENGLISH", ")", ";", "resolvedHostName", "=", "resolveHostName", "(", "host", ",", "cfgDefaultHost", ")", ";", "if", "(", "resolvedHostName", "==", "null", ")", "{", "if", "(", "HttpServiceConstants", ".", "WILDCARD", ".", "equals", "(", "host", ")", ")", "{", "// On some platforms, or if the networking stack is disabled:", "// getNetworkInterfaces will not be able to return a useful value.", "// If the wildcard is specified (without a fully qualified value for", "// the defaultHostName), we have to be able to fall back to localhost", "// without throwing an error.", "resolvedHostName", "=", "HttpServiceConstants", ".", "LOCALHOST", ";", "}", "else", "{", "// If the host name was configured to something other than the wildcard, and", "// that host name value can not be resolved back to a NIC on this machine,", "// issue an error message. The endpoint will not be started until the", "// configuration is corrected (the bind would have failed, anyway..)", "// Z changes to support VIPARANGE and DVIPA. yeah, me neither.", "// endpointEnabled = false;", "// Tr.error(tc, \"unresolveableHost\", host, name);", "// if (onError == OnError.FAIL) {", "// shutdownFramework();", "// }", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "this", ",", "tc", ",", "\"unresolved hostname right now: \"", "+", "host", "+", "\"setting resolvedHostName to this host for VIPA\"", ")", ";", "}", "resolvedHostName", "=", "host", ";", "}", "}", "//Find and resolve the protocolVersion if has been defined.", "protocolVersion", "=", "(", "String", ")", "config", ".", "get", "(", "\"protocolVersion\"", ")", ";", "httpPort", "=", "MetatypeUtils", ".", "parseInteger", "(", "HttpServiceConstants", ".", "ENPOINT_FPID_ALIAS", ",", "\"httpPort\"", ",", "config", ".", "get", "(", "\"httpPort\"", ")", ",", "-", "1", ")", ";", "httpsPort", "=", "MetatypeUtils", ".", "parseInteger", "(", "HttpServiceConstants", ".", "ENPOINT_FPID_ALIAS", ",", "\"httpsPort\"", ",", "config", ".", "get", "(", "\"httpsPort\"", ")", ",", "-", "1", ")", ";", "String", "id", "=", "(", "String", ")", "config", ".", "get", "(", "\"id\"", ")", ";", "Object", "cid", "=", "config", ".", "get", "(", "\"component.id\"", ")", ";", "// Notification Topics for chain start/stop", "topicString", "=", "HttpServiceConstants", ".", "TOPIC_PFX", "+", "id", "+", "\"/\"", "+", "cid", ";", "if", "(", "httpPort", "<", "0", "&&", "httpsPort", "<", "0", ")", "{", "endpointEnabled", "=", "false", ";", "Tr", ".", "warning", "(", "tc", ",", "\"missingPorts.endpointDisabled\"", ",", "id", ")", ";", "}", "// Store the configuration", "endpointConfig", "=", "config", ";", "processHttpChainWork", "(", "endpointEnabled", ",", "false", ")", ";", "}" ]
Process new configuration: call updateChains to push out new configuration. @param config
[ "Process", "new", "configuration", ":", "call", "updateChains", "to", "push", "out", "new", "configuration", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointImpl.java#L270-L336
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/env/Diagnostics.java
Diagnostics.systemInfo
@IgnoreJRERequirement //this method safely checks that the com.sun bean is available before attempting to use its methods public static void systemInfo(final Map<String, Object> infos) { """ Collects system information as delivered from the {@link OperatingSystemMXBean}. @param infos a map where the infos are passed in. """ infos.put("sys.os.name", OS_BEAN.getName()); infos.put("sys.os.version", OS_BEAN.getVersion()); infos.put("sys.os.arch", OS_BEAN.getArch()); infos.put("sys.cpu.num", OS_BEAN.getAvailableProcessors()); infos.put("sys.cpu.loadAvg", OS_BEAN.getSystemLoadAverage()); try { if (OS_BEAN instanceof com.sun.management.OperatingSystemMXBean) { com.sun.management.OperatingSystemMXBean sunBean = (com.sun.management.OperatingSystemMXBean) OS_BEAN; infos.put("proc.cpu.time", sunBean.getProcessCpuTime()); infos.put("mem.physical.total", sunBean.getTotalPhysicalMemorySize()); infos.put("mem.physical.free", sunBean.getFreePhysicalMemorySize()); infos.put("mem.virtual.comitted", sunBean.getCommittedVirtualMemorySize()); infos.put("mem.swap.total", sunBean.getTotalSwapSpaceSize()); infos.put("mem.swap.free", sunBean.getFreeSwapSpaceSize()); } } catch (final Throwable err) { LOGGER.debug("com.sun.management.OperatingSystemMXBean not available, skipping extended system info!"); } }
java
@IgnoreJRERequirement //this method safely checks that the com.sun bean is available before attempting to use its methods public static void systemInfo(final Map<String, Object> infos) { infos.put("sys.os.name", OS_BEAN.getName()); infos.put("sys.os.version", OS_BEAN.getVersion()); infos.put("sys.os.arch", OS_BEAN.getArch()); infos.put("sys.cpu.num", OS_BEAN.getAvailableProcessors()); infos.put("sys.cpu.loadAvg", OS_BEAN.getSystemLoadAverage()); try { if (OS_BEAN instanceof com.sun.management.OperatingSystemMXBean) { com.sun.management.OperatingSystemMXBean sunBean = (com.sun.management.OperatingSystemMXBean) OS_BEAN; infos.put("proc.cpu.time", sunBean.getProcessCpuTime()); infos.put("mem.physical.total", sunBean.getTotalPhysicalMemorySize()); infos.put("mem.physical.free", sunBean.getFreePhysicalMemorySize()); infos.put("mem.virtual.comitted", sunBean.getCommittedVirtualMemorySize()); infos.put("mem.swap.total", sunBean.getTotalSwapSpaceSize()); infos.put("mem.swap.free", sunBean.getFreeSwapSpaceSize()); } } catch (final Throwable err) { LOGGER.debug("com.sun.management.OperatingSystemMXBean not available, skipping extended system info!"); } }
[ "@", "IgnoreJRERequirement", "//this method safely checks that the com.sun bean is available before attempting to use its methods", "public", "static", "void", "systemInfo", "(", "final", "Map", "<", "String", ",", "Object", ">", "infos", ")", "{", "infos", ".", "put", "(", "\"sys.os.name\"", ",", "OS_BEAN", ".", "getName", "(", ")", ")", ";", "infos", ".", "put", "(", "\"sys.os.version\"", ",", "OS_BEAN", ".", "getVersion", "(", ")", ")", ";", "infos", ".", "put", "(", "\"sys.os.arch\"", ",", "OS_BEAN", ".", "getArch", "(", ")", ")", ";", "infos", ".", "put", "(", "\"sys.cpu.num\"", ",", "OS_BEAN", ".", "getAvailableProcessors", "(", ")", ")", ";", "infos", ".", "put", "(", "\"sys.cpu.loadAvg\"", ",", "OS_BEAN", ".", "getSystemLoadAverage", "(", ")", ")", ";", "try", "{", "if", "(", "OS_BEAN", "instanceof", "com", ".", "sun", ".", "management", ".", "OperatingSystemMXBean", ")", "{", "com", ".", "sun", ".", "management", ".", "OperatingSystemMXBean", "sunBean", "=", "(", "com", ".", "sun", ".", "management", ".", "OperatingSystemMXBean", ")", "OS_BEAN", ";", "infos", ".", "put", "(", "\"proc.cpu.time\"", ",", "sunBean", ".", "getProcessCpuTime", "(", ")", ")", ";", "infos", ".", "put", "(", "\"mem.physical.total\"", ",", "sunBean", ".", "getTotalPhysicalMemorySize", "(", ")", ")", ";", "infos", ".", "put", "(", "\"mem.physical.free\"", ",", "sunBean", ".", "getFreePhysicalMemorySize", "(", ")", ")", ";", "infos", ".", "put", "(", "\"mem.virtual.comitted\"", ",", "sunBean", ".", "getCommittedVirtualMemorySize", "(", ")", ")", ";", "infos", ".", "put", "(", "\"mem.swap.total\"", ",", "sunBean", ".", "getTotalSwapSpaceSize", "(", ")", ")", ";", "infos", ".", "put", "(", "\"mem.swap.free\"", ",", "sunBean", ".", "getFreeSwapSpaceSize", "(", ")", ")", ";", "}", "}", "catch", "(", "final", "Throwable", "err", ")", "{", "LOGGER", ".", "debug", "(", "\"com.sun.management.OperatingSystemMXBean not available, skipping extended system info!\"", ")", ";", "}", "}" ]
Collects system information as delivered from the {@link OperatingSystemMXBean}. @param infos a map where the infos are passed in.
[ "Collects", "system", "information", "as", "delivered", "from", "the", "{", "@link", "OperatingSystemMXBean", "}", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L55-L77
javagl/CommonUI
src/main/java/de/javagl/common/ui/GuiUtils.java
GuiUtils.wrapCollapsible
public static CollapsiblePanel wrapCollapsible( String title, JComponent component) { """ Wrap the given component into a {@link CollapsiblePanel} with the given title @param title The title @param component The component @return The panel """ CollapsiblePanel collapsiblePanel = new CollapsiblePanel(new GridLayout(1,1), title); collapsiblePanel.add(component); return collapsiblePanel; }
java
public static CollapsiblePanel wrapCollapsible( String title, JComponent component) { CollapsiblePanel collapsiblePanel = new CollapsiblePanel(new GridLayout(1,1), title); collapsiblePanel.add(component); return collapsiblePanel; }
[ "public", "static", "CollapsiblePanel", "wrapCollapsible", "(", "String", "title", ",", "JComponent", "component", ")", "{", "CollapsiblePanel", "collapsiblePanel", "=", "new", "CollapsiblePanel", "(", "new", "GridLayout", "(", "1", ",", "1", ")", ",", "title", ")", ";", "collapsiblePanel", ".", "add", "(", "component", ")", ";", "return", "collapsiblePanel", ";", "}" ]
Wrap the given component into a {@link CollapsiblePanel} with the given title @param title The title @param component The component @return The panel
[ "Wrap", "the", "given", "component", "into", "a", "{", "@link", "CollapsiblePanel", "}", "with", "the", "given", "title" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/GuiUtils.java#L54-L61
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/LabelParameterVersionResult.java
LabelParameterVersionResult.getInvalidLabels
public java.util.List<String> getInvalidLabels() { """ <p> The label does not meet the requirements. For information about parameter label requirements, see <a href="http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-labels.html">Labeling Parameters</a> in the <i>AWS Systems Manager User Guide</i>. </p> @return The label does not meet the requirements. For information about parameter label requirements, see <a href="http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-labels.html">Labeling Parameters</a> in the <i>AWS Systems Manager User Guide</i>. """ if (invalidLabels == null) { invalidLabels = new com.amazonaws.internal.SdkInternalList<String>(); } return invalidLabels; }
java
public java.util.List<String> getInvalidLabels() { if (invalidLabels == null) { invalidLabels = new com.amazonaws.internal.SdkInternalList<String>(); } return invalidLabels; }
[ "public", "java", ".", "util", ".", "List", "<", "String", ">", "getInvalidLabels", "(", ")", "{", "if", "(", "invalidLabels", "==", "null", ")", "{", "invalidLabels", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "String", ">", "(", ")", ";", "}", "return", "invalidLabels", ";", "}" ]
<p> The label does not meet the requirements. For information about parameter label requirements, see <a href="http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-labels.html">Labeling Parameters</a> in the <i>AWS Systems Manager User Guide</i>. </p> @return The label does not meet the requirements. For information about parameter label requirements, see <a href="http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-labels.html">Labeling Parameters</a> in the <i>AWS Systems Manager User Guide</i>.
[ "<p", ">", "The", "label", "does", "not", "meet", "the", "requirements", ".", "For", "information", "about", "parameter", "label", "requirements", "see", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "systems", "-", "manager", "/", "latest", "/", "userguide", "/", "sysman", "-", "paramstore", "-", "labels", ".", "html", ">", "Labeling", "Parameters<", "/", "a", ">", "in", "the", "<i", ">", "AWS", "Systems", "Manager", "User", "Guide<", "/", "i", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/LabelParameterVersionResult.java#L47-L52
openengsb/openengsb
components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java
ManipulationUtils.getFieldGetter
private static CtMethod getFieldGetter(CtField field, CtClass clazz, boolean failover) throws NotFoundException { """ Returns the getter method in case it exists or returns null if this is not the case. The failover parameter is needed to deal with boolean types, since it should be allowed to allow getters in the form of "isXXX" or "getXXX". """ CtMethod method = new CtMethod(field.getType(), "descCreateMethod", new CtClass[]{}, clazz); String desc = method.getSignature(); String getter = getPropertyGetter(field, failover); try { return clazz.getMethod(getter, desc); } catch (NotFoundException e) { // try once again with getXXX instead of isXXX if (isBooleanType(field)) { return getFieldGetter(field, clazz, true); } LOGGER.debug(String.format("No getter with the name '%s' and the description '%s' found", getter, desc)); return null; } }
java
private static CtMethod getFieldGetter(CtField field, CtClass clazz, boolean failover) throws NotFoundException { CtMethod method = new CtMethod(field.getType(), "descCreateMethod", new CtClass[]{}, clazz); String desc = method.getSignature(); String getter = getPropertyGetter(field, failover); try { return clazz.getMethod(getter, desc); } catch (NotFoundException e) { // try once again with getXXX instead of isXXX if (isBooleanType(field)) { return getFieldGetter(field, clazz, true); } LOGGER.debug(String.format("No getter with the name '%s' and the description '%s' found", getter, desc)); return null; } }
[ "private", "static", "CtMethod", "getFieldGetter", "(", "CtField", "field", ",", "CtClass", "clazz", ",", "boolean", "failover", ")", "throws", "NotFoundException", "{", "CtMethod", "method", "=", "new", "CtMethod", "(", "field", ".", "getType", "(", ")", ",", "\"descCreateMethod\"", ",", "new", "CtClass", "[", "]", "{", "}", ",", "clazz", ")", ";", "String", "desc", "=", "method", ".", "getSignature", "(", ")", ";", "String", "getter", "=", "getPropertyGetter", "(", "field", ",", "failover", ")", ";", "try", "{", "return", "clazz", ".", "getMethod", "(", "getter", ",", "desc", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "// try once again with getXXX instead of isXXX", "if", "(", "isBooleanType", "(", "field", ")", ")", "{", "return", "getFieldGetter", "(", "field", ",", "clazz", ",", "true", ")", ";", "}", "LOGGER", ".", "debug", "(", "String", ".", "format", "(", "\"No getter with the name '%s' and the description '%s' found\"", ",", "getter", ",", "desc", ")", ")", ";", "return", "null", ";", "}", "}" ]
Returns the getter method in case it exists or returns null if this is not the case. The failover parameter is needed to deal with boolean types, since it should be allowed to allow getters in the form of "isXXX" or "getXXX".
[ "Returns", "the", "getter", "method", "in", "case", "it", "exists", "or", "returns", "null", "if", "this", "is", "not", "the", "case", ".", "The", "failover", "parameter", "is", "needed", "to", "deal", "with", "boolean", "types", "since", "it", "should", "be", "allowed", "to", "allow", "getters", "in", "the", "form", "of", "isXXX", "or", "getXXX", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java#L447-L461
rometools/rome
rome/src/main/java/com/rometools/rome/io/SyndFeedOutput.java
SyndFeedOutput.output
public void output(final SyndFeed feed, final Writer writer) throws IOException, FeedException { """ Writes to an Writer the XML representation for the given SyndFeedImpl. <p> If the feed encoding is not NULL, it will be used in the XML prolog encoding attribute. It is the responsibility of the developer to ensure that if the String is written to a character stream the stream charset is the same as the feed encoding property. <p> @param feed Abstract feed to create XML representation from. The type of the SyndFeedImpl must match the type given to the FeedOuptut constructor. @param writer Writer to write the XML representation for the given SyndFeedImpl. @throws IOException thrown if there was some problem writing to the Writer. @throws FeedException thrown if the XML representation for the feed could not be created. """ feedOutput.output(feed.createWireFeed(), writer); }
java
public void output(final SyndFeed feed, final Writer writer) throws IOException, FeedException { feedOutput.output(feed.createWireFeed(), writer); }
[ "public", "void", "output", "(", "final", "SyndFeed", "feed", ",", "final", "Writer", "writer", ")", "throws", "IOException", ",", "FeedException", "{", "feedOutput", ".", "output", "(", "feed", ".", "createWireFeed", "(", ")", ",", "writer", ")", ";", "}" ]
Writes to an Writer the XML representation for the given SyndFeedImpl. <p> If the feed encoding is not NULL, it will be used in the XML prolog encoding attribute. It is the responsibility of the developer to ensure that if the String is written to a character stream the stream charset is the same as the feed encoding property. <p> @param feed Abstract feed to create XML representation from. The type of the SyndFeedImpl must match the type given to the FeedOuptut constructor. @param writer Writer to write the XML representation for the given SyndFeedImpl. @throws IOException thrown if there was some problem writing to the Writer. @throws FeedException thrown if the XML representation for the feed could not be created.
[ "Writes", "to", "an", "Writer", "the", "XML", "representation", "for", "the", "given", "SyndFeedImpl", ".", "<p", ">", "If", "the", "feed", "encoding", "is", "not", "NULL", "it", "will", "be", "used", "in", "the", "XML", "prolog", "encoding", "attribute", ".", "It", "is", "the", "responsibility", "of", "the", "developer", "to", "ensure", "that", "if", "the", "String", "is", "written", "to", "a", "character", "stream", "the", "stream", "charset", "is", "the", "same", "as", "the", "feed", "encoding", "property", ".", "<p", ">" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/SyndFeedOutput.java#L130-L132
joniles/mpxj
src/main/java/net/sf/mpxj/Duration.java
Duration.convertUnits
public static Duration convertUnits(double duration, TimeUnit fromUnits, TimeUnit toUnits, ProjectProperties defaults) { """ This method provides an <i>approximate</i> conversion between duration units. It does take into account the project defaults for number of hours in a day and a week, but it does not take account of calendar details. The results obtained from it should therefore be treated with caution. @param duration duration value @param fromUnits units to convert from @param toUnits units to convert to @param defaults project properties containing default values @return new Duration instance """ return (convertUnits(duration, fromUnits, toUnits, defaults.getMinutesPerDay().doubleValue(), defaults.getMinutesPerWeek().doubleValue(), defaults.getDaysPerMonth().doubleValue())); }
java
public static Duration convertUnits(double duration, TimeUnit fromUnits, TimeUnit toUnits, ProjectProperties defaults) { return (convertUnits(duration, fromUnits, toUnits, defaults.getMinutesPerDay().doubleValue(), defaults.getMinutesPerWeek().doubleValue(), defaults.getDaysPerMonth().doubleValue())); }
[ "public", "static", "Duration", "convertUnits", "(", "double", "duration", ",", "TimeUnit", "fromUnits", ",", "TimeUnit", "toUnits", ",", "ProjectProperties", "defaults", ")", "{", "return", "(", "convertUnits", "(", "duration", ",", "fromUnits", ",", "toUnits", ",", "defaults", ".", "getMinutesPerDay", "(", ")", ".", "doubleValue", "(", ")", ",", "defaults", ".", "getMinutesPerWeek", "(", ")", ".", "doubleValue", "(", ")", ",", "defaults", ".", "getDaysPerMonth", "(", ")", ".", "doubleValue", "(", ")", ")", ")", ";", "}" ]
This method provides an <i>approximate</i> conversion between duration units. It does take into account the project defaults for number of hours in a day and a week, but it does not take account of calendar details. The results obtained from it should therefore be treated with caution. @param duration duration value @param fromUnits units to convert from @param toUnits units to convert to @param defaults project properties containing default values @return new Duration instance
[ "This", "method", "provides", "an", "<i", ">", "approximate<", "/", "i", ">", "conversion", "between", "duration", "units", ".", "It", "does", "take", "into", "account", "the", "project", "defaults", "for", "number", "of", "hours", "in", "a", "day", "and", "a", "week", "but", "it", "does", "not", "take", "account", "of", "calendar", "details", ".", "The", "results", "obtained", "from", "it", "should", "therefore", "be", "treated", "with", "caution", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Duration.java#L109-L112
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/ParameterResolverImpl.java
ParameterResolverImpl.applyOverrideSystemDefault
private void applyOverrideSystemDefault(Map<String, Object> parameterValues) { """ Apply system-wide overrides for default values. @param parameterValues Parameter values """ for (Parameter<?> parameter : allParameters) { Object overrideValue = parameterOverride.getOverrideSystemDefault(parameter); if (overrideValue != null) { parameterValues.put(parameter.getName(), overrideValue); } } }
java
private void applyOverrideSystemDefault(Map<String, Object> parameterValues) { for (Parameter<?> parameter : allParameters) { Object overrideValue = parameterOverride.getOverrideSystemDefault(parameter); if (overrideValue != null) { parameterValues.put(parameter.getName(), overrideValue); } } }
[ "private", "void", "applyOverrideSystemDefault", "(", "Map", "<", "String", ",", "Object", ">", "parameterValues", ")", "{", "for", "(", "Parameter", "<", "?", ">", "parameter", ":", "allParameters", ")", "{", "Object", "overrideValue", "=", "parameterOverride", ".", "getOverrideSystemDefault", "(", "parameter", ")", ";", "if", "(", "overrideValue", "!=", "null", ")", "{", "parameterValues", ".", "put", "(", "parameter", ".", "getName", "(", ")", ",", "overrideValue", ")", ";", "}", "}", "}" ]
Apply system-wide overrides for default values. @param parameterValues Parameter values
[ "Apply", "system", "-", "wide", "overrides", "for", "default", "values", "." ]
train
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/ParameterResolverImpl.java#L150-L157
javagl/ND
nd-arrays/src/main/java/de/javagl/nd/arrays/i/IntArraysND.java
IntArraysND.wrap
public static IntArrayND wrap(IntTuple t, IntTuple size) { """ Creates a <i>view</i> on the given tuple as a {@link IntArrayND}. Changes in the given tuple will be visible in the returned array. @param t The tuple @param size The size of the array @return The view on the tuple @throws NullPointerException If any argument is <code>null</code> @throws IllegalArgumentException If the {@link IntTuple#getSize() size} of the tuple does not match the given array size (that is, the product of all elements of the given tuple). """ Objects.requireNonNull(t, "The tuple is null"); Objects.requireNonNull(size, "The size is null"); int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b); if (t.getSize() != totalSize) { throw new IllegalArgumentException( "The tuple has a size of " + t.getSize() + ", the expected " + "array size is " + size + " (total: " + totalSize + ")"); } return new TupleIntArrayND(t, size); }
java
public static IntArrayND wrap(IntTuple t, IntTuple size) { Objects.requireNonNull(t, "The tuple is null"); Objects.requireNonNull(size, "The size is null"); int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b); if (t.getSize() != totalSize) { throw new IllegalArgumentException( "The tuple has a size of " + t.getSize() + ", the expected " + "array size is " + size + " (total: " + totalSize + ")"); } return new TupleIntArrayND(t, size); }
[ "public", "static", "IntArrayND", "wrap", "(", "IntTuple", "t", ",", "IntTuple", "size", ")", "{", "Objects", ".", "requireNonNull", "(", "t", ",", "\"The tuple is null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "size", ",", "\"The size is null\"", ")", ";", "int", "totalSize", "=", "IntTupleFunctions", ".", "reduce", "(", "size", ",", "1", ",", "(", "a", ",", "b", ")", "->", "a", "*", "b", ")", ";", "if", "(", "t", ".", "getSize", "(", ")", "!=", "totalSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The tuple has a size of \"", "+", "t", ".", "getSize", "(", ")", "+", "\", the expected \"", "+", "\"array size is \"", "+", "size", "+", "\" (total: \"", "+", "totalSize", "+", "\")\"", ")", ";", "}", "return", "new", "TupleIntArrayND", "(", "t", ",", "size", ")", ";", "}" ]
Creates a <i>view</i> on the given tuple as a {@link IntArrayND}. Changes in the given tuple will be visible in the returned array. @param t The tuple @param size The size of the array @return The view on the tuple @throws NullPointerException If any argument is <code>null</code> @throws IllegalArgumentException If the {@link IntTuple#getSize() size} of the tuple does not match the given array size (that is, the product of all elements of the given tuple).
[ "Creates", "a", "<i", ">", "view<", "/", "i", ">", "on", "the", "given", "tuple", "as", "a", "{", "@link", "IntArrayND", "}", ".", "Changes", "in", "the", "given", "tuple", "will", "be", "visible", "in", "the", "returned", "array", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-arrays/src/main/java/de/javagl/nd/arrays/i/IntArraysND.java#L110-L122
riversun/string-grabber
src/main/java/org/riversun/string_grabber/StringGrabber.java
StringGrabber.getStringEnclosedIn
public StringGrabberList getStringEnclosedIn(String startToken, String endToken) { """ returns all of discovery that enclosed in specific tokens found in the source string @param startToken @param endToken @return """ return new StringGrabberList(getCropper().getStringEnclosedIn(sb.toString(), startToken, endToken)); }
java
public StringGrabberList getStringEnclosedIn(String startToken, String endToken) { return new StringGrabberList(getCropper().getStringEnclosedIn(sb.toString(), startToken, endToken)); }
[ "public", "StringGrabberList", "getStringEnclosedIn", "(", "String", "startToken", ",", "String", "endToken", ")", "{", "return", "new", "StringGrabberList", "(", "getCropper", "(", ")", ".", "getStringEnclosedIn", "(", "sb", ".", "toString", "(", ")", ",", "startToken", ",", "endToken", ")", ")", ";", "}" ]
returns all of discovery that enclosed in specific tokens found in the source string @param startToken @param endToken @return
[ "returns", "all", "of", "discovery", "that", "enclosed", "in", "specific", "tokens", "found", "in", "the", "source", "string" ]
train
https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringGrabber.java#L659-L661
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/SecurityActions.java
SecurityActions.setSystemProperty
static void setSystemProperty(final String name, final String value) { """ Set a system property @param name The property name @param value The property value """ AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { System.setProperty(name, value); return null; } }); }
java
static void setSystemProperty(final String name, final String value) { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { System.setProperty(name, value); return null; } }); }
[ "static", "void", "setSystemProperty", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "Object", ">", "(", ")", "{", "public", "Object", "run", "(", ")", "{", "System", ".", "setProperty", "(", "name", ",", "value", ")", ";", "return", "null", ";", "}", "}", ")", ";", "}" ]
Set a system property @param name The property name @param value The property value
[ "Set", "a", "system", "property" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/SecurityActions.java#L110-L120
VoltDB/voltdb
src/frontend/org/voltdb/client/exampleutils/ClientConnection.java
ClientConnection.updateApplicationCatalog
public ClientResponse updateApplicationCatalog(File catalogPath, File deploymentPath) throws IOException, NoConnectionsException, ProcCallException { """ Synchronously invokes UpdateApplicationCatalog procedure. Blocks until a result is available. A {@link ProcCallException} is thrown if the response is anything other then success. @param catalogPath Path to the catalog jar file. @param deploymentPath Path to the deployment file @return array of VoltTable results @throws IOException If the files cannot be serialized @throws NoConnectionException @throws ProcCallException """ return Client.updateApplicationCatalog(catalogPath, deploymentPath); }
java
public ClientResponse updateApplicationCatalog(File catalogPath, File deploymentPath) throws IOException, NoConnectionsException, ProcCallException { return Client.updateApplicationCatalog(catalogPath, deploymentPath); }
[ "public", "ClientResponse", "updateApplicationCatalog", "(", "File", "catalogPath", ",", "File", "deploymentPath", ")", "throws", "IOException", ",", "NoConnectionsException", ",", "ProcCallException", "{", "return", "Client", ".", "updateApplicationCatalog", "(", "catalogPath", ",", "deploymentPath", ")", ";", "}" ]
Synchronously invokes UpdateApplicationCatalog procedure. Blocks until a result is available. A {@link ProcCallException} is thrown if the response is anything other then success. @param catalogPath Path to the catalog jar file. @param deploymentPath Path to the deployment file @return array of VoltTable results @throws IOException If the files cannot be serialized @throws NoConnectionException @throws ProcCallException
[ "Synchronously", "invokes", "UpdateApplicationCatalog", "procedure", ".", "Blocks", "until", "a", "result", "is", "available", ".", "A", "{", "@link", "ProcCallException", "}", "is", "thrown", "if", "the", "response", "is", "anything", "other", "then", "success", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/exampleutils/ClientConnection.java#L331-L335
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_virtualMac_macAddress_virtualAddress_POST
public OvhTask serviceName_virtualMac_macAddress_virtualAddress_POST(String serviceName, String macAddress, String ipAddress, String virtualMachineName) throws IOException { """ Add an IP to this Virtual MAC REST: POST /dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress @param virtualMachineName [required] Friendly name of your Virtual Machine behind this IP/MAC @param ipAddress [required] IP address to link to this virtual MAC @param serviceName [required] The internal name of your dedicated server @param macAddress [required] Virtual MAC address in 00:00:00:00:00:00 format """ String qPath = "/dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress"; StringBuilder sb = path(qPath, serviceName, macAddress); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ipAddress", ipAddress); addBody(o, "virtualMachineName", virtualMachineName); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_virtualMac_macAddress_virtualAddress_POST(String serviceName, String macAddress, String ipAddress, String virtualMachineName) throws IOException { String qPath = "/dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress"; StringBuilder sb = path(qPath, serviceName, macAddress); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ipAddress", ipAddress); addBody(o, "virtualMachineName", virtualMachineName); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_virtualMac_macAddress_virtualAddress_POST", "(", "String", "serviceName", ",", "String", "macAddress", ",", "String", "ipAddress", ",", "String", "virtualMachineName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "macAddress", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"ipAddress\"", ",", "ipAddress", ")", ";", "addBody", "(", "o", ",", "\"virtualMachineName\"", ",", "virtualMachineName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Add an IP to this Virtual MAC REST: POST /dedicated/server/{serviceName}/virtualMac/{macAddress}/virtualAddress @param virtualMachineName [required] Friendly name of your Virtual Machine behind this IP/MAC @param ipAddress [required] IP address to link to this virtual MAC @param serviceName [required] The internal name of your dedicated server @param macAddress [required] Virtual MAC address in 00:00:00:00:00:00 format
[ "Add", "an", "IP", "to", "this", "Virtual", "MAC" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L619-L627
alkacon/opencms-core
src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java
CmsGwtDialogExtension.openInfoDialog
public void openInfoDialog(CmsResource resource, String startTab) { """ Opens the resource info dialog.<p> @param resource the resource @param startTab the start tab id """ getRpcProxy(I_CmsGwtDialogClientRpc.class).openInfoDialog(resource.getStructureId().toString(), startTab); }
java
public void openInfoDialog(CmsResource resource, String startTab) { getRpcProxy(I_CmsGwtDialogClientRpc.class).openInfoDialog(resource.getStructureId().toString(), startTab); }
[ "public", "void", "openInfoDialog", "(", "CmsResource", "resource", ",", "String", "startTab", ")", "{", "getRpcProxy", "(", "I_CmsGwtDialogClientRpc", ".", "class", ")", ".", "openInfoDialog", "(", "resource", ".", "getStructureId", "(", ")", ".", "toString", "(", ")", ",", "startTab", ")", ";", "}" ]
Opens the resource info dialog.<p> @param resource the resource @param startTab the start tab id
[ "Opens", "the", "resource", "info", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java#L193-L196
SpartaTech/sparta-spring-web-utils
src/main/java/org/sparta/springwebutils/SpringContextUtils.java
SpringContextUtils.contextMergedBeans
public static ApplicationContext contextMergedBeans(String xmlPath, Map<String, ?> extraBeans) { """ Loads a context from a XML and inject all objects in the Map @param xmlPath Path for the xml applicationContext @param extraBeans Extra beans for being injected @return ApplicationContext generated """ final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans); //loads the xml and add definitions in the context GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(parentContext); xmlReader.loadBeanDefinitions(xmlPath); //refreshed the context to create class and make autowires parentContext.refresh(); //return the created context return parentContext; }
java
public static ApplicationContext contextMergedBeans(String xmlPath, Map<String, ?> extraBeans) { final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans); //loads the xml and add definitions in the context GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(parentContext); xmlReader.loadBeanDefinitions(xmlPath); //refreshed the context to create class and make autowires parentContext.refresh(); //return the created context return parentContext; }
[ "public", "static", "ApplicationContext", "contextMergedBeans", "(", "String", "xmlPath", ",", "Map", "<", "String", ",", "?", ">", "extraBeans", ")", "{", "final", "DefaultListableBeanFactory", "parentBeanFactory", "=", "buildListableBeanFactory", "(", "extraBeans", ")", ";", "//loads the xml and add definitions in the context", "GenericApplicationContext", "parentContext", "=", "new", "GenericApplicationContext", "(", "parentBeanFactory", ")", ";", "XmlBeanDefinitionReader", "xmlReader", "=", "new", "XmlBeanDefinitionReader", "(", "parentContext", ")", ";", "xmlReader", ".", "loadBeanDefinitions", "(", "xmlPath", ")", ";", "//refreshed the context to create class and make autowires", "parentContext", ".", "refresh", "(", ")", ";", "//return the created context", "return", "parentContext", ";", "}" ]
Loads a context from a XML and inject all objects in the Map @param xmlPath Path for the xml applicationContext @param extraBeans Extra beans for being injected @return ApplicationContext generated
[ "Loads", "a", "context", "from", "a", "XML", "and", "inject", "all", "objects", "in", "the", "Map" ]
train
https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L31-L44
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
StylesheetHandler.stackContains
private boolean stackContains(Stack stack, String url) { """ Utility function to see if the stack contains the given URL. @param stack non-null reference to a Stack. @param url URL string on which an equality test will be performed. @return true if the stack contains the url argument. """ int n = stack.size(); boolean contains = false; for (int i = 0; i < n; i++) { String url2 = (String) stack.elementAt(i); if (url2.equals(url)) { contains = true; break; } } return contains; }
java
private boolean stackContains(Stack stack, String url) { int n = stack.size(); boolean contains = false; for (int i = 0; i < n; i++) { String url2 = (String) stack.elementAt(i); if (url2.equals(url)) { contains = true; break; } } return contains; }
[ "private", "boolean", "stackContains", "(", "Stack", "stack", ",", "String", "url", ")", "{", "int", "n", "=", "stack", ".", "size", "(", ")", ";", "boolean", "contains", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "String", "url2", "=", "(", "String", ")", "stack", ".", "elementAt", "(", "i", ")", ";", "if", "(", "url2", ".", "equals", "(", "url", ")", ")", "{", "contains", "=", "true", ";", "break", ";", "}", "}", "return", "contains", ";", "}" ]
Utility function to see if the stack contains the given URL. @param stack non-null reference to a Stack. @param url URL string on which an equality test will be performed. @return true if the stack contains the url argument.
[ "Utility", "function", "to", "see", "if", "the", "stack", "contains", "the", "given", "URL", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L226-L245
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeListType
protected static boolean writeListType(Output out, Object listType) { """ Writes Lists out as a data type @param out Output write @param listType List type @return boolean true if object was successfully serialized, false otherwise """ log.trace("writeListType"); if (listType instanceof List<?>) { writeList(out, (List<?>) listType); } else { return false; } return true; }
java
protected static boolean writeListType(Output out, Object listType) { log.trace("writeListType"); if (listType instanceof List<?>) { writeList(out, (List<?>) listType); } else { return false; } return true; }
[ "protected", "static", "boolean", "writeListType", "(", "Output", "out", ",", "Object", "listType", ")", "{", "log", ".", "trace", "(", "\"writeListType\"", ")", ";", "if", "(", "listType", "instanceof", "List", "<", "?", ">", ")", "{", "writeList", "(", "out", ",", "(", "List", "<", "?", ">", ")", "listType", ")", ";", "}", "else", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Writes Lists out as a data type @param out Output write @param listType List type @return boolean true if object was successfully serialized, false otherwise
[ "Writes", "Lists", "out", "as", "a", "data", "type" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L200-L208
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java
SqlGeneratorDefaultImpl.getPreparedSelectByPkStatement
public SelectStatement getPreparedSelectByPkStatement(ClassDescriptor cld) { """ generate a prepared SELECT-Statement for the Class described by cld @param cld the ClassDescriptor """ SelectStatement sql; SqlForClass sfc = getSqlForClass(cld); sql = sfc.getSelectByPKSql(); if(sql == null) { sql = new SqlSelectByPkStatement(m_platform, cld, logger); // set the sql string sfc.setSelectByPKSql(sql); if(logger.isDebugEnabled()) { logger.debug("SQL:" + sql.getStatement()); } } return sql; }
java
public SelectStatement getPreparedSelectByPkStatement(ClassDescriptor cld) { SelectStatement sql; SqlForClass sfc = getSqlForClass(cld); sql = sfc.getSelectByPKSql(); if(sql == null) { sql = new SqlSelectByPkStatement(m_platform, cld, logger); // set the sql string sfc.setSelectByPKSql(sql); if(logger.isDebugEnabled()) { logger.debug("SQL:" + sql.getStatement()); } } return sql; }
[ "public", "SelectStatement", "getPreparedSelectByPkStatement", "(", "ClassDescriptor", "cld", ")", "{", "SelectStatement", "sql", ";", "SqlForClass", "sfc", "=", "getSqlForClass", "(", "cld", ")", ";", "sql", "=", "sfc", ".", "getSelectByPKSql", "(", ")", ";", "if", "(", "sql", "==", "null", ")", "{", "sql", "=", "new", "SqlSelectByPkStatement", "(", "m_platform", ",", "cld", ",", "logger", ")", ";", "// set the sql string\r", "sfc", ".", "setSelectByPKSql", "(", "sql", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"SQL:\"", "+", "sql", ".", "getStatement", "(", ")", ")", ";", "}", "}", "return", "sql", ";", "}" ]
generate a prepared SELECT-Statement for the Class described by cld @param cld the ClassDescriptor
[ "generate", "a", "prepared", "SELECT", "-", "Statement", "for", "the", "Class", "described", "by", "cld" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L141-L159
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.asFileURL
public URL asFileURL() throws MalformedURLException { """ Get file's URL as a file. There will be no trailing {@code "/"} character unless this {@code VirtualFile} represents a root. @return the url @throws MalformedURLException if the URL is somehow malformed """ return new URL(VFSUtils.VFS_PROTOCOL, "", -1, getPathName(false), VFSUtils.VFS_URL_HANDLER); }
java
public URL asFileURL() throws MalformedURLException { return new URL(VFSUtils.VFS_PROTOCOL, "", -1, getPathName(false), VFSUtils.VFS_URL_HANDLER); }
[ "public", "URL", "asFileURL", "(", ")", "throws", "MalformedURLException", "{", "return", "new", "URL", "(", "VFSUtils", ".", "VFS_PROTOCOL", ",", "\"\"", ",", "-", "1", ",", "getPathName", "(", "false", ")", ",", "VFSUtils", ".", "VFS_URL_HANDLER", ")", ";", "}" ]
Get file's URL as a file. There will be no trailing {@code "/"} character unless this {@code VirtualFile} represents a root. @return the url @throws MalformedURLException if the URL is somehow malformed
[ "Get", "file", "s", "URL", "as", "a", "file", ".", "There", "will", "be", "no", "trailing", "{", "@code", "/", "}", "character", "unless", "this", "{", "@code", "VirtualFile", "}", "represents", "a", "root", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L570-L572
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteFetcher.java
RouteFetcher.buildRequestFrom
@Nullable public NavigationRoute.Builder buildRequestFrom(Location location, RouteProgress routeProgress) { """ Build a route request given the passed {@link Location} and {@link RouteProgress}. <p> Uses {@link RouteOptions#coordinates()} and {@link RouteProgress#remainingWaypoints()} to determine the amount of remaining waypoints there are along the given route. @param location current location of the device @param routeProgress for remaining waypoints along the route @return request reflecting the current progress """ Context context = contextWeakReference.get(); if (invalid(context, location, routeProgress)) { return null; } Point origin = Point.fromLngLat(location.getLongitude(), location.getLatitude()); Double bearing = location.hasBearing() ? Float.valueOf(location.getBearing()).doubleValue() : null; RouteOptions options = routeProgress.directionsRoute().routeOptions(); NavigationRoute.Builder builder = NavigationRoute.builder(context) .accessToken(accessToken) .origin(origin, bearing, BEARING_TOLERANCE) .routeOptions(options); List<Point> remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); if (remainingWaypoints == null) { Timber.e("An error occurred fetching a new route"); return null; } addDestination(remainingWaypoints, builder); addWaypoints(remainingWaypoints, builder); addWaypointNames(routeProgress, builder); addApproaches(routeProgress, builder); return builder; }
java
@Nullable public NavigationRoute.Builder buildRequestFrom(Location location, RouteProgress routeProgress) { Context context = contextWeakReference.get(); if (invalid(context, location, routeProgress)) { return null; } Point origin = Point.fromLngLat(location.getLongitude(), location.getLatitude()); Double bearing = location.hasBearing() ? Float.valueOf(location.getBearing()).doubleValue() : null; RouteOptions options = routeProgress.directionsRoute().routeOptions(); NavigationRoute.Builder builder = NavigationRoute.builder(context) .accessToken(accessToken) .origin(origin, bearing, BEARING_TOLERANCE) .routeOptions(options); List<Point> remainingWaypoints = routeUtils.calculateRemainingWaypoints(routeProgress); if (remainingWaypoints == null) { Timber.e("An error occurred fetching a new route"); return null; } addDestination(remainingWaypoints, builder); addWaypoints(remainingWaypoints, builder); addWaypointNames(routeProgress, builder); addApproaches(routeProgress, builder); return builder; }
[ "@", "Nullable", "public", "NavigationRoute", ".", "Builder", "buildRequestFrom", "(", "Location", "location", ",", "RouteProgress", "routeProgress", ")", "{", "Context", "context", "=", "contextWeakReference", ".", "get", "(", ")", ";", "if", "(", "invalid", "(", "context", ",", "location", ",", "routeProgress", ")", ")", "{", "return", "null", ";", "}", "Point", "origin", "=", "Point", ".", "fromLngLat", "(", "location", ".", "getLongitude", "(", ")", ",", "location", ".", "getLatitude", "(", ")", ")", ";", "Double", "bearing", "=", "location", ".", "hasBearing", "(", ")", "?", "Float", ".", "valueOf", "(", "location", ".", "getBearing", "(", ")", ")", ".", "doubleValue", "(", ")", ":", "null", ";", "RouteOptions", "options", "=", "routeProgress", ".", "directionsRoute", "(", ")", ".", "routeOptions", "(", ")", ";", "NavigationRoute", ".", "Builder", "builder", "=", "NavigationRoute", ".", "builder", "(", "context", ")", ".", "accessToken", "(", "accessToken", ")", ".", "origin", "(", "origin", ",", "bearing", ",", "BEARING_TOLERANCE", ")", ".", "routeOptions", "(", "options", ")", ";", "List", "<", "Point", ">", "remainingWaypoints", "=", "routeUtils", ".", "calculateRemainingWaypoints", "(", "routeProgress", ")", ";", "if", "(", "remainingWaypoints", "==", "null", ")", "{", "Timber", ".", "e", "(", "\"An error occurred fetching a new route\"", ")", ";", "return", "null", ";", "}", "addDestination", "(", "remainingWaypoints", ",", "builder", ")", ";", "addWaypoints", "(", "remainingWaypoints", ",", "builder", ")", ";", "addWaypointNames", "(", "routeProgress", ",", "builder", ")", ";", "addApproaches", "(", "routeProgress", ",", "builder", ")", ";", "return", "builder", ";", "}" ]
Build a route request given the passed {@link Location} and {@link RouteProgress}. <p> Uses {@link RouteOptions#coordinates()} and {@link RouteProgress#remainingWaypoints()} to determine the amount of remaining waypoints there are along the given route. @param location current location of the device @param routeProgress for remaining waypoints along the route @return request reflecting the current progress
[ "Build", "a", "route", "request", "given", "the", "passed", "{", "@link", "Location", "}", "and", "{", "@link", "RouteProgress", "}", ".", "<p", ">", "Uses", "{", "@link", "RouteOptions#coordinates", "()", "}", "and", "{", "@link", "RouteProgress#remainingWaypoints", "()", "}", "to", "determine", "the", "amount", "of", "remaining", "waypoints", "there", "are", "along", "the", "given", "route", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/route/RouteFetcher.java#L114-L138
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TableHeaderRendererPainter.java
TableHeaderRendererPainter.getTableHeaderInteriorPaint
public Paint getTableHeaderInteriorPaint(Shape s, CommonControlState type, boolean isSorted) { """ DOCUMENT ME! @param s DOCUMENT ME! @param type DOCUMENT ME! @param isSorted DOCUMENT ME! @return DOCUMENT ME! """ return getCommonInteriorPaint(s, type); // FourColors colors = getTableHeaderColors(type, isSorted); // return createVerticalGradient(s, colors); }
java
public Paint getTableHeaderInteriorPaint(Shape s, CommonControlState type, boolean isSorted) { return getCommonInteriorPaint(s, type); // FourColors colors = getTableHeaderColors(type, isSorted); // return createVerticalGradient(s, colors); }
[ "public", "Paint", "getTableHeaderInteriorPaint", "(", "Shape", "s", ",", "CommonControlState", "type", ",", "boolean", "isSorted", ")", "{", "return", "getCommonInteriorPaint", "(", "s", ",", "type", ")", ";", "// FourColors colors = getTableHeaderColors(type, isSorted);", "// return createVerticalGradient(s, colors);", "}" ]
DOCUMENT ME! @param s DOCUMENT ME! @param type DOCUMENT ME! @param isSorted DOCUMENT ME! @return DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TableHeaderRendererPainter.java#L159-L163
ops4j/org.ops4j.pax.logging
pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java
ReusableLogEventFactory.createEvent
@Override public LogEvent createEvent(final String loggerName, final Marker marker, final String fqcn, final Level level, final Message message, final List<Property> properties, final Throwable t) { """ Creates a log event. @param loggerName The name of the Logger. @param marker An optional Marker. @param fqcn The fully qualified class name of the caller. @param level The event Level. @param message The Message. @param properties Properties to be added to the log event. @param t An optional Throwable. @return The LogEvent. """ WeakReference<MutableLogEvent> refResult = mutableLogEventThreadLocal.get(); MutableLogEvent result = refResult == null ? null : refResult.get(); if (result == null || result.reserved) { final boolean initThreadLocal = result == null; result = new MutableLogEvent(); // usually no need to re-initialize thread-specific fields since the event is stored in a ThreadLocal result.setThreadId(Thread.currentThread().getId()); result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call result.setThreadPriority(Thread.currentThread().getPriority()); if (initThreadLocal) { refResult = new WeakReference<>(result); mutableLogEventThreadLocal.set(refResult); } } result.reserved = true; result.clear(); // ensure any previously cached values (thrownProxy, source, etc.) are cleared result.setLoggerName(loggerName); result.setMarker(marker); result.setLoggerFqcn(fqcn); result.setLevel(level == null ? Level.OFF : level); result.setMessage(message); result.setThrown(t); result.setContextData(injector.injectContextData(properties, (StringMap) result.getContextData())); result.setContextStack(ThreadContext.getDepth() == 0 ? ThreadContext.EMPTY_STACK : ThreadContext.cloneStack());// mutable copy result.setTimeMillis(message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : CLOCK.currentTimeMillis()); result.setNanoTime(Log4jLogEvent.getNanoClock().nanoTime()); if (THREAD_NAME_CACHING_STRATEGY == ThreadNameCachingStrategy.UNCACHED) { result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call result.setThreadPriority(Thread.currentThread().getPriority()); } return result; }
java
@Override public LogEvent createEvent(final String loggerName, final Marker marker, final String fqcn, final Level level, final Message message, final List<Property> properties, final Throwable t) { WeakReference<MutableLogEvent> refResult = mutableLogEventThreadLocal.get(); MutableLogEvent result = refResult == null ? null : refResult.get(); if (result == null || result.reserved) { final boolean initThreadLocal = result == null; result = new MutableLogEvent(); // usually no need to re-initialize thread-specific fields since the event is stored in a ThreadLocal result.setThreadId(Thread.currentThread().getId()); result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call result.setThreadPriority(Thread.currentThread().getPriority()); if (initThreadLocal) { refResult = new WeakReference<>(result); mutableLogEventThreadLocal.set(refResult); } } result.reserved = true; result.clear(); // ensure any previously cached values (thrownProxy, source, etc.) are cleared result.setLoggerName(loggerName); result.setMarker(marker); result.setLoggerFqcn(fqcn); result.setLevel(level == null ? Level.OFF : level); result.setMessage(message); result.setThrown(t); result.setContextData(injector.injectContextData(properties, (StringMap) result.getContextData())); result.setContextStack(ThreadContext.getDepth() == 0 ? ThreadContext.EMPTY_STACK : ThreadContext.cloneStack());// mutable copy result.setTimeMillis(message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : CLOCK.currentTimeMillis()); result.setNanoTime(Log4jLogEvent.getNanoClock().nanoTime()); if (THREAD_NAME_CACHING_STRATEGY == ThreadNameCachingStrategy.UNCACHED) { result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call result.setThreadPriority(Thread.currentThread().getPriority()); } return result; }
[ "@", "Override", "public", "LogEvent", "createEvent", "(", "final", "String", "loggerName", ",", "final", "Marker", "marker", ",", "final", "String", "fqcn", ",", "final", "Level", "level", ",", "final", "Message", "message", ",", "final", "List", "<", "Property", ">", "properties", ",", "final", "Throwable", "t", ")", "{", "WeakReference", "<", "MutableLogEvent", ">", "refResult", "=", "mutableLogEventThreadLocal", ".", "get", "(", ")", ";", "MutableLogEvent", "result", "=", "refResult", "==", "null", "?", "null", ":", "refResult", ".", "get", "(", ")", ";", "if", "(", "result", "==", "null", "||", "result", ".", "reserved", ")", "{", "final", "boolean", "initThreadLocal", "=", "result", "==", "null", ";", "result", "=", "new", "MutableLogEvent", "(", ")", ";", "// usually no need to re-initialize thread-specific fields since the event is stored in a ThreadLocal", "result", ".", "setThreadId", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ")", ";", "result", ".", "setThreadName", "(", "Thread", ".", "currentThread", "(", ")", ".", "getName", "(", ")", ")", ";", "// Thread.getName() allocates Objects on each call", "result", ".", "setThreadPriority", "(", "Thread", ".", "currentThread", "(", ")", ".", "getPriority", "(", ")", ")", ";", "if", "(", "initThreadLocal", ")", "{", "refResult", "=", "new", "WeakReference", "<>", "(", "result", ")", ";", "mutableLogEventThreadLocal", ".", "set", "(", "refResult", ")", ";", "}", "}", "result", ".", "reserved", "=", "true", ";", "result", ".", "clear", "(", ")", ";", "// ensure any previously cached values (thrownProxy, source, etc.) are cleared", "result", ".", "setLoggerName", "(", "loggerName", ")", ";", "result", ".", "setMarker", "(", "marker", ")", ";", "result", ".", "setLoggerFqcn", "(", "fqcn", ")", ";", "result", ".", "setLevel", "(", "level", "==", "null", "?", "Level", ".", "OFF", ":", "level", ")", ";", "result", ".", "setMessage", "(", "message", ")", ";", "result", ".", "setThrown", "(", "t", ")", ";", "result", ".", "setContextData", "(", "injector", ".", "injectContextData", "(", "properties", ",", "(", "StringMap", ")", "result", ".", "getContextData", "(", ")", ")", ")", ";", "result", ".", "setContextStack", "(", "ThreadContext", ".", "getDepth", "(", ")", "==", "0", "?", "ThreadContext", ".", "EMPTY_STACK", ":", "ThreadContext", ".", "cloneStack", "(", ")", ")", ";", "// mutable copy", "result", ".", "setTimeMillis", "(", "message", "instanceof", "TimestampMessage", "?", "(", "(", "TimestampMessage", ")", "message", ")", ".", "getTimestamp", "(", ")", ":", "CLOCK", ".", "currentTimeMillis", "(", ")", ")", ";", "result", ".", "setNanoTime", "(", "Log4jLogEvent", ".", "getNanoClock", "(", ")", ".", "nanoTime", "(", ")", ")", ";", "if", "(", "THREAD_NAME_CACHING_STRATEGY", "==", "ThreadNameCachingStrategy", ".", "UNCACHED", ")", "{", "result", ".", "setThreadName", "(", "Thread", ".", "currentThread", "(", ")", ".", "getName", "(", ")", ")", ";", "// Thread.getName() allocates Objects on each call", "result", ".", "setThreadPriority", "(", "Thread", ".", "currentThread", "(", ")", ".", "getPriority", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Creates a log event. @param loggerName The name of the Logger. @param marker An optional Marker. @param fqcn The fully qualified class name of the caller. @param level The event Level. @param message The Message. @param properties Properties to be added to the log event. @param t An optional Throwable. @return The LogEvent.
[ "Creates", "a", "log", "event", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java#L58-L98
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.csvLines
static List<String> csvLines(Reader reader) { """ Divides the whole text into lines. @param reader the source of text @return the lines """ // This needs to handle quoted text that spans multiple lines, // so we divide the full text into chunks that correspond to // a single csv line try { BufferedReader br = new BufferedReader(reader); List<String> lines = new ArrayList<>(); // The current line read from the Reader String line; // The full csv line that may span multiple lines String longLine = null; while ((line = br.readLine()) != null) { // If we have a line from the previous iteration, // we concatenate it if (longLine == null) { longLine = line; } else { longLine = longLine.concat("\n").concat(line); } // Count the number of quotes: if it's even, the csv line // must end here. If not, it will continue to the next if (isEvenQuotes(longLine)) { lines.add(longLine); longLine = null; } } // If there is text leftover, the line was not closed propertly. // XXX: we need to figure out how to handle errors like this if (longLine != null) { lines.add(longLine); } return lines; } catch(IOException ex) { throw new RuntimeException("Couldn't process data", ex); } }
java
static List<String> csvLines(Reader reader) { // This needs to handle quoted text that spans multiple lines, // so we divide the full text into chunks that correspond to // a single csv line try { BufferedReader br = new BufferedReader(reader); List<String> lines = new ArrayList<>(); // The current line read from the Reader String line; // The full csv line that may span multiple lines String longLine = null; while ((line = br.readLine()) != null) { // If we have a line from the previous iteration, // we concatenate it if (longLine == null) { longLine = line; } else { longLine = longLine.concat("\n").concat(line); } // Count the number of quotes: if it's even, the csv line // must end here. If not, it will continue to the next if (isEvenQuotes(longLine)) { lines.add(longLine); longLine = null; } } // If there is text leftover, the line was not closed propertly. // XXX: we need to figure out how to handle errors like this if (longLine != null) { lines.add(longLine); } return lines; } catch(IOException ex) { throw new RuntimeException("Couldn't process data", ex); } }
[ "static", "List", "<", "String", ">", "csvLines", "(", "Reader", "reader", ")", "{", "// This needs to handle quoted text that spans multiple lines,\r", "// so we divide the full text into chunks that correspond to\r", "// a single csv line\r", "try", "{", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "reader", ")", ";", "List", "<", "String", ">", "lines", "=", "new", "ArrayList", "<>", "(", ")", ";", "// The current line read from the Reader\r", "String", "line", ";", "// The full csv line that may span multiple lines\r", "String", "longLine", "=", "null", ";", "while", "(", "(", "line", "=", "br", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "// If we have a line from the previous iteration,\r", "// we concatenate it\r", "if", "(", "longLine", "==", "null", ")", "{", "longLine", "=", "line", ";", "}", "else", "{", "longLine", "=", "longLine", ".", "concat", "(", "\"\\n\"", ")", ".", "concat", "(", "line", ")", ";", "}", "// Count the number of quotes: if it's even, the csv line\r", "// must end here. If not, it will continue to the next\r", "if", "(", "isEvenQuotes", "(", "longLine", ")", ")", "{", "lines", ".", "add", "(", "longLine", ")", ";", "longLine", "=", "null", ";", "}", "}", "// If there is text leftover, the line was not closed propertly.\r", "// XXX: we need to figure out how to handle errors like this\r", "if", "(", "longLine", "!=", "null", ")", "{", "lines", ".", "add", "(", "longLine", ")", ";", "}", "return", "lines", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Couldn't process data\"", ",", "ex", ")", ";", "}", "}" ]
Divides the whole text into lines. @param reader the source of text @return the lines
[ "Divides", "the", "whole", "text", "into", "lines", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L296-L331
csc19601128/Phynixx
phynixx/phynixx-xa/src/main/java/org/csc/phynixx/xa/PhynixxXAResource.java
PhynixxXAResource.conditionViolated
public void conditionViolated() { """ called when the current XAresource is expired (time out occurred) The current Impl. does nothing but marked the associated TX as rollback only The underlying core connection are not treated .... There are two different situation that have to be handled If the connection expires because of a long running method call the connection isn't treated and the XAResource is marked as rollback only. The rollback is done by the Transactionmanager. If the TX expires because the Transactionmanagers doesn't answer, the underlying connection is rolledback and the XAResource is marked as rollback only (N.B. rolling back the connection marks the XAResource as heuristically rolled back) """ try { if (this.xaConnection != null) { XATransactionalBranch<C> transactionalBranch = this.xaConnection.toGlobalTransactionBranch(); if (transactionalBranch != null) { transactionalBranch.setRollbackOnly(true); } } if (LOG.isInfoEnabled()) { String logString = "PhynixxXAResource.expired :: XAResource " + this.getId() + " is expired (time out occurred) and all associated TX are rollbacked "; LOG.info(new ConditionViolatedLog(this.timeoutCondition, logString).toString()); } } finally { // no monitoring anymore setTimeOutActive(false); } }
java
public void conditionViolated() { try { if (this.xaConnection != null) { XATransactionalBranch<C> transactionalBranch = this.xaConnection.toGlobalTransactionBranch(); if (transactionalBranch != null) { transactionalBranch.setRollbackOnly(true); } } if (LOG.isInfoEnabled()) { String logString = "PhynixxXAResource.expired :: XAResource " + this.getId() + " is expired (time out occurred) and all associated TX are rollbacked "; LOG.info(new ConditionViolatedLog(this.timeoutCondition, logString).toString()); } } finally { // no monitoring anymore setTimeOutActive(false); } }
[ "public", "void", "conditionViolated", "(", ")", "{", "try", "{", "if", "(", "this", ".", "xaConnection", "!=", "null", ")", "{", "XATransactionalBranch", "<", "C", ">", "transactionalBranch", "=", "this", ".", "xaConnection", ".", "toGlobalTransactionBranch", "(", ")", ";", "if", "(", "transactionalBranch", "!=", "null", ")", "{", "transactionalBranch", ".", "setRollbackOnly", "(", "true", ")", ";", "}", "}", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "String", "logString", "=", "\"PhynixxXAResource.expired :: XAResource \"", "+", "this", ".", "getId", "(", ")", "+", "\" is expired (time out occurred) and all associated TX are rollbacked \"", ";", "LOG", ".", "info", "(", "new", "ConditionViolatedLog", "(", "this", ".", "timeoutCondition", ",", "logString", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "finally", "{", "// no monitoring anymore", "setTimeOutActive", "(", "false", ")", ";", "}", "}" ]
called when the current XAresource is expired (time out occurred) The current Impl. does nothing but marked the associated TX as rollback only The underlying core connection are not treated .... There are two different situation that have to be handled If the connection expires because of a long running method call the connection isn't treated and the XAResource is marked as rollback only. The rollback is done by the Transactionmanager. If the TX expires because the Transactionmanagers doesn't answer, the underlying connection is rolledback and the XAResource is marked as rollback only (N.B. rolling back the connection marks the XAResource as heuristically rolled back)
[ "called", "when", "the", "current", "XAresource", "is", "expired", "(", "time", "out", "occurred", ")", "The", "current", "Impl", ".", "does", "nothing", "but", "marked", "the", "associated", "TX", "as", "rollback", "only", "The", "underlying", "core", "connection", "are", "not", "treated", "...." ]
train
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-xa/src/main/java/org/csc/phynixx/xa/PhynixxXAResource.java#L117-L136
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/HttpJsonRpcClient.java
HttpJsonRpcClient.doPost
public RequestResponse doPost(String url, Map<String, Object> headers, Map<String, Object> urlParams, Object requestData) { """ Perform a POST request. @param url @param headers @param urlParams @param requestData @return """ RequestResponse rr = initRequestResponse("POST", url, headers, urlParams, requestData); Request.Builder requestBuilder = buildRequest(url, headers, urlParams) .post(buildRequestBody(rr)); return doCall(client, requestBuilder.build(), rr); }
java
public RequestResponse doPost(String url, Map<String, Object> headers, Map<String, Object> urlParams, Object requestData) { RequestResponse rr = initRequestResponse("POST", url, headers, urlParams, requestData); Request.Builder requestBuilder = buildRequest(url, headers, urlParams) .post(buildRequestBody(rr)); return doCall(client, requestBuilder.build(), rr); }
[ "public", "RequestResponse", "doPost", "(", "String", "url", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "Map", "<", "String", ",", "Object", ">", "urlParams", ",", "Object", "requestData", ")", "{", "RequestResponse", "rr", "=", "initRequestResponse", "(", "\"POST\"", ",", "url", ",", "headers", ",", "urlParams", ",", "requestData", ")", ";", "Request", ".", "Builder", "requestBuilder", "=", "buildRequest", "(", "url", ",", "headers", ",", "urlParams", ")", ".", "post", "(", "buildRequestBody", "(", "rr", ")", ")", ";", "return", "doCall", "(", "client", ",", "requestBuilder", ".", "build", "(", ")", ",", "rr", ")", ";", "}" ]
Perform a POST request. @param url @param headers @param urlParams @param requestData @return
[ "Perform", "a", "POST", "request", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/HttpJsonRpcClient.java#L214-L220
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/database/CmsHtmlImportConverter.java
CmsHtmlImportConverter.writeTitleProperty
private void writeTitleProperty(Node node, Hashtable properties) { """ Sets the Property title by analyzing the title node.<p> @param node the title node in html document @param properties the properties hashtable """ String title = ""; // the title string is stored in the first child node NodeList children = node.getChildNodes(); if (children != null) { Node titleNode = children.item(0); if (titleNode != null) { title = titleNode.getNodeValue(); } } // add the title property if we have one if ((title != null) && (title.length() > 0)) { properties.put(CmsPropertyDefinition.PROPERTY_TITLE, CmsStringUtil.substitute(title, "{subst}", "&#")); // the title will be used as navtext if no other navtext is // given if (properties.get(CmsPropertyDefinition.PROPERTY_NAVTEXT) == null) { properties.put( CmsPropertyDefinition.PROPERTY_NAVTEXT, CmsStringUtil.substitute(title, "{subst}", "&#")); } } }
java
private void writeTitleProperty(Node node, Hashtable properties) { String title = ""; // the title string is stored in the first child node NodeList children = node.getChildNodes(); if (children != null) { Node titleNode = children.item(0); if (titleNode != null) { title = titleNode.getNodeValue(); } } // add the title property if we have one if ((title != null) && (title.length() > 0)) { properties.put(CmsPropertyDefinition.PROPERTY_TITLE, CmsStringUtil.substitute(title, "{subst}", "&#")); // the title will be used as navtext if no other navtext is // given if (properties.get(CmsPropertyDefinition.PROPERTY_NAVTEXT) == null) { properties.put( CmsPropertyDefinition.PROPERTY_NAVTEXT, CmsStringUtil.substitute(title, "{subst}", "&#")); } } }
[ "private", "void", "writeTitleProperty", "(", "Node", "node", ",", "Hashtable", "properties", ")", "{", "String", "title", "=", "\"\"", ";", "// the title string is stored in the first child node", "NodeList", "children", "=", "node", ".", "getChildNodes", "(", ")", ";", "if", "(", "children", "!=", "null", ")", "{", "Node", "titleNode", "=", "children", ".", "item", "(", "0", ")", ";", "if", "(", "titleNode", "!=", "null", ")", "{", "title", "=", "titleNode", ".", "getNodeValue", "(", ")", ";", "}", "}", "// add the title property if we have one", "if", "(", "(", "title", "!=", "null", ")", "&&", "(", "title", ".", "length", "(", ")", ">", "0", ")", ")", "{", "properties", ".", "put", "(", "CmsPropertyDefinition", ".", "PROPERTY_TITLE", ",", "CmsStringUtil", ".", "substitute", "(", "title", ",", "\"{subst}\"", ",", "\"&#\"", ")", ")", ";", "// the title will be used as navtext if no other navtext is", "// given", "if", "(", "properties", ".", "get", "(", "CmsPropertyDefinition", ".", "PROPERTY_NAVTEXT", ")", "==", "null", ")", "{", "properties", ".", "put", "(", "CmsPropertyDefinition", ".", "PROPERTY_NAVTEXT", ",", "CmsStringUtil", ".", "substitute", "(", "title", ",", "\"{subst}\"", ",", "\"&#\"", ")", ")", ";", "}", "}", "}" ]
Sets the Property title by analyzing the title node.<p> @param node the title node in html document @param properties the properties hashtable
[ "Sets", "the", "Property", "title", "by", "analyzing", "the", "title", "node", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsHtmlImportConverter.java#L590-L614
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/AccountingDate.java
AccountingDate.ofEpochDay
static AccountingDate ofEpochDay(AccountingChronology chronology, long epochDay) { """ Obtains an {@code AccountingDate} representing a date in the given Accounting calendar system from the epoch-day. @param chronology the Accounting chronology to base the date on, not null @param epochDay the epoch day to convert based on 1970-01-01 (ISO) @return the date in given Accounting calendar system, not null @throws DateTimeException if the epoch-day is out of range, NullPointerException if an AccountingChronology was not provided """ EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds // Use Accounting 1 to help with 0-counts. Leap years can occur at any time. long accountingEpochDay = epochDay + chronology.getDays0001ToIso1970(); int longCycle = (int) Math.floorDiv(accountingEpochDay, DAYS_PER_LONG_CYCLE); int daysInLongCycle = (int) Math.floorMod(accountingEpochDay, DAYS_PER_LONG_CYCLE); // Value is an estimate, as the floating leap-years make this difficult. int year = (daysInLongCycle - (daysInLongCycle / 365 + daysInLongCycle / (4 * 365 + 1) - daysInLongCycle / (100 * 365 + 24)) / 7) / (DAYS_IN_WEEK * WEEKS_IN_YEAR); int yearStart = (int) (WEEKS_IN_YEAR * (year - 1) + chronology.previousLeapYears(year)) * DAYS_IN_WEEK; // Despite the year being an estimate, the effect should still be within a few days. if (yearStart > daysInLongCycle) { year--; yearStart -= (WEEKS_IN_YEAR + (chronology.isLeapYear(year) ? 1 : 0)) * DAYS_IN_WEEK; } else if (daysInLongCycle - yearStart >= (WEEKS_IN_YEAR + (chronology.isLeapYear(year) ? 1 : 0)) * DAYS_IN_WEEK) { yearStart += (WEEKS_IN_YEAR + (chronology.isLeapYear(year) ? 1 : 0)) * DAYS_IN_WEEK; year++; } return ofYearDay(chronology, year + 400 * longCycle, daysInLongCycle - yearStart + 1); }
java
static AccountingDate ofEpochDay(AccountingChronology chronology, long epochDay) { EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds // Use Accounting 1 to help with 0-counts. Leap years can occur at any time. long accountingEpochDay = epochDay + chronology.getDays0001ToIso1970(); int longCycle = (int) Math.floorDiv(accountingEpochDay, DAYS_PER_LONG_CYCLE); int daysInLongCycle = (int) Math.floorMod(accountingEpochDay, DAYS_PER_LONG_CYCLE); // Value is an estimate, as the floating leap-years make this difficult. int year = (daysInLongCycle - (daysInLongCycle / 365 + daysInLongCycle / (4 * 365 + 1) - daysInLongCycle / (100 * 365 + 24)) / 7) / (DAYS_IN_WEEK * WEEKS_IN_YEAR); int yearStart = (int) (WEEKS_IN_YEAR * (year - 1) + chronology.previousLeapYears(year)) * DAYS_IN_WEEK; // Despite the year being an estimate, the effect should still be within a few days. if (yearStart > daysInLongCycle) { year--; yearStart -= (WEEKS_IN_YEAR + (chronology.isLeapYear(year) ? 1 : 0)) * DAYS_IN_WEEK; } else if (daysInLongCycle - yearStart >= (WEEKS_IN_YEAR + (chronology.isLeapYear(year) ? 1 : 0)) * DAYS_IN_WEEK) { yearStart += (WEEKS_IN_YEAR + (chronology.isLeapYear(year) ? 1 : 0)) * DAYS_IN_WEEK; year++; } return ofYearDay(chronology, year + 400 * longCycle, daysInLongCycle - yearStart + 1); }
[ "static", "AccountingDate", "ofEpochDay", "(", "AccountingChronology", "chronology", ",", "long", "epochDay", ")", "{", "EPOCH_DAY", ".", "range", "(", ")", ".", "checkValidValue", "(", "epochDay", ",", "EPOCH_DAY", ")", ";", "// validate outer bounds", "// Use Accounting 1 to help with 0-counts. Leap years can occur at any time.", "long", "accountingEpochDay", "=", "epochDay", "+", "chronology", ".", "getDays0001ToIso1970", "(", ")", ";", "int", "longCycle", "=", "(", "int", ")", "Math", ".", "floorDiv", "(", "accountingEpochDay", ",", "DAYS_PER_LONG_CYCLE", ")", ";", "int", "daysInLongCycle", "=", "(", "int", ")", "Math", ".", "floorMod", "(", "accountingEpochDay", ",", "DAYS_PER_LONG_CYCLE", ")", ";", "// Value is an estimate, as the floating leap-years make this difficult.", "int", "year", "=", "(", "daysInLongCycle", "-", "(", "daysInLongCycle", "/", "365", "+", "daysInLongCycle", "/", "(", "4", "*", "365", "+", "1", ")", "-", "daysInLongCycle", "/", "(", "100", "*", "365", "+", "24", ")", ")", "/", "7", ")", "/", "(", "DAYS_IN_WEEK", "*", "WEEKS_IN_YEAR", ")", ";", "int", "yearStart", "=", "(", "int", ")", "(", "WEEKS_IN_YEAR", "*", "(", "year", "-", "1", ")", "+", "chronology", ".", "previousLeapYears", "(", "year", ")", ")", "*", "DAYS_IN_WEEK", ";", "// Despite the year being an estimate, the effect should still be within a few days.", "if", "(", "yearStart", ">", "daysInLongCycle", ")", "{", "year", "--", ";", "yearStart", "-=", "(", "WEEKS_IN_YEAR", "+", "(", "chronology", ".", "isLeapYear", "(", "year", ")", "?", "1", ":", "0", ")", ")", "*", "DAYS_IN_WEEK", ";", "}", "else", "if", "(", "daysInLongCycle", "-", "yearStart", ">=", "(", "WEEKS_IN_YEAR", "+", "(", "chronology", ".", "isLeapYear", "(", "year", ")", "?", "1", ":", "0", ")", ")", "*", "DAYS_IN_WEEK", ")", "{", "yearStart", "+=", "(", "WEEKS_IN_YEAR", "+", "(", "chronology", ".", "isLeapYear", "(", "year", ")", "?", "1", ":", "0", ")", ")", "*", "DAYS_IN_WEEK", ";", "year", "++", ";", "}", "return", "ofYearDay", "(", "chronology", ",", "year", "+", "400", "*", "longCycle", ",", "daysInLongCycle", "-", "yearStart", "+", "1", ")", ";", "}" ]
Obtains an {@code AccountingDate} representing a date in the given Accounting calendar system from the epoch-day. @param chronology the Accounting chronology to base the date on, not null @param epochDay the epoch day to convert based on 1970-01-01 (ISO) @return the date in given Accounting calendar system, not null @throws DateTimeException if the epoch-day is out of range, NullPointerException if an AccountingChronology was not provided
[ "Obtains", "an", "{", "@code", "AccountingDate", "}", "representing", "a", "date", "in", "the", "given", "Accounting", "calendar", "system", "from", "the", "epoch", "-", "day", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/AccountingDate.java#L259-L281
aws/aws-sdk-java
aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/CreateTrainingJobRequest.java
CreateTrainingJobRequest.withHyperParameters
public CreateTrainingJobRequest withHyperParameters(java.util.Map<String, String> hyperParameters) { """ <p> Algorithm-specific parameters that influence the quality of the model. You set hyperparameters before you start the learning process. For a list of hyperparameters for each training algorithm provided by Amazon SageMaker, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html">Algorithms</a>. </p> <p> You can specify a maximum of 100 hyperparameters. Each hyperparameter is a key-value pair. Each key and value is limited to 256 characters, as specified by the <code>Length Constraint</code>. </p> @param hyperParameters Algorithm-specific parameters that influence the quality of the model. You set hyperparameters before you start the learning process. For a list of hyperparameters for each training algorithm provided by Amazon SageMaker, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html">Algorithms</a>. </p> <p> You can specify a maximum of 100 hyperparameters. Each hyperparameter is a key-value pair. Each key and value is limited to 256 characters, as specified by the <code>Length Constraint</code>. @return Returns a reference to this object so that method calls can be chained together. """ setHyperParameters(hyperParameters); return this; }
java
public CreateTrainingJobRequest withHyperParameters(java.util.Map<String, String> hyperParameters) { setHyperParameters(hyperParameters); return this; }
[ "public", "CreateTrainingJobRequest", "withHyperParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "hyperParameters", ")", "{", "setHyperParameters", "(", "hyperParameters", ")", ";", "return", "this", ";", "}" ]
<p> Algorithm-specific parameters that influence the quality of the model. You set hyperparameters before you start the learning process. For a list of hyperparameters for each training algorithm provided by Amazon SageMaker, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html">Algorithms</a>. </p> <p> You can specify a maximum of 100 hyperparameters. Each hyperparameter is a key-value pair. Each key and value is limited to 256 characters, as specified by the <code>Length Constraint</code>. </p> @param hyperParameters Algorithm-specific parameters that influence the quality of the model. You set hyperparameters before you start the learning process. For a list of hyperparameters for each training algorithm provided by Amazon SageMaker, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html">Algorithms</a>. </p> <p> You can specify a maximum of 100 hyperparameters. Each hyperparameter is a key-value pair. Each key and value is limited to 256 characters, as specified by the <code>Length Constraint</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Algorithm", "-", "specific", "parameters", "that", "influence", "the", "quality", "of", "the", "model", ".", "You", "set", "hyperparameters", "before", "you", "start", "the", "learning", "process", ".", "For", "a", "list", "of", "hyperparameters", "for", "each", "training", "algorithm", "provided", "by", "Amazon", "SageMaker", "see", "<a", "href", "=", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "sagemaker", "/", "latest", "/", "dg", "/", "algos", ".", "html", ">", "Algorithms<", "/", "a", ">", ".", "<", "/", "p", ">", "<p", ">", "You", "can", "specify", "a", "maximum", "of", "100", "hyperparameters", ".", "Each", "hyperparameter", "is", "a", "key", "-", "value", "pair", ".", "Each", "key", "and", "value", "is", "limited", "to", "256", "characters", "as", "specified", "by", "the", "<code", ">", "Length", "Constraint<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/CreateTrainingJobRequest.java#L275-L278
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientRequestContextBuilder.java
ClientRequestContextBuilder.of
public static ClientRequestContextBuilder of(RpcRequest request, String uri) { """ Returns a new {@link ClientRequestContextBuilder} created from the specified {@link RpcRequest} and URI. """ return of(request, URI.create(requireNonNull(uri, "uri"))); }
java
public static ClientRequestContextBuilder of(RpcRequest request, String uri) { return of(request, URI.create(requireNonNull(uri, "uri"))); }
[ "public", "static", "ClientRequestContextBuilder", "of", "(", "RpcRequest", "request", ",", "String", "uri", ")", "{", "return", "of", "(", "request", ",", "URI", ".", "create", "(", "requireNonNull", "(", "uri", ",", "\"uri\"", ")", ")", ")", ";", "}" ]
Returns a new {@link ClientRequestContextBuilder} created from the specified {@link RpcRequest} and URI.
[ "Returns", "a", "new", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientRequestContextBuilder.java#L47-L49
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java
POIProxy.getPOIs
public String getPOIs(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { """ This method is used to get the pois from a service and return a GeoJSON document with the data retrieved given a Z/X/Y tile. @param id The id of the service @param z The zoom level @param x The x tile @param y The y tile @return The GeoJSON response from the original service response """ DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); POIProxyEvent beforeEvent = new POIProxyEvent(POIProxyEventEnum.BeforeBrowseZXY, describeService, e1, z, y, x, null, null, null, null, null, null); notifyListenersBeforeRequest(beforeEvent); String geoJSON = getCacheData(beforeEvent); boolean fromCache = true; if (geoJSON == null) { fromCache = false; geoJSON = getResponseAsGeoJSON(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0, beforeEvent); } POIProxyEvent afterEvent = new POIProxyEvent(POIProxyEventEnum.AfterBrowseZXY, describeService, e1, z, y, x, null, null, null, null, geoJSON, null); if (!fromCache) { storeData(afterEvent); } notifyListenersAfterParse(afterEvent); return geoJSON; }
java
public String getPOIs(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); POIProxyEvent beforeEvent = new POIProxyEvent(POIProxyEventEnum.BeforeBrowseZXY, describeService, e1, z, y, x, null, null, null, null, null, null); notifyListenersBeforeRequest(beforeEvent); String geoJSON = getCacheData(beforeEvent); boolean fromCache = true; if (geoJSON == null) { fromCache = false; geoJSON = getResponseAsGeoJSON(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0, beforeEvent); } POIProxyEvent afterEvent = new POIProxyEvent(POIProxyEventEnum.AfterBrowseZXY, describeService, e1, z, y, x, null, null, null, null, geoJSON, null); if (!fromCache) { storeData(afterEvent); } notifyListenersAfterParse(afterEvent); return geoJSON; }
[ "public", "String", "getPOIs", "(", "String", "id", ",", "int", "z", ",", "int", "x", ",", "int", "y", ",", "List", "<", "Param", ">", "optionalParams", ")", "throws", "Exception", "{", "DescribeService", "describeService", "=", "getDescribeServiceByID", "(", "id", ")", ";", "Extent", "e1", "=", "TileConversor", ".", "tileOSMMercatorBounds", "(", "x", ",", "y", ",", "z", ")", ";", "double", "[", "]", "minXY", "=", "ConversionCoords", ".", "reproject", "(", "e1", ".", "getMinX", "(", ")", ",", "e1", ".", "getMinY", "(", ")", ",", "CRSFactory", ".", "getCRS", "(", "MERCATOR_SRS", ")", ",", "CRSFactory", ".", "getCRS", "(", "GEODETIC_SRS", ")", ")", ";", "double", "[", "]", "maxXY", "=", "ConversionCoords", ".", "reproject", "(", "e1", ".", "getMaxX", "(", ")", ",", "e1", ".", "getMaxY", "(", ")", ",", "CRSFactory", ".", "getCRS", "(", "MERCATOR_SRS", ")", ",", "CRSFactory", ".", "getCRS", "(", "GEODETIC_SRS", ")", ")", ";", "POIProxyEvent", "beforeEvent", "=", "new", "POIProxyEvent", "(", "POIProxyEventEnum", ".", "BeforeBrowseZXY", ",", "describeService", ",", "e1", ",", "z", ",", "y", ",", "x", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "notifyListenersBeforeRequest", "(", "beforeEvent", ")", ";", "String", "geoJSON", "=", "getCacheData", "(", "beforeEvent", ")", ";", "boolean", "fromCache", "=", "true", ";", "if", "(", "geoJSON", "==", "null", ")", "{", "fromCache", "=", "false", ";", "geoJSON", "=", "getResponseAsGeoJSON", "(", "id", ",", "optionalParams", ",", "describeService", ",", "minXY", "[", "0", "]", ",", "minXY", "[", "1", "]", ",", "maxXY", "[", "0", "]", ",", "maxXY", "[", "1", "]", ",", "0", ",", "0", ",", "beforeEvent", ")", ";", "}", "POIProxyEvent", "afterEvent", "=", "new", "POIProxyEvent", "(", "POIProxyEventEnum", ".", "AfterBrowseZXY", ",", "describeService", ",", "e1", ",", "z", ",", "y", ",", "x", ",", "null", ",", "null", ",", "null", ",", "null", ",", "geoJSON", ",", "null", ")", ";", "if", "(", "!", "fromCache", ")", "{", "storeData", "(", "afterEvent", ")", ";", "}", "notifyListenersAfterParse", "(", "afterEvent", ")", ";", "return", "geoJSON", ";", "}" ]
This method is used to get the pois from a service and return a GeoJSON document with the data retrieved given a Z/X/Y tile. @param id The id of the service @param z The zoom level @param x The x tile @param y The y tile @return The GeoJSON response from the original service response
[ "This", "method", "is", "used", "to", "get", "the", "pois", "from", "a", "service", "and", "return", "a", "GeoJSON", "document", "with", "the", "data", "retrieved", "given", "a", "Z", "/", "X", "/", "Y", "tile", "." ]
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java#L191-L224
threerings/narya
tools/src/main/java/com/threerings/presents/tools/ImportSet.java
ImportSet.addMunged
public void addMunged (Class<?> clazz, String... replace) { """ Adds a class' name to the imports but first performs the given list of search/replaces as described above. @param clazz the class whose name is munged and added @param replace array of pairs to search/replace on the name before adding """ String name = clazz.getName(); for (int ii = 0; ii < replace.length; ii += 2) { name = name.replace(replace[ii], replace[ii+1]); } _imports.add(name); }
java
public void addMunged (Class<?> clazz, String... replace) { String name = clazz.getName(); for (int ii = 0; ii < replace.length; ii += 2) { name = name.replace(replace[ii], replace[ii+1]); } _imports.add(name); }
[ "public", "void", "addMunged", "(", "Class", "<", "?", ">", "clazz", ",", "String", "...", "replace", ")", "{", "String", "name", "=", "clazz", ".", "getName", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "replace", ".", "length", ";", "ii", "+=", "2", ")", "{", "name", "=", "name", ".", "replace", "(", "replace", "[", "ii", "]", ",", "replace", "[", "ii", "+", "1", "]", ")", ";", "}", "_imports", ".", "add", "(", "name", ")", ";", "}" ]
Adds a class' name to the imports but first performs the given list of search/replaces as described above. @param clazz the class whose name is munged and added @param replace array of pairs to search/replace on the name before adding
[ "Adds", "a", "class", "name", "to", "the", "imports", "but", "first", "performs", "the", "given", "list", "of", "search", "/", "replaces", "as", "described", "above", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/ImportSet.java#L91-L98
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java
DateTimePeriod.toMonths
public List<DateTimePeriod> toMonths() { """ Converts this period to a list of month periods. Partial months will not be included. For example, a period of "2009" will return a list of 12 months - one for each month in 2009. On the other hand, a period of "January 20, 2009" would return an empty list since partial months are not included. @return A list of month periods contained within this period """ ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>(); // default "current" month to start datetime DateTime currentStart = getStart(); // calculate "next" month DateTime nextStart = currentStart.plusMonths(1); // continue adding until we've reached the end while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) { // its okay to add the current list.add(new DateTimeMonth(currentStart, nextStart)); // increment both currentStart = nextStart; nextStart = currentStart.plusMonths(1); } return list; }
java
public List<DateTimePeriod> toMonths() { ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>(); // default "current" month to start datetime DateTime currentStart = getStart(); // calculate "next" month DateTime nextStart = currentStart.plusMonths(1); // continue adding until we've reached the end while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) { // its okay to add the current list.add(new DateTimeMonth(currentStart, nextStart)); // increment both currentStart = nextStart; nextStart = currentStart.plusMonths(1); } return list; }
[ "public", "List", "<", "DateTimePeriod", ">", "toMonths", "(", ")", "{", "ArrayList", "<", "DateTimePeriod", ">", "list", "=", "new", "ArrayList", "<", "DateTimePeriod", ">", "(", ")", ";", "// default \"current\" month to start datetime", "DateTime", "currentStart", "=", "getStart", "(", ")", ";", "// calculate \"next\" month", "DateTime", "nextStart", "=", "currentStart", ".", "plusMonths", "(", "1", ")", ";", "// continue adding until we've reached the end", "while", "(", "nextStart", ".", "isBefore", "(", "getEnd", "(", ")", ")", "||", "nextStart", ".", "isEqual", "(", "getEnd", "(", ")", ")", ")", "{", "// its okay to add the current", "list", ".", "add", "(", "new", "DateTimeMonth", "(", "currentStart", ",", "nextStart", ")", ")", ";", "// increment both", "currentStart", "=", "nextStart", ";", "nextStart", "=", "currentStart", ".", "plusMonths", "(", "1", ")", ";", "}", "return", "list", ";", "}" ]
Converts this period to a list of month periods. Partial months will not be included. For example, a period of "2009" will return a list of 12 months - one for each month in 2009. On the other hand, a period of "January 20, 2009" would return an empty list since partial months are not included. @return A list of month periods contained within this period
[ "Converts", "this", "period", "to", "a", "list", "of", "month", "periods", ".", "Partial", "months", "will", "not", "be", "included", ".", "For", "example", "a", "period", "of", "2009", "will", "return", "a", "list", "of", "12", "months", "-", "one", "for", "each", "month", "in", "2009", ".", "On", "the", "other", "hand", "a", "period", "of", "January", "20", "2009", "would", "return", "an", "empty", "list", "since", "partial", "months", "are", "not", "included", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java#L327-L344
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/web.java
web.downloadToSDCard
public static boolean downloadToSDCard(String downloadURL, String sdcardPath) { """ Download a file to the sdcard<br/> Please remember to <br/> <li>give your application the permission to access the Internet and to write to external storage</li> <li>Create the Folder (eg. <code>File wallpaperDirectory = new File("/sdcard/Wallpaper/"); // have the object build the directory structure, if needed. wallpaperDirectory.mkdirs();</code> @param downloadURL from where you want to download @param sdcardPath path to download the asset @return """ try { URL url = new URL(downloadURL); URLConnection connection = url.openConnection(); connection.connect(); // download the file InputStream input = new BufferedInputStream(url.openStream()); OutputStream output = new FileOutputStream(sdcardPath); byte data[] = new byte[1024]; long total = 0; int count; while ((count = input.read(data)) != -1) { total += count; output.write(data, 0, count); } output.flush(); output.close(); input.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
java
public static boolean downloadToSDCard(String downloadURL, String sdcardPath) { try { URL url = new URL(downloadURL); URLConnection connection = url.openConnection(); connection.connect(); // download the file InputStream input = new BufferedInputStream(url.openStream()); OutputStream output = new FileOutputStream(sdcardPath); byte data[] = new byte[1024]; long total = 0; int count; while ((count = input.read(data)) != -1) { total += count; output.write(data, 0, count); } output.flush(); output.close(); input.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
[ "public", "static", "boolean", "downloadToSDCard", "(", "String", "downloadURL", ",", "String", "sdcardPath", ")", "{", "try", "{", "URL", "url", "=", "new", "URL", "(", "downloadURL", ")", ";", "URLConnection", "connection", "=", "url", ".", "openConnection", "(", ")", ";", "connection", ".", "connect", "(", ")", ";", "// download the file", "InputStream", "input", "=", "new", "BufferedInputStream", "(", "url", ".", "openStream", "(", ")", ")", ";", "OutputStream", "output", "=", "new", "FileOutputStream", "(", "sdcardPath", ")", ";", "byte", "data", "[", "]", "=", "new", "byte", "[", "1024", "]", ";", "long", "total", "=", "0", ";", "int", "count", ";", "while", "(", "(", "count", "=", "input", ".", "read", "(", "data", ")", ")", "!=", "-", "1", ")", "{", "total", "+=", "count", ";", "output", ".", "write", "(", "data", ",", "0", ",", "count", ")", ";", "}", "output", ".", "flush", "(", ")", ";", "output", ".", "close", "(", ")", ";", "input", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Download a file to the sdcard<br/> Please remember to <br/> <li>give your application the permission to access the Internet and to write to external storage</li> <li>Create the Folder (eg. <code>File wallpaperDirectory = new File("/sdcard/Wallpaper/"); // have the object build the directory structure, if needed. wallpaperDirectory.mkdirs();</code> @param downloadURL from where you want to download @param sdcardPath path to download the asset @return
[ "Download", "a", "file", "to", "the", "sdcard<br", "/", ">", "Please", "remember", "to", "<br", "/", ">", "<li", ">", "give", "your", "application", "the", "permission", "to", "access", "the", "Internet", "and", "to", "write", "to", "external", "storage<", "/", "li", ">", "<li", ">", "Create", "the", "Folder", "(", "eg", ".", "<code", ">", "File", "wallpaperDirectory", "=", "new", "File", "(", "/", "sdcard", "/", "Wallpaper", "/", ")", ";", "//", "have", "the", "object", "build", "the", "directory", "structure", "if", "needed", ".", "wallpaperDirectory", ".", "mkdirs", "()", ";", "<", "/", "code", ">" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/web.java#L67-L95
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.calAfpRmsd
protected static double calAfpRmsd(int afpn, int[] afpPositions, int listStart, AFPChain afpChain,Atom[] ca1, Atom[] ca2) { """ return the rmsd of the residues from the segments that form the given AFP list this value can be a measurement (1) for the connectivity of the AFPs @param afpn @param afpPositions the positions of AFPs to work on. @param listStart the starting position in the list of AFPs @param afpChain @param ca1 @param ca2 @return rmsd """ if (debug) System.out.println("XXX calling afp2res "+ afpn + " " + afpPositions.length); int focusResn = AFPTwister.afp2Res(afpChain,afpn, afpPositions, listStart); int[] focusRes1 = afpChain.getFocusRes1(); int[] focusRes2 = afpChain.getFocusRes2(); if (debug) System.out.println("XXX calculating calAfpRmsd: " + focusResn + " " + focusRes1.length + " " + focusRes2.length + " " + afpChain.getMinLen() + " " ); double rmsd = getRmsd(focusResn, focusRes1, focusRes2 , afpChain,ca1, ca2); return rmsd; }
java
protected static double calAfpRmsd(int afpn, int[] afpPositions, int listStart, AFPChain afpChain,Atom[] ca1, Atom[] ca2) { if (debug) System.out.println("XXX calling afp2res "+ afpn + " " + afpPositions.length); int focusResn = AFPTwister.afp2Res(afpChain,afpn, afpPositions, listStart); int[] focusRes1 = afpChain.getFocusRes1(); int[] focusRes2 = afpChain.getFocusRes2(); if (debug) System.out.println("XXX calculating calAfpRmsd: " + focusResn + " " + focusRes1.length + " " + focusRes2.length + " " + afpChain.getMinLen() + " " ); double rmsd = getRmsd(focusResn, focusRes1, focusRes2 , afpChain,ca1, ca2); return rmsd; }
[ "protected", "static", "double", "calAfpRmsd", "(", "int", "afpn", ",", "int", "[", "]", "afpPositions", ",", "int", "listStart", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "{", "if", "(", "debug", ")", "System", ".", "out", ".", "println", "(", "\"XXX calling afp2res \"", "+", "afpn", "+", "\" \"", "+", "afpPositions", ".", "length", ")", ";", "int", "focusResn", "=", "AFPTwister", ".", "afp2Res", "(", "afpChain", ",", "afpn", ",", "afpPositions", ",", "listStart", ")", ";", "int", "[", "]", "focusRes1", "=", "afpChain", ".", "getFocusRes1", "(", ")", ";", "int", "[", "]", "focusRes2", "=", "afpChain", ".", "getFocusRes2", "(", ")", ";", "if", "(", "debug", ")", "System", ".", "out", ".", "println", "(", "\"XXX calculating calAfpRmsd: \"", "+", "focusResn", "+", "\" \"", "+", "focusRes1", ".", "length", "+", "\" \"", "+", "focusRes2", ".", "length", "+", "\" \"", "+", "afpChain", ".", "getMinLen", "(", ")", "+", "\" \"", ")", ";", "double", "rmsd", "=", "getRmsd", "(", "focusResn", ",", "focusRes1", ",", "focusRes2", ",", "afpChain", ",", "ca1", ",", "ca2", ")", ";", "return", "rmsd", ";", "}" ]
return the rmsd of the residues from the segments that form the given AFP list this value can be a measurement (1) for the connectivity of the AFPs @param afpn @param afpPositions the positions of AFPs to work on. @param listStart the starting position in the list of AFPs @param afpChain @param ca1 @param ca2 @return rmsd
[ "return", "the", "rmsd", "of", "the", "residues", "from", "the", "segments", "that", "form", "the", "given", "AFP", "list", "this", "value", "can", "be", "a", "measurement", "(", "1", ")", "for", "the", "connectivity", "of", "the", "AFPs" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L637-L655
EXIficient/exificient-core
src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java
QNameUtilities.getQualifiedName
public static final String getQualifiedName(String localName, String pfx) { """ Returns qualified name as String <p> QName ::= PrefixedName | UnprefixedName <br> PrefixedName ::= Prefix ':' LocalPart <br> UnprefixedName ::= LocalPart </p> @param localName local-name @param pfx prefix @return <code>String</code> for qname """ pfx = pfx == null ? "" : pfx; return pfx.length() == 0 ? localName : (pfx + Constants.COLON + localName); }
java
public static final String getQualifiedName(String localName, String pfx) { pfx = pfx == null ? "" : pfx; return pfx.length() == 0 ? localName : (pfx + Constants.COLON + localName); }
[ "public", "static", "final", "String", "getQualifiedName", "(", "String", "localName", ",", "String", "pfx", ")", "{", "pfx", "=", "pfx", "==", "null", "?", "\"\"", ":", "pfx", ";", "return", "pfx", ".", "length", "(", ")", "==", "0", "?", "localName", ":", "(", "pfx", "+", "Constants", ".", "COLON", "+", "localName", ")", ";", "}" ]
Returns qualified name as String <p> QName ::= PrefixedName | UnprefixedName <br> PrefixedName ::= Prefix ':' LocalPart <br> UnprefixedName ::= LocalPart </p> @param localName local-name @param pfx prefix @return <code>String</code> for qname
[ "Returns", "qualified", "name", "as", "String" ]
train
https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java#L85-L89
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java
IndexElasticsearchUpdater.updateSettings
public static void updateSettings(RestClient client, String root, String index) throws Exception { """ Update index settings in Elasticsearch. Read also _update_settings.json if exists. @param client Elasticsearch client @param root dir within the classpath @param index Index name @throws Exception if the elasticsearch API call is failing """ String settings = IndexSettingsReader.readUpdateSettings(root, index); updateIndexWithSettingsInElasticsearch(client, index, settings); }
java
public static void updateSettings(RestClient client, String root, String index) throws Exception { String settings = IndexSettingsReader.readUpdateSettings(root, index); updateIndexWithSettingsInElasticsearch(client, index, settings); }
[ "public", "static", "void", "updateSettings", "(", "RestClient", "client", ",", "String", "root", ",", "String", "index", ")", "throws", "Exception", "{", "String", "settings", "=", "IndexSettingsReader", ".", "readUpdateSettings", "(", "root", ",", "index", ")", ";", "updateIndexWithSettingsInElasticsearch", "(", "client", ",", "index", ",", "settings", ")", ";", "}" ]
Update index settings in Elasticsearch. Read also _update_settings.json if exists. @param client Elasticsearch client @param root dir within the classpath @param index Index name @throws Exception if the elasticsearch API call is failing
[ "Update", "index", "settings", "in", "Elasticsearch", ".", "Read", "also", "_update_settings", ".", "json", "if", "exists", "." ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L343-L346
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.getMember
protected Member getMember(PageContext pc, Collection.Key key, boolean dataMember, boolean superAccess) { """ get entry matching key @param access @param keyLowerCase key lower case (case sensitive) @param doBase do check also base component @param dataMember do also check if key super @return matching entry if exists otherwise null """ // check super if (dataMember && key.equalsIgnoreCase(KeyConstants._super) && isPrivate(pc)) { Component ac = ComponentUtil.getActiveComponent(pc, this); return SuperComponent.superMember((ComponentImpl) ac.getBaseComponent()); } if (superAccess) return _udfs.get(key); // check data Member member = _data.get(key); if (isAccessible(pc, member)) return member; return null; }
java
protected Member getMember(PageContext pc, Collection.Key key, boolean dataMember, boolean superAccess) { // check super if (dataMember && key.equalsIgnoreCase(KeyConstants._super) && isPrivate(pc)) { Component ac = ComponentUtil.getActiveComponent(pc, this); return SuperComponent.superMember((ComponentImpl) ac.getBaseComponent()); } if (superAccess) return _udfs.get(key); // check data Member member = _data.get(key); if (isAccessible(pc, member)) return member; return null; }
[ "protected", "Member", "getMember", "(", "PageContext", "pc", ",", "Collection", ".", "Key", "key", ",", "boolean", "dataMember", ",", "boolean", "superAccess", ")", "{", "// check super", "if", "(", "dataMember", "&&", "key", ".", "equalsIgnoreCase", "(", "KeyConstants", ".", "_super", ")", "&&", "isPrivate", "(", "pc", ")", ")", "{", "Component", "ac", "=", "ComponentUtil", ".", "getActiveComponent", "(", "pc", ",", "this", ")", ";", "return", "SuperComponent", ".", "superMember", "(", "(", "ComponentImpl", ")", "ac", ".", "getBaseComponent", "(", ")", ")", ";", "}", "if", "(", "superAccess", ")", "return", "_udfs", ".", "get", "(", "key", ")", ";", "// check data", "Member", "member", "=", "_data", ".", "get", "(", "key", ")", ";", "if", "(", "isAccessible", "(", "pc", ",", "member", ")", ")", "return", "member", ";", "return", "null", ";", "}" ]
get entry matching key @param access @param keyLowerCase key lower case (case sensitive) @param doBase do check also base component @param dataMember do also check if key super @return matching entry if exists otherwise null
[ "get", "entry", "matching", "key" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L877-L889
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/ParameterResolverImpl.java
ParameterResolverImpl.applyDefaultValues
private void applyDefaultValues(Map<String, Object> parameterValues) { """ Apply default values for all parameters. @param parameterValues Parameter values """ for (Parameter<?> parameter : allParameters) { parameterValues.put(parameter.getName(), getParameterDefaultValue(parameter)); } }
java
private void applyDefaultValues(Map<String, Object> parameterValues) { for (Parameter<?> parameter : allParameters) { parameterValues.put(parameter.getName(), getParameterDefaultValue(parameter)); } }
[ "private", "void", "applyDefaultValues", "(", "Map", "<", "String", ",", "Object", ">", "parameterValues", ")", "{", "for", "(", "Parameter", "<", "?", ">", "parameter", ":", "allParameters", ")", "{", "parameterValues", ".", "put", "(", "parameter", ".", "getName", "(", ")", ",", "getParameterDefaultValue", "(", "parameter", ")", ")", ";", "}", "}" ]
Apply default values for all parameters. @param parameterValues Parameter values
[ "Apply", "default", "values", "for", "all", "parameters", "." ]
train
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/ParameterResolverImpl.java#L120-L124
HeidelTime/heideltime
src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java
TempEval3Writer.writeTimeMLDocument
private void writeTimeMLDocument(Document xmlDoc, String filename) { """ writes a populated DOM xml(timeml) document to a given directory/file @param xmlDoc xml dom object @param filename name of the file that gets appended to the set output path """ // create output file handle File outFile = new File(mOutputDir, filename+".tml"); BufferedWriter bw = null; try { // create a buffered writer for the output file bw = new BufferedWriter(new FileWriter(outFile)); // prepare the transformer to convert from the xml doc to output text Transformer transformer = TransformerFactory.newInstance().newTransformer(); // some pretty printing transformer.setOutputProperty(OutputKeys.INDENT, "no"); DOMSource source = new DOMSource(xmlDoc); StreamResult result = new StreamResult(bw); // transform transformer.transform(source, result); } catch (IOException e) { // something went wrong with the bufferedwriter e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written."); } catch (TransformerException e) { // the transformer malfunctioned (call optimus prime) e.printStackTrace(); Logger.printError(component, "XML transformer could not be properly initialized."); } finally { // clean up for the bufferedwriter try { bw.close(); } catch(IOException e) { e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed."); } } }
java
private void writeTimeMLDocument(Document xmlDoc, String filename) { // create output file handle File outFile = new File(mOutputDir, filename+".tml"); BufferedWriter bw = null; try { // create a buffered writer for the output file bw = new BufferedWriter(new FileWriter(outFile)); // prepare the transformer to convert from the xml doc to output text Transformer transformer = TransformerFactory.newInstance().newTransformer(); // some pretty printing transformer.setOutputProperty(OutputKeys.INDENT, "no"); DOMSource source = new DOMSource(xmlDoc); StreamResult result = new StreamResult(bw); // transform transformer.transform(source, result); } catch (IOException e) { // something went wrong with the bufferedwriter e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written."); } catch (TransformerException e) { // the transformer malfunctioned (call optimus prime) e.printStackTrace(); Logger.printError(component, "XML transformer could not be properly initialized."); } finally { // clean up for the bufferedwriter try { bw.close(); } catch(IOException e) { e.printStackTrace(); Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed."); } } }
[ "private", "void", "writeTimeMLDocument", "(", "Document", "xmlDoc", ",", "String", "filename", ")", "{", "// create output file handle", "File", "outFile", "=", "new", "File", "(", "mOutputDir", ",", "filename", "+", "\".tml\"", ")", ";", "BufferedWriter", "bw", "=", "null", ";", "try", "{", "// create a buffered writer for the output file", "bw", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "outFile", ")", ")", ";", "// prepare the transformer to convert from the xml doc to output text", "Transformer", "transformer", "=", "TransformerFactory", ".", "newInstance", "(", ")", ".", "newTransformer", "(", ")", ";", "// some pretty printing", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "\"no\"", ")", ";", "DOMSource", "source", "=", "new", "DOMSource", "(", "xmlDoc", ")", ";", "StreamResult", "result", "=", "new", "StreamResult", "(", "bw", ")", ";", "// transform", "transformer", ".", "transform", "(", "source", ",", "result", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// something went wrong with the bufferedwriter", "e", ".", "printStackTrace", "(", ")", ";", "Logger", ".", "printError", "(", "component", ",", "\"File \"", "+", "outFile", ".", "getAbsolutePath", "(", ")", "+", "\" could not be written.\"", ")", ";", "}", "catch", "(", "TransformerException", "e", ")", "{", "// the transformer malfunctioned (call optimus prime)", "e", ".", "printStackTrace", "(", ")", ";", "Logger", ".", "printError", "(", "component", ",", "\"XML transformer could not be properly initialized.\"", ")", ";", "}", "finally", "{", "// clean up for the bufferedwriter", "try", "{", "bw", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "Logger", ".", "printError", "(", "component", ",", "\"File \"", "+", "outFile", ".", "getAbsolutePath", "(", ")", "+", "\" could not be closed.\"", ")", ";", "}", "}", "}" ]
writes a populated DOM xml(timeml) document to a given directory/file @param xmlDoc xml dom object @param filename name of the file that gets appended to the set output path
[ "writes", "a", "populated", "DOM", "xml", "(", "timeml", ")", "document", "to", "a", "given", "directory", "/", "file" ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/consumer/tempeval3writer/TempEval3Writer.java#L237-L269
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_mailingList_name_PUT
public void domain_mailingList_name_PUT(String domain, String name, OvhMailingList body) throws IOException { """ Alter this object properties REST: PUT /email/domain/{domain}/mailingList/{name} @param body [required] New object properties @param domain [required] Name of your domain name @param name [required] Name of mailing list """ String qPath = "/email/domain/{domain}/mailingList/{name}"; StringBuilder sb = path(qPath, domain, name); exec(qPath, "PUT", sb.toString(), body); }
java
public void domain_mailingList_name_PUT(String domain, String name, OvhMailingList body) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}"; StringBuilder sb = path(qPath, domain, name); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "domain_mailingList_name_PUT", "(", "String", "domain", ",", "String", "name", ",", "OvhMailingList", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/mailingList/{name}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "domain", ",", "name", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /email/domain/{domain}/mailingList/{name} @param body [required] New object properties @param domain [required] Name of your domain name @param name [required] Name of mailing list
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1541-L1545
google/truth
core/src/main/java/com/google/common/truth/MathUtil.java
MathUtil.notEqualWithinTolerance
public static boolean notEqualWithinTolerance(double left, double right, double tolerance) { """ Returns true iff {@code left} and {@code right} are finite values not within {@code tolerance} of each other. Note that both this method and {@link #equalWithinTolerance} returns false if either {@code left} or {@code right} is infinite or NaN. """ if (Doubles.isFinite(left) && Doubles.isFinite(right)) { return Math.abs(left - right) > Math.abs(tolerance); } else { return false; } }
java
public static boolean notEqualWithinTolerance(double left, double right, double tolerance) { if (Doubles.isFinite(left) && Doubles.isFinite(right)) { return Math.abs(left - right) > Math.abs(tolerance); } else { return false; } }
[ "public", "static", "boolean", "notEqualWithinTolerance", "(", "double", "left", ",", "double", "right", ",", "double", "tolerance", ")", "{", "if", "(", "Doubles", ".", "isFinite", "(", "left", ")", "&&", "Doubles", ".", "isFinite", "(", "right", ")", ")", "{", "return", "Math", ".", "abs", "(", "left", "-", "right", ")", ">", "Math", ".", "abs", "(", "tolerance", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Returns true iff {@code left} and {@code right} are finite values not within {@code tolerance} of each other. Note that both this method and {@link #equalWithinTolerance} returns false if either {@code left} or {@code right} is infinite or NaN.
[ "Returns", "true", "iff", "{" ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MathUtil.java#L48-L54
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.initiateMultipartUpload
public InitiateMultipartUploadResponse initiateMultipartUpload(String bucketName, String key) { """ Initiates a multipart upload and returns an InitiateMultipartUploadResponse which contains an upload ID. This upload ID associates all the parts in the specific upload and is used in each of your subsequent uploadPart requests. You also include this upload ID in the final request to either complete, or abort the multipart upload request. @param bucketName The name of the Bos bucket containing the object to initiate. @param key The key of the object to initiate. @return An InitiateMultipartUploadResponse from Bos. """ return this.initiateMultipartUpload(new InitiateMultipartUploadRequest(bucketName, key)); }
java
public InitiateMultipartUploadResponse initiateMultipartUpload(String bucketName, String key) { return this.initiateMultipartUpload(new InitiateMultipartUploadRequest(bucketName, key)); }
[ "public", "InitiateMultipartUploadResponse", "initiateMultipartUpload", "(", "String", "bucketName", ",", "String", "key", ")", "{", "return", "this", ".", "initiateMultipartUpload", "(", "new", "InitiateMultipartUploadRequest", "(", "bucketName", ",", "key", ")", ")", ";", "}" ]
Initiates a multipart upload and returns an InitiateMultipartUploadResponse which contains an upload ID. This upload ID associates all the parts in the specific upload and is used in each of your subsequent uploadPart requests. You also include this upload ID in the final request to either complete, or abort the multipart upload request. @param bucketName The name of the Bos bucket containing the object to initiate. @param key The key of the object to initiate. @return An InitiateMultipartUploadResponse from Bos.
[ "Initiates", "a", "multipart", "upload", "and", "returns", "an", "InitiateMultipartUploadResponse", "which", "contains", "an", "upload", "ID", ".", "This", "upload", "ID", "associates", "all", "the", "parts", "in", "the", "specific", "upload", "and", "is", "used", "in", "each", "of", "your", "subsequent", "uploadPart", "requests", ".", "You", "also", "include", "this", "upload", "ID", "in", "the", "final", "request", "to", "either", "complete", "or", "abort", "the", "multipart", "upload", "request", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1082-L1084
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java
OSMTablesFactory.createTagTable
public static PreparedStatement createTagTable(Connection connection, String tagTableName) throws SQLException { """ Create the tag table to store all key and value @param connection @param tagTableName @return @throws SQLException """ // PostgreSQL and H2 will automatically create an index on TAG_KEY,TAG_VALUE when UNIQUE constraint is set try (Statement stmt = connection.createStatement()) { // PostgreSQL and H2 will automatically create an index on TAG_KEY,TAG_VALUE when UNIQUE constraint is set stmt.execute("CREATE TABLE " + tagTableName + "(ID_TAG SERIAL PRIMARY KEY, TAG_KEY VARCHAR UNIQUE);"); } //We return the prepared statement of the tag table return connection.prepareStatement("INSERT INTO " + tagTableName + " (TAG_KEY) VALUES (?)"); }
java
public static PreparedStatement createTagTable(Connection connection, String tagTableName) throws SQLException { // PostgreSQL and H2 will automatically create an index on TAG_KEY,TAG_VALUE when UNIQUE constraint is set try (Statement stmt = connection.createStatement()) { // PostgreSQL and H2 will automatically create an index on TAG_KEY,TAG_VALUE when UNIQUE constraint is set stmt.execute("CREATE TABLE " + tagTableName + "(ID_TAG SERIAL PRIMARY KEY, TAG_KEY VARCHAR UNIQUE);"); } //We return the prepared statement of the tag table return connection.prepareStatement("INSERT INTO " + tagTableName + " (TAG_KEY) VALUES (?)"); }
[ "public", "static", "PreparedStatement", "createTagTable", "(", "Connection", "connection", ",", "String", "tagTableName", ")", "throws", "SQLException", "{", "// PostgreSQL and H2 will automatically create an index on TAG_KEY,TAG_VALUE when UNIQUE constraint is set", "try", "(", "Statement", "stmt", "=", "connection", ".", "createStatement", "(", ")", ")", "{", "// PostgreSQL and H2 will automatically create an index on TAG_KEY,TAG_VALUE when UNIQUE constraint is set", "stmt", ".", "execute", "(", "\"CREATE TABLE \"", "+", "tagTableName", "+", "\"(ID_TAG SERIAL PRIMARY KEY, TAG_KEY VARCHAR UNIQUE);\"", ")", ";", "}", "//We return the prepared statement of the tag table", "return", "connection", ".", "prepareStatement", "(", "\"INSERT INTO \"", "+", "tagTableName", "+", "\" (TAG_KEY) VALUES (?)\"", ")", ";", "}" ]
Create the tag table to store all key and value @param connection @param tagTableName @return @throws SQLException
[ "Create", "the", "tag", "table", "to", "store", "all", "key", "and", "value" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java#L79-L87
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java
ApplicationUrl.renamePackageFileUrl
public static MozuUrl renamePackageFileUrl(String applicationKey, String responseFields) { """ Get Resource Url for RenamePackageFile @param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl renamePackageFileUrl(String applicationKey, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "renamePackageFileUrl", "(", "String", "applicationKey", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"applicationKey\"", ",", "applicationKey", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "HOME_POD", ")", ";", "}" ]
Get Resource Url for RenamePackageFile @param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "RenamePackageFile" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java#L98-L104
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/parser/DummyParser.java
DummyParser.parse
@Override public ParseResult parse(Source source) { """ When called this examines the source to make sure the scrcInfo and data are the expected testSrcInfo and testString. It then produces the testDoc as a result """ if (!testSrcInfo.equals(source.getSrcInfo())) { throw new RuntimeException("testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source.getSrcInfo()); } try { BufferedReader reader = source.createReader(); try { if (!testString.equals(reader.readLine())) { throw new RuntimeException("testString and reader.readLine() were not equal"); } final String secondLine = reader.readLine(); if (secondLine != null) { throw new RuntimeException("got a second line '" + secondLine + "' from the reader"); } } finally { reader.close(); } } catch (IOException e) { throw new RuntimeException(e); } return testResult; }
java
@Override public ParseResult parse(Source source) { if (!testSrcInfo.equals(source.getSrcInfo())) { throw new RuntimeException("testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source.getSrcInfo()); } try { BufferedReader reader = source.createReader(); try { if (!testString.equals(reader.readLine())) { throw new RuntimeException("testString and reader.readLine() were not equal"); } final String secondLine = reader.readLine(); if (secondLine != null) { throw new RuntimeException("got a second line '" + secondLine + "' from the reader"); } } finally { reader.close(); } } catch (IOException e) { throw new RuntimeException(e); } return testResult; }
[ "@", "Override", "public", "ParseResult", "parse", "(", "Source", "source", ")", "{", "if", "(", "!", "testSrcInfo", ".", "equals", "(", "source", ".", "getSrcInfo", "(", ")", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = \"", "+", "testSrcInfo", "+", "\", source.getSrcInfo = \"", "+", "source", ".", "getSrcInfo", "(", ")", ")", ";", "}", "try", "{", "BufferedReader", "reader", "=", "source", ".", "createReader", "(", ")", ";", "try", "{", "if", "(", "!", "testString", ".", "equals", "(", "reader", ".", "readLine", "(", ")", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"testString and reader.readLine() were not equal\"", ")", ";", "}", "final", "String", "secondLine", "=", "reader", ".", "readLine", "(", ")", ";", "if", "(", "secondLine", "!=", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"got a second line '\"", "+", "secondLine", "+", "\"' from the reader\"", ")", ";", "}", "}", "finally", "{", "reader", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "return", "testResult", ";", "}" ]
When called this examines the source to make sure the scrcInfo and data are the expected testSrcInfo and testString. It then produces the testDoc as a result
[ "When", "called", "this", "examines", "the", "source", "to", "make", "sure", "the", "scrcInfo", "and", "data", "are", "the", "expected", "testSrcInfo", "and", "testString", ".", "It", "then", "produces", "the", "testDoc", "as", "a", "result" ]
train
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/parser/DummyParser.java#L51-L73
jbundle/jbundle
base/message/jibx/src/main/java/org/jbundle/base/message/trx/message/external/convert/jibx/JibxContexts.java
JibxContexts.getUnmarshaller
public IUnmarshallingContext getUnmarshaller(String packageName, String bindingName) throws JiBXException { """ Get the shared unmarshaller for this context. NOTE: Since this is shared, always synchronize on this object. @param bindingName The JiBX binding name (defaults to 'binding') @return """ JIBXContextHolder jAXBContextHolder = this.get(packageName, bindingName); if (jAXBContextHolder == null) return null; // Never return jAXBContextHolder.getUnmarshaller(); }
java
public IUnmarshallingContext getUnmarshaller(String packageName, String bindingName) throws JiBXException { JIBXContextHolder jAXBContextHolder = this.get(packageName, bindingName); if (jAXBContextHolder == null) return null; // Never return jAXBContextHolder.getUnmarshaller(); }
[ "public", "IUnmarshallingContext", "getUnmarshaller", "(", "String", "packageName", ",", "String", "bindingName", ")", "throws", "JiBXException", "{", "JIBXContextHolder", "jAXBContextHolder", "=", "this", ".", "get", "(", "packageName", ",", "bindingName", ")", ";", "if", "(", "jAXBContextHolder", "==", "null", ")", "return", "null", ";", "// Never", "return", "jAXBContextHolder", ".", "getUnmarshaller", "(", ")", ";", "}" ]
Get the shared unmarshaller for this context. NOTE: Since this is shared, always synchronize on this object. @param bindingName The JiBX binding name (defaults to 'binding') @return
[ "Get", "the", "shared", "unmarshaller", "for", "this", "context", ".", "NOTE", ":", "Since", "this", "is", "shared", "always", "synchronize", "on", "this", "object", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/jibx/src/main/java/org/jbundle/base/message/trx/message/external/convert/jibx/JibxContexts.java#L68-L74
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/MenuItemTransition.java
MenuItemTransition.setInvalidateOptionOnStopTransition
public MenuItemTransition setInvalidateOptionOnStopTransition(@NonNull Activity activity, boolean invalidate) { """ Sets whether or not to call {@link Activity#invalidateOptionsMenu()} after a transition stops. @param activity Activity that should have its {@link Activity#invalidateOptionsMenu()} method called, or null if invalidate parameter is false. @param invalidate @return """ this.mActivityRef = new WeakReference<>(activity); this.mInvalidateOptionOnStopTransition = invalidate; return self(); }
java
public MenuItemTransition setInvalidateOptionOnStopTransition(@NonNull Activity activity, boolean invalidate) { this.mActivityRef = new WeakReference<>(activity); this.mInvalidateOptionOnStopTransition = invalidate; return self(); }
[ "public", "MenuItemTransition", "setInvalidateOptionOnStopTransition", "(", "@", "NonNull", "Activity", "activity", ",", "boolean", "invalidate", ")", "{", "this", ".", "mActivityRef", "=", "new", "WeakReference", "<>", "(", "activity", ")", ";", "this", ".", "mInvalidateOptionOnStopTransition", "=", "invalidate", ";", "return", "self", "(", ")", ";", "}" ]
Sets whether or not to call {@link Activity#invalidateOptionsMenu()} after a transition stops. @param activity Activity that should have its {@link Activity#invalidateOptionsMenu()} method called, or null if invalidate parameter is false. @param invalidate @return
[ "Sets", "whether", "or", "not", "to", "call", "{", "@link", "Activity#invalidateOptionsMenu", "()", "}", "after", "a", "transition", "stops", "." ]
train
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/MenuItemTransition.java#L211-L215
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.checkRoleForUserModification
protected void checkRoleForUserModification(CmsDbContext dbc, String username, CmsRole role) throws CmsDataAccessException, CmsRoleViolationException { """ Checks that the current user has enough permissions to modify the given user.<p> @param dbc the database context @param username the name of the user to modify @param role the needed role @throws CmsDataAccessException if something goes wrong accessing the database @throws CmsRoleViolationException if the user has not the needed permissions """ CmsUser userToModify = m_driverManager.readUser(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username)); if (dbc.currentUser().equals(userToModify)) { // a user is allowed to write his own data return; } if (hasRole(dbc, dbc.currentUser(), CmsRole.ROOT_ADMIN)) { // a user with the ROOT_ADMIN role may change any other user return; } if (hasRole(dbc, userToModify, CmsRole.ADMINISTRATOR)) { // check the user that is going to do the modification is administrator checkRole(dbc, CmsRole.ADMINISTRATOR); } else { // check the user that is going to do the modification has the given role checkRole(dbc, role); } }
java
protected void checkRoleForUserModification(CmsDbContext dbc, String username, CmsRole role) throws CmsDataAccessException, CmsRoleViolationException { CmsUser userToModify = m_driverManager.readUser(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username)); if (dbc.currentUser().equals(userToModify)) { // a user is allowed to write his own data return; } if (hasRole(dbc, dbc.currentUser(), CmsRole.ROOT_ADMIN)) { // a user with the ROOT_ADMIN role may change any other user return; } if (hasRole(dbc, userToModify, CmsRole.ADMINISTRATOR)) { // check the user that is going to do the modification is administrator checkRole(dbc, CmsRole.ADMINISTRATOR); } else { // check the user that is going to do the modification has the given role checkRole(dbc, role); } }
[ "protected", "void", "checkRoleForUserModification", "(", "CmsDbContext", "dbc", ",", "String", "username", ",", "CmsRole", "role", ")", "throws", "CmsDataAccessException", ",", "CmsRoleViolationException", "{", "CmsUser", "userToModify", "=", "m_driverManager", ".", "readUser", "(", "dbc", ",", "CmsOrganizationalUnit", ".", "removeLeadingSeparator", "(", "username", ")", ")", ";", "if", "(", "dbc", ".", "currentUser", "(", ")", ".", "equals", "(", "userToModify", ")", ")", "{", "// a user is allowed to write his own data", "return", ";", "}", "if", "(", "hasRole", "(", "dbc", ",", "dbc", ".", "currentUser", "(", ")", ",", "CmsRole", ".", "ROOT_ADMIN", ")", ")", "{", "// a user with the ROOT_ADMIN role may change any other user", "return", ";", "}", "if", "(", "hasRole", "(", "dbc", ",", "userToModify", ",", "CmsRole", ".", "ADMINISTRATOR", ")", ")", "{", "// check the user that is going to do the modification is administrator", "checkRole", "(", "dbc", ",", "CmsRole", ".", "ADMINISTRATOR", ")", ";", "}", "else", "{", "// check the user that is going to do the modification has the given role", "checkRole", "(", "dbc", ",", "role", ")", ";", "}", "}" ]
Checks that the current user has enough permissions to modify the given user.<p> @param dbc the database context @param username the name of the user to modify @param role the needed role @throws CmsDataAccessException if something goes wrong accessing the database @throws CmsRoleViolationException if the user has not the needed permissions
[ "Checks", "that", "the", "current", "user", "has", "enough", "permissions", "to", "modify", "the", "given", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L7093-L7113
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.readUser
public CmsUser readUser(String username, String password) throws CmsException { """ Returns a user, if the password is correct.<p> If the user/pwd pair is not valid a <code>{@link CmsException}</code> is thrown.<p> @param username the name of the user to be returned @param password the password of the user to be returned @return the validated user @throws CmsException if operation was not successful """ return m_securityManager.readUser(m_context, username, password); }
java
public CmsUser readUser(String username, String password) throws CmsException { return m_securityManager.readUser(m_context, username, password); }
[ "public", "CmsUser", "readUser", "(", "String", "username", ",", "String", "password", ")", "throws", "CmsException", "{", "return", "m_securityManager", ".", "readUser", "(", "m_context", ",", "username", ",", "password", ")", ";", "}" ]
Returns a user, if the password is correct.<p> If the user/pwd pair is not valid a <code>{@link CmsException}</code> is thrown.<p> @param username the name of the user to be returned @param password the password of the user to be returned @return the validated user @throws CmsException if operation was not successful
[ "Returns", "a", "user", "if", "the", "password", "is", "correct", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3579-L3582
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java
CompletionUtils.findInstancesFilesToImport
public static Set<String> findInstancesFilesToImport( File appDirectory, File editedFile, String fileContent ) { """ Finds all the instances files that can be imported. @param appDirectory the application's directory @param editedFile the graph file that is being edited @param fileContent the file content (not null) @return a non-null set of (relative) file paths """ File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); return findFilesToImport( instancesDir, Constants.FILE_EXT_INSTANCES, editedFile, fileContent ); }
java
public static Set<String> findInstancesFilesToImport( File appDirectory, File editedFile, String fileContent ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); return findFilesToImport( instancesDir, Constants.FILE_EXT_INSTANCES, editedFile, fileContent ); }
[ "public", "static", "Set", "<", "String", ">", "findInstancesFilesToImport", "(", "File", "appDirectory", ",", "File", "editedFile", ",", "String", "fileContent", ")", "{", "File", "instancesDir", "=", "new", "File", "(", "appDirectory", ",", "Constants", ".", "PROJECT_DIR_INSTANCES", ")", ";", "return", "findFilesToImport", "(", "instancesDir", ",", "Constants", ".", "FILE_EXT_INSTANCES", ",", "editedFile", ",", "fileContent", ")", ";", "}" ]
Finds all the instances files that can be imported. @param appDirectory the application's directory @param editedFile the graph file that is being edited @param fileContent the file content (not null) @return a non-null set of (relative) file paths
[ "Finds", "all", "the", "instances", "files", "that", "can", "be", "imported", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L90-L94
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java
FastHashMap.putAll
public void putAll(Map<? extends K, ? extends V> map) { """ Copies all of the mappings from the specified map to this {@link FastMap}. @param map the mappings to be stored in this map. @throws NullPointerException the specified map is <code>null</code>, or the specified map contains <code>null</code> keys. """ for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) { addEntry(e.getKey(), e.getValue()); } }
java
public void putAll(Map<? extends K, ? extends V> map) { for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) { addEntry(e.getKey(), e.getValue()); } }
[ "public", "void", "putAll", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "map", ")", "{", "for", "(", "Map", ".", "Entry", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "e", ":", "map", ".", "entrySet", "(", ")", ")", "{", "addEntry", "(", "e", ".", "getKey", "(", ")", ",", "e", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Copies all of the mappings from the specified map to this {@link FastMap}. @param map the mappings to be stored in this map. @throws NullPointerException the specified map is <code>null</code>, or the specified map contains <code>null</code> keys.
[ "Copies", "all", "of", "the", "mappings", "from", "the", "specified", "map", "to", "this", "{", "@link", "FastMap", "}", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L243-L247
kejunxia/AndroidMvc
library/poke/src/main/java/com/shipdream/lib/poke/Component.java
Component.unregister
public <T> Component unregister(Class<T> type, Annotation qualifier) throws ProviderMissingException { """ Find the provider in this {@link Component} and its descents. If the provider is found, detach it from its associated {@link Component}. After this point, the provider will use its own scope instances. @param type The type of the provider @param qualifier The qualifier of the provider @return this instance @throws ProviderMissingException Thrown when the provider with the given type and qualifier cannot be found under this component """ //Detach corresponding provider from it's component Provider<T> provider = findProvider(type, qualifier); provider.setComponent(null); String key = PokeHelper.makeProviderKey(type, qualifier); Component targetComponent = getRootComponent().componentLocator.get(key); targetComponent.providers.remove(key); if (targetComponent.scopeCache != null) { targetComponent.scopeCache.removeInstance(PokeHelper.makeProviderKey(type, qualifier)); } Component root = getRootComponent(); //Remove it from root component's locator root.componentLocator.remove(key); return this; }
java
public <T> Component unregister(Class<T> type, Annotation qualifier) throws ProviderMissingException { //Detach corresponding provider from it's component Provider<T> provider = findProvider(type, qualifier); provider.setComponent(null); String key = PokeHelper.makeProviderKey(type, qualifier); Component targetComponent = getRootComponent().componentLocator.get(key); targetComponent.providers.remove(key); if (targetComponent.scopeCache != null) { targetComponent.scopeCache.removeInstance(PokeHelper.makeProviderKey(type, qualifier)); } Component root = getRootComponent(); //Remove it from root component's locator root.componentLocator.remove(key); return this; }
[ "public", "<", "T", ">", "Component", "unregister", "(", "Class", "<", "T", ">", "type", ",", "Annotation", "qualifier", ")", "throws", "ProviderMissingException", "{", "//Detach corresponding provider from it's component", "Provider", "<", "T", ">", "provider", "=", "findProvider", "(", "type", ",", "qualifier", ")", ";", "provider", ".", "setComponent", "(", "null", ")", ";", "String", "key", "=", "PokeHelper", ".", "makeProviderKey", "(", "type", ",", "qualifier", ")", ";", "Component", "targetComponent", "=", "getRootComponent", "(", ")", ".", "componentLocator", ".", "get", "(", "key", ")", ";", "targetComponent", ".", "providers", ".", "remove", "(", "key", ")", ";", "if", "(", "targetComponent", ".", "scopeCache", "!=", "null", ")", "{", "targetComponent", ".", "scopeCache", ".", "removeInstance", "(", "PokeHelper", ".", "makeProviderKey", "(", "type", ",", "qualifier", ")", ")", ";", "}", "Component", "root", "=", "getRootComponent", "(", ")", ";", "//Remove it from root component's locator", "root", ".", "componentLocator", ".", "remove", "(", "key", ")", ";", "return", "this", ";", "}" ]
Find the provider in this {@link Component} and its descents. If the provider is found, detach it from its associated {@link Component}. After this point, the provider will use its own scope instances. @param type The type of the provider @param qualifier The qualifier of the provider @return this instance @throws ProviderMissingException Thrown when the provider with the given type and qualifier cannot be found under this component
[ "Find", "the", "provider", "in", "this", "{", "@link", "Component", "}", "and", "its", "descents", ".", "If", "the", "provider", "is", "found", "detach", "it", "from", "its", "associated", "{", "@link", "Component", "}", ".", "After", "this", "point", "the", "provider", "will", "use", "its", "own", "scope", "instances", ".", "@param", "type", "The", "type", "of", "the", "provider", "@param", "qualifier", "The", "qualifier", "of", "the", "provider", "@return", "this", "instance" ]
train
https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/poke/src/main/java/com/shipdream/lib/poke/Component.java#L209-L227
vdmeer/asciitable
src/main/java/de/vandermeer/asciitable/AT_Context.java
AT_Context.setFrameLeftRightChar
public AT_Context setFrameLeftRightChar(Character frameLeft, Character frameRight) { """ Sets the left and right frame margin character. @param frameLeft character @param frameRight character @return this to allow chaining """ if(frameLeft!=null && frameRight!=null){ this.frameLeftChar = frameLeft; this.frameRightChar = frameRight; } return this; }
java
public AT_Context setFrameLeftRightChar(Character frameLeft, Character frameRight){ if(frameLeft!=null && frameRight!=null){ this.frameLeftChar = frameLeft; this.frameRightChar = frameRight; } return this; }
[ "public", "AT_Context", "setFrameLeftRightChar", "(", "Character", "frameLeft", ",", "Character", "frameRight", ")", "{", "if", "(", "frameLeft", "!=", "null", "&&", "frameRight", "!=", "null", ")", "{", "this", ".", "frameLeftChar", "=", "frameLeft", ";", "this", ".", "frameRightChar", "=", "frameRight", ";", "}", "return", "this", ";", "}" ]
Sets the left and right frame margin character. @param frameLeft character @param frameRight character @return this to allow chaining
[ "Sets", "the", "left", "and", "right", "frame", "margin", "character", "." ]
train
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Context.java#L216-L222
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.removePathAndBlocks
void removePathAndBlocks(String src, List<BlockInfo> blocks) throws IOException { """ Remove the blocks from the given list. Also, remove the path. Add the blocks to invalidates, and set a flag that explicit ACK from DataNode is not required. This function should be used only for deleting entire files. """ // No need for lock until we start accepting requests from clients. assert (!nameNode.isRpcServerRunning() || hasWriteLock()); leaseManager.removeLeaseWithPrefixPath(src); removeBlocks(blocks); }
java
void removePathAndBlocks(String src, List<BlockInfo> blocks) throws IOException { // No need for lock until we start accepting requests from clients. assert (!nameNode.isRpcServerRunning() || hasWriteLock()); leaseManager.removeLeaseWithPrefixPath(src); removeBlocks(blocks); }
[ "void", "removePathAndBlocks", "(", "String", "src", ",", "List", "<", "BlockInfo", ">", "blocks", ")", "throws", "IOException", "{", "// No need for lock until we start accepting requests from clients.", "assert", "(", "!", "nameNode", ".", "isRpcServerRunning", "(", ")", "||", "hasWriteLock", "(", ")", ")", ";", "leaseManager", ".", "removeLeaseWithPrefixPath", "(", "src", ")", ";", "removeBlocks", "(", "blocks", ")", ";", "}" ]
Remove the blocks from the given list. Also, remove the path. Add the blocks to invalidates, and set a flag that explicit ACK from DataNode is not required. This function should be used only for deleting entire files.
[ "Remove", "the", "blocks", "from", "the", "given", "list", ".", "Also", "remove", "the", "path", ".", "Add", "the", "blocks", "to", "invalidates", "and", "set", "a", "flag", "that", "explicit", "ACK", "from", "DataNode", "is", "not", "required", ".", "This", "function", "should", "be", "used", "only", "for", "deleting", "entire", "files", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3891-L3896
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java
DomainsInner.beginUpdate
public DomainInner beginUpdate(String resourceGroupName, String domainName, Map<String, String> tags) { """ Update a domain. Asynchronously updates a domain with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the domain @param tags Tags of the domains resource @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 DomainInner object if successful. """ return beginUpdateWithServiceResponseAsync(resourceGroupName, domainName, tags).toBlocking().single().body(); }
java
public DomainInner beginUpdate(String resourceGroupName, String domainName, Map<String, String> tags) { return beginUpdateWithServiceResponseAsync(resourceGroupName, domainName, tags).toBlocking().single().body(); }
[ "public", "DomainInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "domainName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ",", "tags", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Update a domain. Asynchronously updates a domain with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the domain @param tags Tags of the domains resource @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 DomainInner object if successful.
[ "Update", "a", "domain", ".", "Asynchronously", "updates", "a", "domain", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L799-L801
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java
SecurityDomainJBossASClient.createNewSecureIdentitySecurityDomain72
public void createNewSecureIdentitySecurityDomain72(String securityDomainName, String username, String password) throws Exception { """ Create a new security domain using the SecureIdentity authentication method. This is used when you want to obfuscate a database password in the configuration. This is the version for as7.2+ (e.g. eap 6.1) @param securityDomainName the name of the new security domain @param username the username associated with the security domain @param password the value of the password to store in the configuration (e.g. the obfuscated password itself) @throws Exception if failed to create security domain """ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName); ModelNode addTopNode = createRequest(ADD, addr); addTopNode.get(CACHE_TYPE).set("default"); Address authAddr = addr.clone().add(AUTHENTICATION, CLASSIC); ModelNode addAuthNode = createRequest(ADD, authAddr); Address loginAddr = authAddr.clone().add("login-module", "SecureIdentity"); ModelNode loginModule = createRequest(ADD, loginAddr); loginModule.get(CODE).set("SecureIdentity"); loginModule.get(FLAG).set("required"); ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS); moduleOptions.setEmptyList(); addPossibleExpression(moduleOptions, USERNAME, username); addPossibleExpression(moduleOptions, PASSWORD, password); ModelNode batch = createBatchRequest(addTopNode, addAuthNode, loginModule); ModelNode results = execute(batch); if (!isSuccess(results)) { throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]"); } return; }
java
public void createNewSecureIdentitySecurityDomain72(String securityDomainName, String username, String password) throws Exception { Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName); ModelNode addTopNode = createRequest(ADD, addr); addTopNode.get(CACHE_TYPE).set("default"); Address authAddr = addr.clone().add(AUTHENTICATION, CLASSIC); ModelNode addAuthNode = createRequest(ADD, authAddr); Address loginAddr = authAddr.clone().add("login-module", "SecureIdentity"); ModelNode loginModule = createRequest(ADD, loginAddr); loginModule.get(CODE).set("SecureIdentity"); loginModule.get(FLAG).set("required"); ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS); moduleOptions.setEmptyList(); addPossibleExpression(moduleOptions, USERNAME, username); addPossibleExpression(moduleOptions, PASSWORD, password); ModelNode batch = createBatchRequest(addTopNode, addAuthNode, loginModule); ModelNode results = execute(batch); if (!isSuccess(results)) { throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]"); } return; }
[ "public", "void", "createNewSecureIdentitySecurityDomain72", "(", "String", "securityDomainName", ",", "String", "username", ",", "String", "password", ")", "throws", "Exception", "{", "Address", "addr", "=", "Address", ".", "root", "(", ")", ".", "add", "(", "SUBSYSTEM", ",", "SUBSYSTEM_SECURITY", ",", "SECURITY_DOMAIN", ",", "securityDomainName", ")", ";", "ModelNode", "addTopNode", "=", "createRequest", "(", "ADD", ",", "addr", ")", ";", "addTopNode", ".", "get", "(", "CACHE_TYPE", ")", ".", "set", "(", "\"default\"", ")", ";", "Address", "authAddr", "=", "addr", ".", "clone", "(", ")", ".", "add", "(", "AUTHENTICATION", ",", "CLASSIC", ")", ";", "ModelNode", "addAuthNode", "=", "createRequest", "(", "ADD", ",", "authAddr", ")", ";", "Address", "loginAddr", "=", "authAddr", ".", "clone", "(", ")", ".", "add", "(", "\"login-module\"", ",", "\"SecureIdentity\"", ")", ";", "ModelNode", "loginModule", "=", "createRequest", "(", "ADD", ",", "loginAddr", ")", ";", "loginModule", ".", "get", "(", "CODE", ")", ".", "set", "(", "\"SecureIdentity\"", ")", ";", "loginModule", ".", "get", "(", "FLAG", ")", ".", "set", "(", "\"required\"", ")", ";", "ModelNode", "moduleOptions", "=", "loginModule", ".", "get", "(", "MODULE_OPTIONS", ")", ";", "moduleOptions", ".", "setEmptyList", "(", ")", ";", "addPossibleExpression", "(", "moduleOptions", ",", "USERNAME", ",", "username", ")", ";", "addPossibleExpression", "(", "moduleOptions", ",", "PASSWORD", ",", "password", ")", ";", "ModelNode", "batch", "=", "createBatchRequest", "(", "addTopNode", ",", "addAuthNode", ",", "loginModule", ")", ";", "ModelNode", "results", "=", "execute", "(", "batch", ")", ";", "if", "(", "!", "isSuccess", "(", "results", ")", ")", "{", "throw", "new", "FailureException", "(", "results", ",", "\"Failed to create security domain [\"", "+", "securityDomainName", "+", "\"]\"", ")", ";", "}", "return", ";", "}" ]
Create a new security domain using the SecureIdentity authentication method. This is used when you want to obfuscate a database password in the configuration. This is the version for as7.2+ (e.g. eap 6.1) @param securityDomainName the name of the new security domain @param username the username associated with the security domain @param password the value of the password to store in the configuration (e.g. the obfuscated password itself) @throws Exception if failed to create security domain
[ "Create", "a", "new", "security", "domain", "using", "the", "SecureIdentity", "authentication", "method", ".", "This", "is", "used", "when", "you", "want", "to", "obfuscate", "a", "database", "password", "in", "the", "configuration", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L85-L113
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResponseResult.java
CreateIntegrationResponseResult.withResponseParameters
public CreateIntegrationResponseResult withResponseParameters(java.util.Map<String, String> responseParameters) { """ <p> A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where name is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where name is a valid and unique response header name and JSON-expression is a valid JSON expression without the $ prefix. </p> @param responseParameters A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where name is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where name is a valid and unique response header name and JSON-expression is a valid JSON expression without the $ prefix. @return Returns a reference to this object so that method calls can be chained together. """ setResponseParameters(responseParameters); return this; }
java
public CreateIntegrationResponseResult withResponseParameters(java.util.Map<String, String> responseParameters) { setResponseParameters(responseParameters); return this; }
[ "public", "CreateIntegrationResponseResult", "withResponseParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseParameters", ")", "{", "setResponseParameters", "(", "responseParameters", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where name is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where name is a valid and unique response header name and JSON-expression is a valid JSON expression without the $ prefix. </p> @param responseParameters A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where name is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where name is a valid and unique response header name and JSON-expression is a valid JSON expression without the $ prefix. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "specifying", "response", "parameters", "that", "are", "passed", "to", "the", "method", "response", "from", "the", "backend", ".", "The", "key", "is", "a", "method", "response", "header", "parameter", "name", "and", "the", "mapped", "value", "is", "an", "integration", "response", "header", "value", "a", "static", "value", "enclosed", "within", "a", "pair", "of", "single", "quotes", "or", "a", "JSON", "expression", "from", "the", "integration", "response", "body", ".", "The", "mapping", "key", "must", "match", "the", "pattern", "of", "method", ".", "response", ".", "header", ".", "{", "name", "}", "where", "name", "is", "a", "valid", "and", "unique", "header", "name", ".", "The", "mapped", "non", "-", "static", "value", "must", "match", "the", "pattern", "of", "integration", ".", "response", ".", "header", ".", "{", "name", "}", "or", "integration", ".", "response", ".", "body", ".", "{", "JSON", "-", "expression", "}", "where", "name", "is", "a", "valid", "and", "unique", "response", "header", "name", "and", "JSON", "-", "expression", "is", "a", "valid", "JSON", "expression", "without", "the", "$", "prefix", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResponseResult.java#L375-L378
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault-webkey/src/main/java/com/microsoft/azure/keyvault/webkey/JsonWebKey.java
JsonWebKey.toEC
public KeyPair toEC(boolean includePrivateParameters, Provider provider) { """ Converts JSON web key to EC key pair and include the private key if set to true. @param includePrivateParameters true if the EC key pair should include the private key. False otherwise. @param provider Java security provider @return EC key pair """ if (provider == null) { // Our default provider for this class provider = Security.getProvider("SunEC"); } if (!JsonWebKeyType.EC.equals(kty) && !JsonWebKeyType.EC_HSM.equals(kty)) { throw new IllegalArgumentException("Not an EC key."); } try { KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider); ECGenParameterSpec gps = new ECGenParameterSpec(CURVE_TO_SPEC_NAME.get(crv)); kpg.initialize(gps); // Generate dummy keypair to get parameter spec. KeyPair apair = kpg.generateKeyPair(); ECPublicKey apub = (ECPublicKey) apair.getPublic(); ECParameterSpec aspec = apub.getParams(); ECPoint ecPoint = new ECPoint(new BigInteger(1, x), new BigInteger(1, y)); KeyPair realKeyPair; if (includePrivateParameters) { realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), getECPrivateKey(d, aspec, provider)); } else { realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), null); } return realKeyPair; } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }
java
public KeyPair toEC(boolean includePrivateParameters, Provider provider) { if (provider == null) { // Our default provider for this class provider = Security.getProvider("SunEC"); } if (!JsonWebKeyType.EC.equals(kty) && !JsonWebKeyType.EC_HSM.equals(kty)) { throw new IllegalArgumentException("Not an EC key."); } try { KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider); ECGenParameterSpec gps = new ECGenParameterSpec(CURVE_TO_SPEC_NAME.get(crv)); kpg.initialize(gps); // Generate dummy keypair to get parameter spec. KeyPair apair = kpg.generateKeyPair(); ECPublicKey apub = (ECPublicKey) apair.getPublic(); ECParameterSpec aspec = apub.getParams(); ECPoint ecPoint = new ECPoint(new BigInteger(1, x), new BigInteger(1, y)); KeyPair realKeyPair; if (includePrivateParameters) { realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), getECPrivateKey(d, aspec, provider)); } else { realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), null); } return realKeyPair; } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }
[ "public", "KeyPair", "toEC", "(", "boolean", "includePrivateParameters", ",", "Provider", "provider", ")", "{", "if", "(", "provider", "==", "null", ")", "{", "// Our default provider for this class", "provider", "=", "Security", ".", "getProvider", "(", "\"SunEC\"", ")", ";", "}", "if", "(", "!", "JsonWebKeyType", ".", "EC", ".", "equals", "(", "kty", ")", "&&", "!", "JsonWebKeyType", ".", "EC_HSM", ".", "equals", "(", "kty", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Not an EC key.\"", ")", ";", "}", "try", "{", "KeyPairGenerator", "kpg", "=", "KeyPairGenerator", ".", "getInstance", "(", "\"EC\"", ",", "provider", ")", ";", "ECGenParameterSpec", "gps", "=", "new", "ECGenParameterSpec", "(", "CURVE_TO_SPEC_NAME", ".", "get", "(", "crv", ")", ")", ";", "kpg", ".", "initialize", "(", "gps", ")", ";", "// Generate dummy keypair to get parameter spec.", "KeyPair", "apair", "=", "kpg", ".", "generateKeyPair", "(", ")", ";", "ECPublicKey", "apub", "=", "(", "ECPublicKey", ")", "apair", ".", "getPublic", "(", ")", ";", "ECParameterSpec", "aspec", "=", "apub", ".", "getParams", "(", ")", ";", "ECPoint", "ecPoint", "=", "new", "ECPoint", "(", "new", "BigInteger", "(", "1", ",", "x", ")", ",", "new", "BigInteger", "(", "1", ",", "y", ")", ")", ";", "KeyPair", "realKeyPair", ";", "if", "(", "includePrivateParameters", ")", "{", "realKeyPair", "=", "new", "KeyPair", "(", "getECPublicKey", "(", "ecPoint", ",", "aspec", ",", "provider", ")", ",", "getECPrivateKey", "(", "d", ",", "aspec", ",", "provider", ")", ")", ";", "}", "else", "{", "realKeyPair", "=", "new", "KeyPair", "(", "getECPublicKey", "(", "ecPoint", ",", "aspec", ",", "provider", ")", ",", "null", ")", ";", "}", "return", "realKeyPair", ";", "}", "catch", "(", "GeneralSecurityException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "e", ")", ";", "}", "}" ]
Converts JSON web key to EC key pair and include the private key if set to true. @param includePrivateParameters true if the EC key pair should include the private key. False otherwise. @param provider Java security provider @return EC key pair
[ "Converts", "JSON", "web", "key", "to", "EC", "key", "pair", "and", "include", "the", "private", "key", "if", "set", "to", "true", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault-webkey/src/main/java/com/microsoft/azure/keyvault/webkey/JsonWebKey.java#L770-L807
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java
GeometryFactory.createMultiPolygon
public MultiPolygon createMultiPolygon(Polygon[] polygons) { """ Create a new {@link MultiPolygon}, given an array of polygons. @param polygons An array of {@link Polygon} objects . @return Returns a {@link MultiPolygon} object. """ if (polygons == null) { return new MultiPolygon(srid, precision); } Polygon[] clones = new Polygon[polygons.length]; for (int i = 0; i < polygons.length; i++) { clones[i] = (Polygon) polygons[i].clone(); } return new MultiPolygon(srid, precision, clones); }
java
public MultiPolygon createMultiPolygon(Polygon[] polygons) { if (polygons == null) { return new MultiPolygon(srid, precision); } Polygon[] clones = new Polygon[polygons.length]; for (int i = 0; i < polygons.length; i++) { clones[i] = (Polygon) polygons[i].clone(); } return new MultiPolygon(srid, precision, clones); }
[ "public", "MultiPolygon", "createMultiPolygon", "(", "Polygon", "[", "]", "polygons", ")", "{", "if", "(", "polygons", "==", "null", ")", "{", "return", "new", "MultiPolygon", "(", "srid", ",", "precision", ")", ";", "}", "Polygon", "[", "]", "clones", "=", "new", "Polygon", "[", "polygons", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "polygons", ".", "length", ";", "i", "++", ")", "{", "clones", "[", "i", "]", "=", "(", "Polygon", ")", "polygons", "[", "i", "]", ".", "clone", "(", ")", ";", "}", "return", "new", "MultiPolygon", "(", "srid", ",", "precision", ",", "clones", ")", ";", "}" ]
Create a new {@link MultiPolygon}, given an array of polygons. @param polygons An array of {@link Polygon} objects . @return Returns a {@link MultiPolygon} object.
[ "Create", "a", "new", "{", "@link", "MultiPolygon", "}", "given", "an", "array", "of", "polygons", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L212-L221
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttChartView14.java
GanttChartView14.getFieldType
private FieldType getFieldType(byte[] data, int offset) { """ Retrieves a field type from a location in a data block. @param data data block @param offset offset into data block @return field type """ int fieldIndex = MPPUtility.getInt(data, offset); return FieldTypeHelper.mapTextFields(FieldTypeHelper.getInstance14(fieldIndex)); }
java
private FieldType getFieldType(byte[] data, int offset) { int fieldIndex = MPPUtility.getInt(data, offset); return FieldTypeHelper.mapTextFields(FieldTypeHelper.getInstance14(fieldIndex)); }
[ "private", "FieldType", "getFieldType", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "fieldIndex", "=", "MPPUtility", ".", "getInt", "(", "data", ",", "offset", ")", ";", "return", "FieldTypeHelper", ".", "mapTextFields", "(", "FieldTypeHelper", ".", "getInstance14", "(", "fieldIndex", ")", ")", ";", "}" ]
Retrieves a field type from a location in a data block. @param data data block @param offset offset into data block @return field type
[ "Retrieves", "a", "field", "type", "from", "a", "location", "in", "a", "data", "block", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView14.java#L127-L131
kyoken74/gwt-angular-site
gwt-angular-examples/Promise/src/main/java/com/asayama/gwt/angular/site/examples/client/service/GreetingService.java
GreetingService.getSalutation
public Promise<String> getSalutation() { """ Returns a promise of salutation by simulating an asynchronous call with a time-out. """ final Deferred<String> d = q.defer(); Timer timer = new Timer() { @Override public void run() { d.progress(new TimerProgress("Loaded salutation", this)); d.resolve("Hello"); } }; d.progress(new TimerProgress("Loading salutation...", timer)); timer.schedule(1000); return d.promise(); }
java
public Promise<String> getSalutation() { final Deferred<String> d = q.defer(); Timer timer = new Timer() { @Override public void run() { d.progress(new TimerProgress("Loaded salutation", this)); d.resolve("Hello"); } }; d.progress(new TimerProgress("Loading salutation...", timer)); timer.schedule(1000); return d.promise(); }
[ "public", "Promise", "<", "String", ">", "getSalutation", "(", ")", "{", "final", "Deferred", "<", "String", ">", "d", "=", "q", ".", "defer", "(", ")", ";", "Timer", "timer", "=", "new", "Timer", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "d", ".", "progress", "(", "new", "TimerProgress", "(", "\"Loaded salutation\"", ",", "this", ")", ")", ";", "d", ".", "resolve", "(", "\"Hello\"", ")", ";", "}", "}", ";", "d", ".", "progress", "(", "new", "TimerProgress", "(", "\"Loading salutation...\"", ",", "timer", ")", ")", ";", "timer", ".", "schedule", "(", "1000", ")", ";", "return", "d", ".", "promise", "(", ")", ";", "}" ]
Returns a promise of salutation by simulating an asynchronous call with a time-out.
[ "Returns", "a", "promise", "of", "salutation", "by", "simulating", "an", "asynchronous", "call", "with", "a", "time", "-", "out", "." ]
train
https://github.com/kyoken74/gwt-angular-site/blob/12134f4910abe41145d0020e886620605eb03749/gwt-angular-examples/Promise/src/main/java/com/asayama/gwt/angular/site/examples/client/service/GreetingService.java#L34-L47
nohana/Amalgam
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
BitmapUtils.getSize
public static Point getSize(byte[] byteArray, int offset, int length) { """ Get width and height of the bitmap specified with the byte array. @param byteArray the bitmap itself. @param offset offset index. @param length array length. @return the size. """ BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(byteArray, offset, length, options); int width = options.outWidth; int height = options.outHeight; return new Point(width, height); }
java
public static Point getSize(byte[] byteArray, int offset, int length) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(byteArray, offset, length, options); int width = options.outWidth; int height = options.outHeight; return new Point(width, height); }
[ "public", "static", "Point", "getSize", "(", "byte", "[", "]", "byteArray", ",", "int", "offset", ",", "int", "length", ")", "{", "BitmapFactory", ".", "Options", "options", "=", "new", "BitmapFactory", ".", "Options", "(", ")", ";", "options", ".", "inJustDecodeBounds", "=", "true", ";", "BitmapFactory", ".", "decodeByteArray", "(", "byteArray", ",", "offset", ",", "length", ",", "options", ")", ";", "int", "width", "=", "options", ".", "outWidth", ";", "int", "height", "=", "options", ".", "outHeight", ";", "return", "new", "Point", "(", "width", ",", "height", ")", ";", "}" ]
Get width and height of the bitmap specified with the byte array. @param byteArray the bitmap itself. @param offset offset index. @param length array length. @return the size.
[ "Get", "width", "and", "height", "of", "the", "bitmap", "specified", "with", "the", "byte", "array", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L128-L135
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java
WidgetsUtils.matchesTags
public static boolean matchesTags(Element e, String... tagNames) { """ Test if the tag name of the element is one of tag names given in parameter. @param tagNames @return """ assert e != null : "Element cannot be null"; StringBuilder regExp = new StringBuilder("^("); int tagNameLenght = tagNames != null ? tagNames.length : 0; for (int i = 0; i < tagNameLenght; i++) { regExp.append(tagNames[i].toUpperCase()); if (i < tagNameLenght - 1) { regExp.append("|"); } } regExp.append(")$"); return e.getTagName().toUpperCase().matches(regExp.toString()); }
java
public static boolean matchesTags(Element e, String... tagNames) { assert e != null : "Element cannot be null"; StringBuilder regExp = new StringBuilder("^("); int tagNameLenght = tagNames != null ? tagNames.length : 0; for (int i = 0; i < tagNameLenght; i++) { regExp.append(tagNames[i].toUpperCase()); if (i < tagNameLenght - 1) { regExp.append("|"); } } regExp.append(")$"); return e.getTagName().toUpperCase().matches(regExp.toString()); }
[ "public", "static", "boolean", "matchesTags", "(", "Element", "e", ",", "String", "...", "tagNames", ")", "{", "assert", "e", "!=", "null", ":", "\"Element cannot be null\"", ";", "StringBuilder", "regExp", "=", "new", "StringBuilder", "(", "\"^(\"", ")", ";", "int", "tagNameLenght", "=", "tagNames", "!=", "null", "?", "tagNames", ".", "length", ":", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tagNameLenght", ";", "i", "++", ")", "{", "regExp", ".", "append", "(", "tagNames", "[", "i", "]", ".", "toUpperCase", "(", ")", ")", ";", "if", "(", "i", "<", "tagNameLenght", "-", "1", ")", "{", "regExp", ".", "append", "(", "\"|\"", ")", ";", "}", "}", "regExp", ".", "append", "(", "\")$\"", ")", ";", "return", "e", ".", "getTagName", "(", ")", ".", "toUpperCase", "(", ")", ".", "matches", "(", "regExp", ".", "toString", "(", ")", ")", ";", "}" ]
Test if the tag name of the element is one of tag names given in parameter. @param tagNames @return
[ "Test", "if", "the", "tag", "name", "of", "the", "element", "is", "one", "of", "tag", "names", "given", "in", "parameter", "." ]
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java#L67-L82
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/GroupController.java
GroupController.editGroup
@RequestMapping(value = "group/ { """ Redirect to a edit group page @param model @param groupId @return @throws Exception """groupId}", method = RequestMethod.GET) public String editGroup(Model model, @PathVariable int groupId) throws Exception { model.addAttribute("groupName", pathOverrideService.getGroupNameFromId(groupId)); model.addAttribute("groupId", groupId); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(pluginManager.getMethodsNotInGroup(groupId)); model.addAttribute("methodsNotInGroup", json); return "editGroup"; }
java
@RequestMapping(value = "group/{groupId}", method = RequestMethod.GET) public String editGroup(Model model, @PathVariable int groupId) throws Exception { model.addAttribute("groupName", pathOverrideService.getGroupNameFromId(groupId)); model.addAttribute("groupId", groupId); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(pluginManager.getMethodsNotInGroup(groupId)); model.addAttribute("methodsNotInGroup", json); return "editGroup"; }
[ "@", "RequestMapping", "(", "value", "=", "\"group/{groupId}\"", ",", "method", "=", "RequestMethod", ".", "GET", ")", "public", "String", "editGroup", "(", "Model", "model", ",", "@", "PathVariable", "int", "groupId", ")", "throws", "Exception", "{", "model", ".", "addAttribute", "(", "\"groupName\"", ",", "pathOverrideService", ".", "getGroupNameFromId", "(", "groupId", ")", ")", ";", "model", ".", "addAttribute", "(", "\"groupId\"", ",", "groupId", ")", ";", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "String", "json", "=", "mapper", ".", "writeValueAsString", "(", "pluginManager", ".", "getMethodsNotInGroup", "(", "groupId", ")", ")", ";", "model", ".", "addAttribute", "(", "\"methodsNotInGroup\"", ",", "json", ")", ";", "return", "\"editGroup\"", ";", "}" ]
Redirect to a edit group page @param model @param groupId @return @throws Exception
[ "Redirect", "to", "a", "edit", "group", "page" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/GroupController.java#L101-L112
GerdHolz/TOVAL
src/de/invation/code/toval/statistic/ExtendedObservation.java
ExtendedObservation.resetMomentObservation
private void resetMomentObservation() { """ Resets the moment observations.<br> If there are no observations yet, new observations are created and added to the map.<br> Otherwise existing observations are reset. """ if (momentObservation.isEmpty()) { Observation o; for (int i : momentDegrees) { o = new Observation("moment "+i, true); o.setStandardPrecision(momentPrecision); momentObservation.put(i, o); } } else { for (Observation o : momentObservation.values()) o.reset(); } }
java
private void resetMomentObservation() { if (momentObservation.isEmpty()) { Observation o; for (int i : momentDegrees) { o = new Observation("moment "+i, true); o.setStandardPrecision(momentPrecision); momentObservation.put(i, o); } } else { for (Observation o : momentObservation.values()) o.reset(); } }
[ "private", "void", "resetMomentObservation", "(", ")", "{", "if", "(", "momentObservation", ".", "isEmpty", "(", ")", ")", "{", "Observation", "o", ";", "for", "(", "int", "i", ":", "momentDegrees", ")", "{", "o", "=", "new", "Observation", "(", "\"moment \"", "+", "i", ",", "true", ")", ";", "o", ".", "setStandardPrecision", "(", "momentPrecision", ")", ";", "momentObservation", ".", "put", "(", "i", ",", "o", ")", ";", "}", "}", "else", "{", "for", "(", "Observation", "o", ":", "momentObservation", ".", "values", "(", ")", ")", "o", ".", "reset", "(", ")", ";", "}", "}" ]
Resets the moment observations.<br> If there are no observations yet, new observations are created and added to the map.<br> Otherwise existing observations are reset.
[ "Resets", "the", "moment", "observations", ".", "<br", ">", "If", "there", "are", "no", "observations", "yet", "new", "observations", "are", "created", "and", "added", "to", "the", "map", ".", "<br", ">", "Otherwise", "existing", "observations", "are", "reset", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/statistic/ExtendedObservation.java#L133-L145
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/FileListener.java
FileListener.doLocalCriteria
public boolean doLocalCriteria(StringBuffer strbFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { """ Set up/do the local criteria. @param strbFilter The SQL query string to add to. @param bIncludeFileName Include the file name with this query? @param vParamList The param list to add the raw data to (for prepared statements). @return True if you should not skip this record (does a check on the local data). """ boolean bDontSkip = true; FileListener nextListener = (FileListener)this.getNextEnabledListener(); if (nextListener != null) { boolean bOldState = nextListener.setEnabledListener(false); // Don't allow it to be called again bDontSkip = nextListener.doLocalCriteria(strbFilter, bIncludeFileName, vParamList); nextListener.setEnabledListener(bOldState); } else if (this.getOwner() != null) bDontSkip = this.getOwner().doLocalCriteria(strbFilter, bIncludeFileName, vParamList); return bDontSkip; // Don't skip (no criteria) }
java
public boolean doLocalCriteria(StringBuffer strbFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { boolean bDontSkip = true; FileListener nextListener = (FileListener)this.getNextEnabledListener(); if (nextListener != null) { boolean bOldState = nextListener.setEnabledListener(false); // Don't allow it to be called again bDontSkip = nextListener.doLocalCriteria(strbFilter, bIncludeFileName, vParamList); nextListener.setEnabledListener(bOldState); } else if (this.getOwner() != null) bDontSkip = this.getOwner().doLocalCriteria(strbFilter, bIncludeFileName, vParamList); return bDontSkip; // Don't skip (no criteria) }
[ "public", "boolean", "doLocalCriteria", "(", "StringBuffer", "strbFilter", ",", "boolean", "bIncludeFileName", ",", "Vector", "<", "BaseField", ">", "vParamList", ")", "{", "boolean", "bDontSkip", "=", "true", ";", "FileListener", "nextListener", "=", "(", "FileListener", ")", "this", ".", "getNextEnabledListener", "(", ")", ";", "if", "(", "nextListener", "!=", "null", ")", "{", "boolean", "bOldState", "=", "nextListener", ".", "setEnabledListener", "(", "false", ")", ";", "// Don't allow it to be called again", "bDontSkip", "=", "nextListener", ".", "doLocalCriteria", "(", "strbFilter", ",", "bIncludeFileName", ",", "vParamList", ")", ";", "nextListener", ".", "setEnabledListener", "(", "bOldState", ")", ";", "}", "else", "if", "(", "this", ".", "getOwner", "(", ")", "!=", "null", ")", "bDontSkip", "=", "this", ".", "getOwner", "(", ")", ".", "doLocalCriteria", "(", "strbFilter", ",", "bIncludeFileName", ",", "vParamList", ")", ";", "return", "bDontSkip", ";", "// Don't skip (no criteria)", "}" ]
Set up/do the local criteria. @param strbFilter The SQL query string to add to. @param bIncludeFileName Include the file name with this query? @param vParamList The param list to add the raw data to (for prepared statements). @return True if you should not skip this record (does a check on the local data).
[ "Set", "up", "/", "do", "the", "local", "criteria", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/FileListener.java#L193-L206
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
CommonsMetadataEngine.createCatalog
@Override public final void createCatalog(ClusterName targetCluster, CatalogMetadata catalogMetadata) throws ExecutionException, UnsupportedException { """ This method creates a catalog. @param targetCluster the target cluster where the catalog will be created. @param catalogMetadata the catalog metadata info. @throws UnsupportedException if an operation is not supported. @throws ExecutionException if an error happens. """ try { connectionHandler.startJob(targetCluster.getName()); if (logger.isDebugEnabled()) { logger.debug( "Creating catalog [" + catalogMetadata.getName().getName() + "] in cluster [" + targetCluster .getName() + "]"); } createCatalog(catalogMetadata, connectionHandler.getConnection(targetCluster.getName())); if (logger.isDebugEnabled()) { logger.debug("Catalog [" + catalogMetadata.getName().getName() + "] has been created successfully in cluster [" + targetCluster.getName() + "]"); } } finally { connectionHandler.endJob(targetCluster.getName()); } }
java
@Override public final void createCatalog(ClusterName targetCluster, CatalogMetadata catalogMetadata) throws ExecutionException, UnsupportedException { try { connectionHandler.startJob(targetCluster.getName()); if (logger.isDebugEnabled()) { logger.debug( "Creating catalog [" + catalogMetadata.getName().getName() + "] in cluster [" + targetCluster .getName() + "]"); } createCatalog(catalogMetadata, connectionHandler.getConnection(targetCluster.getName())); if (logger.isDebugEnabled()) { logger.debug("Catalog [" + catalogMetadata.getName().getName() + "] has been created successfully in cluster [" + targetCluster.getName() + "]"); } } finally { connectionHandler.endJob(targetCluster.getName()); } }
[ "@", "Override", "public", "final", "void", "createCatalog", "(", "ClusterName", "targetCluster", ",", "CatalogMetadata", "catalogMetadata", ")", "throws", "ExecutionException", ",", "UnsupportedException", "{", "try", "{", "connectionHandler", ".", "startJob", "(", "targetCluster", ".", "getName", "(", ")", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Creating catalog [\"", "+", "catalogMetadata", ".", "getName", "(", ")", ".", "getName", "(", ")", "+", "\"] in cluster [\"", "+", "targetCluster", ".", "getName", "(", ")", "+", "\"]\"", ")", ";", "}", "createCatalog", "(", "catalogMetadata", ",", "connectionHandler", ".", "getConnection", "(", "targetCluster", ".", "getName", "(", ")", ")", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Catalog [\"", "+", "catalogMetadata", ".", "getName", "(", ")", ".", "getName", "(", ")", "+", "\"] has been created successfully in cluster [\"", "+", "targetCluster", ".", "getName", "(", ")", "+", "\"]\"", ")", ";", "}", "}", "finally", "{", "connectionHandler", ".", "endJob", "(", "targetCluster", ".", "getName", "(", ")", ")", ";", "}", "}" ]
This method creates a catalog. @param targetCluster the target cluster where the catalog will be created. @param catalogMetadata the catalog metadata info. @throws UnsupportedException if an operation is not supported. @throws ExecutionException if an error happens.
[ "This", "method", "creates", "a", "catalog", "." ]
train
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L78-L99
jamesagnew/hapi-fhir
hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java
IncomingRequestAddressStrategy.determineServletContextPath
public static String determineServletContextPath(HttpServletRequest theRequest, RestfulServer server) { """ Determines the servlet's context path. This is here to try and deal with the wide variation in servers and what they return. getServletContext().getContextPath() is supposed to return the path to the specific servlet we are deployed as but it's not available everywhere. On some servers getServletContext() can return null (old Jetty seems to suffer from this, see hapi-fhir-base-test-mindeps-server) and on other old servers (Servlet 2.4) getServletContext().getContextPath() doesn't even exist. theRequest.getContextPath() returns the context for the specific incoming request. It should be available everywhere, but it's likely to be less predicable if there are multiple servlet mappings pointing to the same servlet, so we don't favour it. This is possibly not the best strategy (maybe we should just always use theRequest.getContextPath()?) but so far people seem happy with this behavour across a wide variety of platforms. If you are having troubles on a given platform/configuration and want to suggest a change or even report incompatibility here, we'd love to hear about it. """ String retVal; if (server.getServletContext() != null) { if (server.getServletContext().getMajorVersion() >= 3 || (server.getServletContext().getMajorVersion() > 2 && server.getServletContext().getMinorVersion() >= 5)) { retVal = server.getServletContext().getContextPath(); } else { retVal = theRequest.getContextPath(); } } else { retVal = theRequest.getContextPath(); } retVal = StringUtils.defaultString(retVal); return retVal; }
java
public static String determineServletContextPath(HttpServletRequest theRequest, RestfulServer server) { String retVal; if (server.getServletContext() != null) { if (server.getServletContext().getMajorVersion() >= 3 || (server.getServletContext().getMajorVersion() > 2 && server.getServletContext().getMinorVersion() >= 5)) { retVal = server.getServletContext().getContextPath(); } else { retVal = theRequest.getContextPath(); } } else { retVal = theRequest.getContextPath(); } retVal = StringUtils.defaultString(retVal); return retVal; }
[ "public", "static", "String", "determineServletContextPath", "(", "HttpServletRequest", "theRequest", ",", "RestfulServer", "server", ")", "{", "String", "retVal", ";", "if", "(", "server", ".", "getServletContext", "(", ")", "!=", "null", ")", "{", "if", "(", "server", ".", "getServletContext", "(", ")", ".", "getMajorVersion", "(", ")", ">=", "3", "||", "(", "server", ".", "getServletContext", "(", ")", ".", "getMajorVersion", "(", ")", ">", "2", "&&", "server", ".", "getServletContext", "(", ")", ".", "getMinorVersion", "(", ")", ">=", "5", ")", ")", "{", "retVal", "=", "server", ".", "getServletContext", "(", ")", ".", "getContextPath", "(", ")", ";", "}", "else", "{", "retVal", "=", "theRequest", ".", "getContextPath", "(", ")", ";", "}", "}", "else", "{", "retVal", "=", "theRequest", ".", "getContextPath", "(", ")", ";", "}", "retVal", "=", "StringUtils", ".", "defaultString", "(", "retVal", ")", ";", "return", "retVal", ";", "}" ]
Determines the servlet's context path. This is here to try and deal with the wide variation in servers and what they return. getServletContext().getContextPath() is supposed to return the path to the specific servlet we are deployed as but it's not available everywhere. On some servers getServletContext() can return null (old Jetty seems to suffer from this, see hapi-fhir-base-test-mindeps-server) and on other old servers (Servlet 2.4) getServletContext().getContextPath() doesn't even exist. theRequest.getContextPath() returns the context for the specific incoming request. It should be available everywhere, but it's likely to be less predicable if there are multiple servlet mappings pointing to the same servlet, so we don't favour it. This is possibly not the best strategy (maybe we should just always use theRequest.getContextPath()?) but so far people seem happy with this behavour across a wide variety of platforms. If you are having troubles on a given platform/configuration and want to suggest a change or even report incompatibility here, we'd love to hear about it.
[ "Determines", "the", "servlet", "s", "context", "path", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java#L124-L137
VoltDB/voltdb
src/frontend/org/voltcore/zk/ZKUtil.java
ZKUtil.joinZKPath
public static String joinZKPath(String path, String name) { """ Joins a path with a filename, if the path already ends with "/", it won't add another "/" to the path. @param path @param name @return """ if (path.endsWith("/")) { return path + name; } else { return path + "/" + name; } }
java
public static String joinZKPath(String path, String name) { if (path.endsWith("/")) { return path + name; } else { return path + "/" + name; } }
[ "public", "static", "String", "joinZKPath", "(", "String", "path", ",", "String", "name", ")", "{", "if", "(", "path", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "return", "path", "+", "name", ";", "}", "else", "{", "return", "path", "+", "\"/\"", "+", "name", ";", "}", "}" ]
Joins a path with a filename, if the path already ends with "/", it won't add another "/" to the path. @param path @param name @return
[ "Joins", "a", "path", "with", "a", "filename", "if", "the", "path", "already", "ends", "with", "/", "it", "won", "t", "add", "another", "/", "to", "the", "path", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/ZKUtil.java#L67-L73
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.updateInfoFile
private void updateInfoFile() { """ Write or update flv file information into the pre-finalization file. """ try (RandomAccessFile infoFile = new RandomAccessFile(filePath + ".info", "rw")) { infoFile.writeInt(audioCodecId); infoFile.writeInt(videoCodecId); infoFile.writeInt(duration); // additional props infoFile.writeInt(audioDataSize); infoFile.writeInt(soundRate); infoFile.writeInt(soundSize); infoFile.writeInt(soundType ? 1 : 0); infoFile.writeInt(videoDataSize); } catch (Exception e) { log.warn("Exception writing flv file information data", e); } }
java
private void updateInfoFile() { try (RandomAccessFile infoFile = new RandomAccessFile(filePath + ".info", "rw")) { infoFile.writeInt(audioCodecId); infoFile.writeInt(videoCodecId); infoFile.writeInt(duration); // additional props infoFile.writeInt(audioDataSize); infoFile.writeInt(soundRate); infoFile.writeInt(soundSize); infoFile.writeInt(soundType ? 1 : 0); infoFile.writeInt(videoDataSize); } catch (Exception e) { log.warn("Exception writing flv file information data", e); } }
[ "private", "void", "updateInfoFile", "(", ")", "{", "try", "(", "RandomAccessFile", "infoFile", "=", "new", "RandomAccessFile", "(", "filePath", "+", "\".info\"", ",", "\"rw\"", ")", ")", "{", "infoFile", ".", "writeInt", "(", "audioCodecId", ")", ";", "infoFile", ".", "writeInt", "(", "videoCodecId", ")", ";", "infoFile", ".", "writeInt", "(", "duration", ")", ";", "// additional props", "infoFile", ".", "writeInt", "(", "audioDataSize", ")", ";", "infoFile", ".", "writeInt", "(", "soundRate", ")", ";", "infoFile", ".", "writeInt", "(", "soundSize", ")", ";", "infoFile", ".", "writeInt", "(", "soundType", "?", "1", ":", "0", ")", ";", "infoFile", ".", "writeInt", "(", "videoDataSize", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"Exception writing flv file information data\"", ",", "e", ")", ";", "}", "}" ]
Write or update flv file information into the pre-finalization file.
[ "Write", "or", "update", "flv", "file", "information", "into", "the", "pre", "-", "finalization", "file", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1033-L1047
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/geom/GeoPackageGeometryData.java
GeoPackageGeometryData.readEnvelope
private GeometryEnvelope readEnvelope(int envelopeIndicator, ByteReader reader) { """ Read the envelope based upon the indicator value @param envelopeIndicator envelope indicator @param reader byte reader @return geometry envelope """ GeometryEnvelope envelope = null; if (envelopeIndicator > 0) { // Read x and y values and create envelope double minX = reader.readDouble(); double maxX = reader.readDouble(); double minY = reader.readDouble(); double maxY = reader.readDouble(); boolean hasZ = false; Double minZ = null; Double maxZ = null; boolean hasM = false; Double minM = null; Double maxM = null; // Read z values if (envelopeIndicator == 2 || envelopeIndicator == 4) { hasZ = true; minZ = reader.readDouble(); maxZ = reader.readDouble(); } // Read m values if (envelopeIndicator == 3 || envelopeIndicator == 4) { hasM = true; minM = reader.readDouble(); maxM = reader.readDouble(); } envelope = new GeometryEnvelope(hasZ, hasM); envelope.setMinX(minX); envelope.setMaxX(maxX); envelope.setMinY(minY); envelope.setMaxY(maxY); if (hasZ) { envelope.setMinZ(minZ); envelope.setMaxZ(maxZ); } if (hasM) { envelope.setMinM(minM); envelope.setMaxM(maxM); } } return envelope; }
java
private GeometryEnvelope readEnvelope(int envelopeIndicator, ByteReader reader) { GeometryEnvelope envelope = null; if (envelopeIndicator > 0) { // Read x and y values and create envelope double minX = reader.readDouble(); double maxX = reader.readDouble(); double minY = reader.readDouble(); double maxY = reader.readDouble(); boolean hasZ = false; Double minZ = null; Double maxZ = null; boolean hasM = false; Double minM = null; Double maxM = null; // Read z values if (envelopeIndicator == 2 || envelopeIndicator == 4) { hasZ = true; minZ = reader.readDouble(); maxZ = reader.readDouble(); } // Read m values if (envelopeIndicator == 3 || envelopeIndicator == 4) { hasM = true; minM = reader.readDouble(); maxM = reader.readDouble(); } envelope = new GeometryEnvelope(hasZ, hasM); envelope.setMinX(minX); envelope.setMaxX(maxX); envelope.setMinY(minY); envelope.setMaxY(maxY); if (hasZ) { envelope.setMinZ(minZ); envelope.setMaxZ(maxZ); } if (hasM) { envelope.setMinM(minM); envelope.setMaxM(maxM); } } return envelope; }
[ "private", "GeometryEnvelope", "readEnvelope", "(", "int", "envelopeIndicator", ",", "ByteReader", "reader", ")", "{", "GeometryEnvelope", "envelope", "=", "null", ";", "if", "(", "envelopeIndicator", ">", "0", ")", "{", "// Read x and y values and create envelope", "double", "minX", "=", "reader", ".", "readDouble", "(", ")", ";", "double", "maxX", "=", "reader", ".", "readDouble", "(", ")", ";", "double", "minY", "=", "reader", ".", "readDouble", "(", ")", ";", "double", "maxY", "=", "reader", ".", "readDouble", "(", ")", ";", "boolean", "hasZ", "=", "false", ";", "Double", "minZ", "=", "null", ";", "Double", "maxZ", "=", "null", ";", "boolean", "hasM", "=", "false", ";", "Double", "minM", "=", "null", ";", "Double", "maxM", "=", "null", ";", "// Read z values", "if", "(", "envelopeIndicator", "==", "2", "||", "envelopeIndicator", "==", "4", ")", "{", "hasZ", "=", "true", ";", "minZ", "=", "reader", ".", "readDouble", "(", ")", ";", "maxZ", "=", "reader", ".", "readDouble", "(", ")", ";", "}", "// Read m values", "if", "(", "envelopeIndicator", "==", "3", "||", "envelopeIndicator", "==", "4", ")", "{", "hasM", "=", "true", ";", "minM", "=", "reader", ".", "readDouble", "(", ")", ";", "maxM", "=", "reader", ".", "readDouble", "(", ")", ";", "}", "envelope", "=", "new", "GeometryEnvelope", "(", "hasZ", ",", "hasM", ")", ";", "envelope", ".", "setMinX", "(", "minX", ")", ";", "envelope", ".", "setMaxX", "(", "maxX", ")", ";", "envelope", ".", "setMinY", "(", "minY", ")", ";", "envelope", ".", "setMaxY", "(", "maxY", ")", ";", "if", "(", "hasZ", ")", "{", "envelope", ".", "setMinZ", "(", "minZ", ")", ";", "envelope", ".", "setMaxZ", "(", "maxZ", ")", ";", "}", "if", "(", "hasM", ")", "{", "envelope", ".", "setMinM", "(", "minM", ")", ";", "envelope", ".", "setMaxM", "(", "maxM", ")", ";", "}", "}", "return", "envelope", ";", "}" ]
Read the envelope based upon the indicator value @param envelopeIndicator envelope indicator @param reader byte reader @return geometry envelope
[ "Read", "the", "envelope", "based", "upon", "the", "indicator", "value" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/geom/GeoPackageGeometryData.java#L279-L333
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onMyPositionEvent
public Closeable onMyPositionEvent(final BiConsumer<BitfinexAccountSymbol, Collection<BitfinexPosition>> listener) { """ registers listener for user account related events - position events @param listener of event @return hook of this listener """ positionConsumers.offer(listener); return () -> positionConsumers.remove(listener); }
java
public Closeable onMyPositionEvent(final BiConsumer<BitfinexAccountSymbol, Collection<BitfinexPosition>> listener) { positionConsumers.offer(listener); return () -> positionConsumers.remove(listener); }
[ "public", "Closeable", "onMyPositionEvent", "(", "final", "BiConsumer", "<", "BitfinexAccountSymbol", ",", "Collection", "<", "BitfinexPosition", ">", ">", "listener", ")", "{", "positionConsumers", ".", "offer", "(", "listener", ")", ";", "return", "(", ")", "->", "positionConsumers", ".", "remove", "(", "listener", ")", ";", "}" ]
registers listener for user account related events - position events @param listener of event @return hook of this listener
[ "registers", "listener", "for", "user", "account", "related", "events", "-", "position", "events" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L118-L121
shrinkwrap/resolver
maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/ConfigurationUtils.java
ConfigurationUtils.valueAsBoolean
static boolean valueAsBoolean(Map<String, Object> map, Key key, boolean defaultValue) { """ Fetches a value specified by key @param map XPP3 map equivalent @param key navigation key @param defaultValue Default value if no such key exists @return Boolean representation of the value """ return Boolean.parseBoolean(valueAsString(map, key, String.valueOf(defaultValue))); }
java
static boolean valueAsBoolean(Map<String, Object> map, Key key, boolean defaultValue) { return Boolean.parseBoolean(valueAsString(map, key, String.valueOf(defaultValue))); }
[ "static", "boolean", "valueAsBoolean", "(", "Map", "<", "String", ",", "Object", ">", "map", ",", "Key", "key", ",", "boolean", "defaultValue", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "valueAsString", "(", "map", ",", "key", ",", "String", ".", "valueOf", "(", "defaultValue", ")", ")", ")", ";", "}" ]
Fetches a value specified by key @param map XPP3 map equivalent @param key navigation key @param defaultValue Default value if no such key exists @return Boolean representation of the value
[ "Fetches", "a", "value", "specified", "by", "key" ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/ConfigurationUtils.java#L61-L63
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/json/validators/ValidationContext.java
ValidationContext.addBadArraySizeError
public void addBadArraySizeError(final int expectedSize, final int actualSize) throws ValidationException { """ Calls {@link #addError(String)} with a message that indicates that an array has the wrong number of elements @param expectedSize @param actualSize @throws ValidationException """ addError(StringFormatter.format(MessageConstants.MESSAGES.invalidArraySize(), expectedSize, actualSize)); }
java
public void addBadArraySizeError(final int expectedSize, final int actualSize) throws ValidationException { addError(StringFormatter.format(MessageConstants.MESSAGES.invalidArraySize(), expectedSize, actualSize)); }
[ "public", "void", "addBadArraySizeError", "(", "final", "int", "expectedSize", ",", "final", "int", "actualSize", ")", "throws", "ValidationException", "{", "addError", "(", "StringFormatter", ".", "format", "(", "MessageConstants", ".", "MESSAGES", ".", "invalidArraySize", "(", ")", ",", "expectedSize", ",", "actualSize", ")", ")", ";", "}" ]
Calls {@link #addError(String)} with a message that indicates that an array has the wrong number of elements @param expectedSize @param actualSize @throws ValidationException
[ "Calls", "{", "@link", "#addError", "(", "String", ")", "}", "with", "a", "message", "that", "indicates", "that", "an", "array", "has", "the", "wrong", "number", "of", "elements" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/json/validators/ValidationContext.java#L210-L213
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.isSameAbsValue
public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) { """ Check ABS values of v1 and v2. @param v1 nullable BigDecimal @param v2 nullable BigDecimal @return true if the ABS value match! """ return isSameValue(abs(v1), abs(v2)); }
java
public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) { return isSameValue(abs(v1), abs(v2)); }
[ "public", "static", "boolean", "isSameAbsValue", "(", "final", "BigDecimal", "v1", ",", "final", "BigDecimal", "v2", ")", "{", "return", "isSameValue", "(", "abs", "(", "v1", ")", ",", "abs", "(", "v2", ")", ")", ";", "}" ]
Check ABS values of v1 and v2. @param v1 nullable BigDecimal @param v2 nullable BigDecimal @return true if the ABS value match!
[ "Check", "ABS", "values", "of", "v1", "and", "v2", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L347-L349
graphhopper/graphhopper
reader-gtfs/src/main/java/com/conveyal/gtfs/model/Service.java
Service.checkOverlap
public static boolean checkOverlap (Service s1, Service s2) { """ Checks for overlapping days of week between two service calendars @param s1 @param s2 @return true if both calendars simultaneously operate on at least one day of the week """ if (s1.calendar == null || s2.calendar == null) { return false; } // overlap exists if at least one day of week is shared by two calendars boolean overlappingDays = s1.calendar.monday == 1 && s2.calendar.monday == 1 || s1.calendar.tuesday == 1 && s2.calendar.tuesday == 1 || s1.calendar.wednesday == 1 && s2.calendar.wednesday == 1 || s1.calendar.thursday == 1 && s2.calendar.thursday == 1 || s1.calendar.friday == 1 && s2.calendar.friday == 1 || s1.calendar.saturday == 1 && s2.calendar.saturday == 1 || s1.calendar.sunday == 1 && s2.calendar.sunday == 1; return overlappingDays; }
java
public static boolean checkOverlap (Service s1, Service s2) { if (s1.calendar == null || s2.calendar == null) { return false; } // overlap exists if at least one day of week is shared by two calendars boolean overlappingDays = s1.calendar.monday == 1 && s2.calendar.monday == 1 || s1.calendar.tuesday == 1 && s2.calendar.tuesday == 1 || s1.calendar.wednesday == 1 && s2.calendar.wednesday == 1 || s1.calendar.thursday == 1 && s2.calendar.thursday == 1 || s1.calendar.friday == 1 && s2.calendar.friday == 1 || s1.calendar.saturday == 1 && s2.calendar.saturday == 1 || s1.calendar.sunday == 1 && s2.calendar.sunday == 1; return overlappingDays; }
[ "public", "static", "boolean", "checkOverlap", "(", "Service", "s1", ",", "Service", "s2", ")", "{", "if", "(", "s1", ".", "calendar", "==", "null", "||", "s2", ".", "calendar", "==", "null", ")", "{", "return", "false", ";", "}", "// overlap exists if at least one day of week is shared by two calendars", "boolean", "overlappingDays", "=", "s1", ".", "calendar", ".", "monday", "==", "1", "&&", "s2", ".", "calendar", ".", "monday", "==", "1", "||", "s1", ".", "calendar", ".", "tuesday", "==", "1", "&&", "s2", ".", "calendar", ".", "tuesday", "==", "1", "||", "s1", ".", "calendar", ".", "wednesday", "==", "1", "&&", "s2", ".", "calendar", ".", "wednesday", "==", "1", "||", "s1", ".", "calendar", ".", "thursday", "==", "1", "&&", "s2", ".", "calendar", ".", "thursday", "==", "1", "||", "s1", ".", "calendar", ".", "friday", "==", "1", "&&", "s2", ".", "calendar", ".", "friday", "==", "1", "||", "s1", ".", "calendar", ".", "saturday", "==", "1", "&&", "s2", ".", "calendar", ".", "saturday", "==", "1", "||", "s1", ".", "calendar", ".", "sunday", "==", "1", "&&", "s2", ".", "calendar", ".", "sunday", "==", "1", ";", "return", "overlappingDays", ";", "}" ]
Checks for overlapping days of week between two service calendars @param s1 @param s2 @return true if both calendars simultaneously operate on at least one day of the week
[ "Checks", "for", "overlapping", "days", "of", "week", "between", "two", "service", "calendars" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/reader-gtfs/src/main/java/com/conveyal/gtfs/model/Service.java#L157-L170
dihedron/dihedron-commons
src/main/java/org/dihedron/core/xml/DOMReader.java
DOMReader.loadDocument
public static void loadDocument(String xml, String xsd, DOMHandler handler) throws IOException, InvalidArgumentException, SAXException, ParserConfigurationException, Exception { """ Parses an XML document and passes it on to the given handler, or to a lambda expression for handling; it does not perform validation. @param xml the URL of the XML to parse, as a string. @param xsd the URL of the XML's schema definition, as a string. @param handler the handler that will handle the document. @throws IOException @throws InvalidArgumentException @throws SAXException @throws ParserConfigurationException @throws Exception any handler-related exceptions. """ loadDocument(xml, xsd, handler, DEFAULT_VALIDATE_XML); }
java
public static void loadDocument(String xml, String xsd, DOMHandler handler) throws IOException, InvalidArgumentException, SAXException, ParserConfigurationException, Exception { loadDocument(xml, xsd, handler, DEFAULT_VALIDATE_XML); }
[ "public", "static", "void", "loadDocument", "(", "String", "xml", ",", "String", "xsd", ",", "DOMHandler", "handler", ")", "throws", "IOException", ",", "InvalidArgumentException", ",", "SAXException", ",", "ParserConfigurationException", ",", "Exception", "{", "loadDocument", "(", "xml", ",", "xsd", ",", "handler", ",", "DEFAULT_VALIDATE_XML", ")", ";", "}" ]
Parses an XML document and passes it on to the given handler, or to a lambda expression for handling; it does not perform validation. @param xml the URL of the XML to parse, as a string. @param xsd the URL of the XML's schema definition, as a string. @param handler the handler that will handle the document. @throws IOException @throws InvalidArgumentException @throws SAXException @throws ParserConfigurationException @throws Exception any handler-related exceptions.
[ "Parses", "an", "XML", "document", "and", "passes", "it", "on", "to", "the", "given", "handler", "or", "to", "a", "lambda", "expression", "for", "handling", ";", "it", "does", "not", "perform", "validation", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/xml/DOMReader.java#L89-L91
code4everything/util
src/main/java/com/zhazhapan/util/encryption/JavaEncrypt.java
JavaEncrypt.decryptDES
public static String decryptDES(String code, String key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, UnsupportedEncodingException, IllegalBlockSizeException, BadPaddingException { """ 为Cipher加密器提供一个解密开放接口 @param code {@link String} @param key {@link String} @return {@link String} @throws BadPaddingException 异常 @throws IllegalBlockSizeException 异常 @throws UnsupportedEncodingException 异常 @throws NoSuchPaddingException 异常 @throws NoSuchAlgorithmException 异常 @throws InvalidKeyException 异常 """ return cryptDES(code, Cipher.DECRYPT_MODE, key); }
java
public static String decryptDES(String code, String key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, UnsupportedEncodingException, IllegalBlockSizeException, BadPaddingException { return cryptDES(code, Cipher.DECRYPT_MODE, key); }
[ "public", "static", "String", "decryptDES", "(", "String", "code", ",", "String", "key", ")", "throws", "InvalidKeyException", ",", "NoSuchAlgorithmException", ",", "NoSuchPaddingException", ",", "UnsupportedEncodingException", ",", "IllegalBlockSizeException", ",", "BadPaddingException", "{", "return", "cryptDES", "(", "code", ",", "Cipher", ".", "DECRYPT_MODE", ",", "key", ")", ";", "}" ]
为Cipher加密器提供一个解密开放接口 @param code {@link String} @param key {@link String} @return {@link String} @throws BadPaddingException 异常 @throws IllegalBlockSizeException 异常 @throws UnsupportedEncodingException 异常 @throws NoSuchPaddingException 异常 @throws NoSuchAlgorithmException 异常 @throws InvalidKeyException 异常
[ "为Cipher加密器提供一个解密开放接口" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/encryption/JavaEncrypt.java#L134-L137