id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
103,800
wisdom-framework/wisdom
framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java
DefaultPageErrorHandler.call
@Override public Result call(Route route, RequestContext context) throws Exception { // Manage the error file. // In dev mode, if the watching pipeline throws an error, this error is stored in the error.json file // If this file exist, we should display a page telling the user that somethin...
java
@Override public Result call(Route route, RequestContext context) throws Exception { // Manage the error file. // In dev mode, if the watching pipeline throws an error, this error is stored in the error.json file // If this file exist, we should display a page telling the user that somethin...
[ "@", "Override", "public", "Result", "call", "(", "Route", "route", ",", "RequestContext", "context", ")", "throws", "Exception", "{", "// Manage the error file.", "// In dev mode, if the watching pipeline throws an error, this error is stored in the error.json file", "// If this f...
The interception method. When the request is unbound, generate a 404 page. When the controller throws an exception generates a 500 page. @param route the route @param context the filter context @return the generated result. @throws Exception if anything bad happen
[ "The", "interception", "method", ".", "When", "the", "request", "is", "unbound", "generate", "a", "404", "page", ".", "When", "the", "controller", "throws", "an", "exception", "generates", "a", "500", "page", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java#L212-L283
103,801
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java
Route.accepts
public Route accepts(String... types) { Preconditions.checkNotNull(types); final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>(); builder.addAll(this.acceptedMediaTypes); for (String s : types) { builder.add(MediaType.parse(s)); } this.a...
java
public Route accepts(String... types) { Preconditions.checkNotNull(types); final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>(); builder.addAll(this.acceptedMediaTypes); for (String s : types) { builder.add(MediaType.parse(s)); } this.a...
[ "public", "Route", "accepts", "(", "String", "...", "types", ")", "{", "Preconditions", ".", "checkNotNull", "(", "types", ")", ";", "final", "ImmutableSet", ".", "Builder", "<", "MediaType", ">", "builder", "=", "new", "ImmutableSet", ".", "Builder", "<>", ...
Sets the set of media types accepted by the route. @param types the set of type @return the current route
[ "Sets", "the", "set", "of", "media", "types", "accepted", "by", "the", "route", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java#L166-L175
103,802
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java
Route.produces
public Route produces(String... types) { Preconditions.checkNotNull(types); final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>(); builder.addAll(this.producedMediaTypes); for (String s : types) { final MediaType mt = MediaType.parse(s); if ...
java
public Route produces(String... types) { Preconditions.checkNotNull(types); final ImmutableSet.Builder<MediaType> builder = new ImmutableSet.Builder<>(); builder.addAll(this.producedMediaTypes); for (String s : types) { final MediaType mt = MediaType.parse(s); if ...
[ "public", "Route", "produces", "(", "String", "...", "types", ")", "{", "Preconditions", ".", "checkNotNull", "(", "types", ")", ";", "final", "ImmutableSet", ".", "Builder", "<", "MediaType", ">", "builder", "=", "new", "ImmutableSet", ".", "Builder", "<>",...
Sets the set of media types produced by the route. @param types the set of type @return the current route
[ "Sets", "the", "set", "of", "media", "types", "produced", "by", "the", "route", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java#L195-L208
103,803
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java
Route.isCompliantWithRequestAccept
public boolean isCompliantWithRequestAccept(Request request) { if (producedMediaTypes == null || producedMediaTypes.isEmpty() || request == null || request.getHeader(HeaderNames.ACCEPT) == null) { return true; } else { for (MediaType mt : producedMediaTypes) { ...
java
public boolean isCompliantWithRequestAccept(Request request) { if (producedMediaTypes == null || producedMediaTypes.isEmpty() || request == null || request.getHeader(HeaderNames.ACCEPT) == null) { return true; } else { for (MediaType mt : producedMediaTypes) { ...
[ "public", "boolean", "isCompliantWithRequestAccept", "(", "Request", "request", ")", "{", "if", "(", "producedMediaTypes", "==", "null", "||", "producedMediaTypes", ".", "isEmpty", "(", ")", "||", "request", "==", "null", "||", "request", ".", "getHeader", "(", ...
Checks whether the given request is compliant with the media type accepted by the current route. @param request the request @return {@code true} if the request is compliant, {@code false} otherwise
[ "Checks", "whether", "the", "given", "request", "is", "compliant", "with", "the", "media", "type", "accepted", "by", "the", "current", "route", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/Route.java#L490-L502
103,804
wisdom-framework/wisdom
extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java
RamlMonitorController.index
@Route(method = HttpMethod.GET, uri = "") public Result index(@PathParameter("name") String name) { if(names.contains(name)){ return ok(render(template,"source",RAML_ASSET_DIR+name+RAML_EXT)); } return notFound(); }
java
@Route(method = HttpMethod.GET, uri = "") public Result index(@PathParameter("name") String name) { if(names.contains(name)){ return ok(render(template,"source",RAML_ASSET_DIR+name+RAML_EXT)); } return notFound(); }
[ "@", "Route", "(", "method", "=", "HttpMethod", ".", "GET", ",", "uri", "=", "\"\"", ")", "public", "Result", "index", "(", "@", "PathParameter", "(", "\"name\"", ")", "String", "name", ")", "{", "if", "(", "names", ".", "contains", "(", "name", ")",...
Return the raml console api corresponding to the raml of given name. @response.mime text/html @param name Name of the raml api to display. @return the raml console api or 404 if the file of given name doesn't exist in wisdom
[ "Return", "the", "raml", "console", "api", "corresponding", "to", "the", "raml", "of", "given", "name", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java#L92-L98
103,805
wisdom-framework/wisdom
extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java
RamlMonitorController.start
@Validate public void start(){ //Publish the monitor extension for(Asset asset : assets.assets()) { if (asset.getPath().matches("^"+RAML_ASSET_DIR+"[A-Za-z0-9_-]+\\"+RAML_EXT+"$")){ String name = asset.getPath().substring(RAML_ASSET_DIR.length(), asset.getPath().length() ...
java
@Validate public void start(){ //Publish the monitor extension for(Asset asset : assets.assets()) { if (asset.getPath().matches("^"+RAML_ASSET_DIR+"[A-Za-z0-9_-]+\\"+RAML_EXT+"$")){ String name = asset.getPath().substring(RAML_ASSET_DIR.length(), asset.getPath().length() ...
[ "@", "Validate", "public", "void", "start", "(", ")", "{", "//Publish the monitor extension", "for", "(", "Asset", "asset", ":", "assets", ".", "assets", "(", ")", ")", "{", "if", "(", "asset", ".", "getPath", "(", ")", ".", "matches", "(", "\"^\"", "+...
Looks for the raml file available in the assets and publish a RamlMonitorConsole for each of them.
[ "Looks", "for", "the", "raml", "file", "available", "in", "the", "assets", "and", "publish", "a", "RamlMonitorConsole", "for", "each", "of", "them", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java#L112-L125
103,806
wisdom-framework/wisdom
extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java
RamlMonitorController.stop
@Invalidate public void stop(){ for(ServiceRegistration registration: registrations){ registration.unregister(); } registrations.clear(); names.clear(); }
java
@Invalidate public void stop(){ for(ServiceRegistration registration: registrations){ registration.unregister(); } registrations.clear(); names.clear(); }
[ "@", "Invalidate", "public", "void", "stop", "(", ")", "{", "for", "(", "ServiceRegistration", "registration", ":", "registrations", ")", "{", "registration", ".", "unregister", "(", ")", ";", "}", "registrations", ".", "clear", "(", ")", ";", "names", "."...
Unregister all RamlMonitorConsole services created by this instance.
[ "Unregister", "all", "RamlMonitorConsole", "services", "created", "by", "this", "instance", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java#L130-L137
103,807
wisdom-framework/wisdom
core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java
Engine.getBodyParserEngineForContentType
@Override public BodyParser getBodyParserEngineForContentType(String contentType) { for (BodyParser parser : parsers) { if (parser.getContentTypes().contains(contentType)) { return parser; } } LoggerFactory.getLogger(this.getClass()).info("Cannot find ...
java
@Override public BodyParser getBodyParserEngineForContentType(String contentType) { for (BodyParser parser : parsers) { if (parser.getContentTypes().contains(contentType)) { return parser; } } LoggerFactory.getLogger(this.getClass()).info("Cannot find ...
[ "@", "Override", "public", "BodyParser", "getBodyParserEngineForContentType", "(", "String", "contentType", ")", "{", "for", "(", "BodyParser", "parser", ":", "parsers", ")", "{", "if", "(", "parser", ".", "getContentTypes", "(", ")", ".", "contains", "(", "co...
Gets the body parser that can be used to parse a body with the given content type. @param contentType the content type @return a body parser, {@code null} if none match
[ "Gets", "the", "body", "parser", "that", "can", "be", "used", "to", "parse", "a", "body", "with", "the", "given", "content", "type", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java#L53-L62
103,808
wisdom-framework/wisdom
core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java
Engine.getContentSerializerForContentType
@Override public ContentSerializer getContentSerializerForContentType(String contentType) { for (ContentSerializer renderer : serializers) { if (renderer.getContentType().equals(contentType)) { return renderer; } } LoggerFactory.getLogger(this.getClass...
java
@Override public ContentSerializer getContentSerializerForContentType(String contentType) { for (ContentSerializer renderer : serializers) { if (renderer.getContentType().equals(contentType)) { return renderer; } } LoggerFactory.getLogger(this.getClass...
[ "@", "Override", "public", "ContentSerializer", "getContentSerializerForContentType", "(", "String", "contentType", ")", "{", "for", "(", "ContentSerializer", "renderer", ":", "serializers", ")", "{", "if", "(", "renderer", ".", "getContentType", "(", ")", ".", "e...
Gets the content serializer that can be used to serialize a result to the given content type. This method uses an exact match. @param contentType the content type @return a content serializer, {@code null} if none match
[ "Gets", "the", "content", "serializer", "that", "can", "be", "used", "to", "serialize", "a", "result", "to", "the", "given", "content", "type", ".", "This", "method", "uses", "an", "exact", "match", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java#L71-L80
103,809
wisdom-framework/wisdom
core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java
Engine.getBestSerializer
@Override public ContentSerializer getBestSerializer(Collection<MediaType> mediaTypes) { if (mediaTypes == null || mediaTypes.isEmpty()) { mediaTypes = ImmutableList.of(MediaType.HTML_UTF_8); } for (MediaType type : mediaTypes) { for (ContentSerializer ser : serializ...
java
@Override public ContentSerializer getBestSerializer(Collection<MediaType> mediaTypes) { if (mediaTypes == null || mediaTypes.isEmpty()) { mediaTypes = ImmutableList.of(MediaType.HTML_UTF_8); } for (MediaType type : mediaTypes) { for (ContentSerializer ser : serializ...
[ "@", "Override", "public", "ContentSerializer", "getBestSerializer", "(", "Collection", "<", "MediaType", ">", "mediaTypes", ")", "{", "if", "(", "mediaTypes", "==", "null", "||", "mediaTypes", ".", "isEmpty", "(", ")", ")", "{", "mediaTypes", "=", "ImmutableL...
Finds the 'best' content serializer for the given accept headers. @param mediaTypes the ordered set of {@link com.google.common.net.MediaType} from the {@code ACCEPT} header. @return the best serializer from the list matching the {@code ACCEPT} header, {@code null} if none match
[ "Finds", "the", "best", "content", "serializer", "for", "the", "given", "accept", "headers", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/engines/Engine.java#L88-L102
103,810
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.execute
@Override public void execute() throws MojoExecutionException { if (skipCleanCSS) { getLog().debug("Skipping CSS minification"); removeFromWatching(); return; } cleancss = NPM.npm(this, CLEANCSS_NPM_NAME, cleanCssVersion); getLog().info("Clean CSS...
java
@Override public void execute() throws MojoExecutionException { if (skipCleanCSS) { getLog().debug("Skipping CSS minification"); removeFromWatching(); return; } cleancss = NPM.npm(this, CLEANCSS_NPM_NAME, cleanCssVersion); getLog().info("Clean CSS...
[ "@", "Override", "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "skipCleanCSS", ")", "{", "getLog", "(", ")", ".", "debug", "(", "\"Skipping CSS minification\"", ")", ";", "removeFromWatching", "(", ")", ";", "return...
Checks if the skipCleanCSS flag has been set if so, we stop watching css files. If not we continue by setting our Clean CSS NPM object and calling the minify method for all css files found. @throws MojoExecutionException when modification fails.
[ "Checks", "if", "the", "skipCleanCSS", "flag", "has", "been", "set", "if", "so", "we", "stop", "watching", "css", "files", ".", "If", "not", "we", "continue", "by", "setting", "our", "Clean", "CSS", "NPM", "object", "and", "calling", "the", "minify", "me...
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L112-L136
103,811
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.isNotMinified
public boolean isNotMinified(File file) { return !file.getName().endsWith("min.css") && !file.getName().endsWith(cssMinifierSuffix + ".css"); }
java
public boolean isNotMinified(File file) { return !file.getName().endsWith("min.css") && !file.getName().endsWith(cssMinifierSuffix + ".css"); }
[ "public", "boolean", "isNotMinified", "(", "File", "file", ")", "{", "return", "!", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "\"min.css\"", ")", "&&", "!", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "cssMinifierSuffix", "+", ...
Checks to see if the file is already minified. @param file the current file we are looking at. @return a boolean.
[ "Checks", "to", "see", "if", "the", "file", "is", "already", "minified", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L282-L285
103,812
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.fileCreated
@Override public boolean fileCreated(File file) throws WatchingException { if (stylesheets != null) { try { process(stylesheets); } catch (MojoExecutionException e) { throw new WatchingException("Error while aggregating or minifying CSS resources", fil...
java
@Override public boolean fileCreated(File file) throws WatchingException { if (stylesheets != null) { try { process(stylesheets); } catch (MojoExecutionException e) { throw new WatchingException("Error while aggregating or minifying CSS resources", fil...
[ "@", "Override", "public", "boolean", "fileCreated", "(", "File", "file", ")", "throws", "WatchingException", "{", "if", "(", "stylesheets", "!=", "null", ")", "{", "try", "{", "process", "(", "stylesheets", ")", ";", "}", "catch", "(", "MojoExecutionExcepti...
Minifies the created files. @param file is the file. @return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should return {@literal true} to let other watchers be notified. @throws org.wisdom.maven.WatchingException if the watcher failed to process the given file.
[ "Minifies", "the", "created", "files", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L295-L307
103,813
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.fileDeleted
@Override public boolean fileDeleted(File file) throws WatchingException { if (isNotMinified(file)) { File minified = getMinifiedFile(file); FileUtils.deleteQuietly(minified); File map = new File(minified.getParentFile(), minified.getName() + ".map"); FileUtil...
java
@Override public boolean fileDeleted(File file) throws WatchingException { if (isNotMinified(file)) { File minified = getMinifiedFile(file); FileUtils.deleteQuietly(minified); File map = new File(minified.getParentFile(), minified.getName() + ".map"); FileUtil...
[ "@", "Override", "public", "boolean", "fileDeleted", "(", "File", "file", ")", "throws", "WatchingException", "{", "if", "(", "isNotMinified", "(", "file", ")", ")", "{", "File", "minified", "=", "getMinifiedFile", "(", "file", ")", ";", "FileUtils", ".", ...
Cleans the output file if any. @param file the file @return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should return {@literal true} to let other watchers be notified. @throws org.wisdom.maven.WatchingException if the watcher failed to process the given file.
[ "Cleans", "the", "output", "file", "if", "any", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L330-L339
103,814
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.getFilteredVersion
public File getFilteredVersion(File input) { File out; if (!input.getName().endsWith(".css")) { out = getOutputFile(input, "css"); } else { out = getOutputFile(input); } if (!out.isFile()) { return null; } return out; }
java
public File getFilteredVersion(File input) { File out; if (!input.getName().endsWith(".css")) { out = getOutputFile(input, "css"); } else { out = getOutputFile(input); } if (!out.isFile()) { return null; } return out; }
[ "public", "File", "getFilteredVersion", "(", "File", "input", ")", "{", "File", "out", ";", "if", "(", "!", "input", ".", "getName", "(", ")", ".", "endsWith", "(", "\".css\"", ")", ")", "{", "out", "=", "getOutputFile", "(", "input", ",", "\"css\"", ...
Overrides the parent method to manage the case where the given file is not a `.css`. In that case it should strips the extension and find a `.css` file. @param input the input file @return the filtered file (to the mirror of the file in the output directory), {@code null} if not found
[ "Overrides", "the", "parent", "method", "to", "manage", "the", "case", "where", "the", "given", "file", "is", "not", "a", ".", "css", ".", "In", "that", "case", "it", "should", "strips", "the", "extension", "and", "find", "a", ".", "css", "file", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L348-L360
103,815
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.process
private void process(File file) throws WatchingException { getLog().info("Minifying CSS files from " + file.getName() + " using Clean CSS"); File filtered = getFilteredVersion(file); if (filtered == null) { filtered = file; } File output = getMinifiedFile(file); ...
java
private void process(File file) throws WatchingException { getLog().info("Minifying CSS files from " + file.getName() + " using Clean CSS"); File filtered = getFilteredVersion(file); if (filtered == null) { filtered = file; } File output = getMinifiedFile(file); ...
[ "private", "void", "process", "(", "File", "file", ")", "throws", "WatchingException", "{", "getLog", "(", ")", ".", "info", "(", "\"Minifying CSS files from \"", "+", "file", ".", "getName", "(", ")", "+", "\" using Clean CSS\"", ")", ";", "File", "filtered",...
Minifies the CSS file using Clean CSS. @param file that we wish to minify. @throws WatchingException if errors occur during minification.
[ "Minifies", "the", "CSS", "file", "using", "Clean", "CSS", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L368-L402
103,816
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java
CSSMinifierMojo.getMinifiedFile
protected File getMinifiedFile(File input) { File output = getOutputFile(input); String ext = FilenameUtils.getExtension(output.getName()); return new File(output.getParentFile().getAbsoluteFile(), output.getName().replace("." + ext, cssMinifierSuffix + ".css")); }
java
protected File getMinifiedFile(File input) { File output = getOutputFile(input); String ext = FilenameUtils.getExtension(output.getName()); return new File(output.getParentFile().getAbsoluteFile(), output.getName().replace("." + ext, cssMinifierSuffix + ".css")); }
[ "protected", "File", "getMinifiedFile", "(", "File", "input", ")", "{", "File", "output", "=", "getOutputFile", "(", "input", ")", ";", "String", "ext", "=", "FilenameUtils", ".", "getExtension", "(", "output", ".", "getName", "(", ")", ")", ";", "return",...
Creates out minified output file replacing the current extension with the minified one. @param input the file to minify. @return the output file where the minified code will go.
[ "Creates", "out", "minified", "output", "file", "replacing", "the", "current", "extension", "with", "the", "minified", "one", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/CSSMinifierMojo.java#L410-L415
103,817
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/MavenUtils.java
MavenUtils.getArray
protected static String getArray(List<String> paths) { StringBuilder builder = new StringBuilder(); for (String s : paths) { if (builder.length() == 0) { builder.append(s); } else { builder.append(",").append(s); } } r...
java
protected static String getArray(List<String> paths) { StringBuilder builder = new StringBuilder(); for (String s : paths) { if (builder.length() == 0) { builder.append(s); } else { builder.append(",").append(s); } } r...
[ "protected", "static", "String", "getArray", "(", "List", "<", "String", ">", "paths", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "s", ":", "paths", ")", "{", "if", "(", "builder", ".", "leng...
Compute a String form the given list of paths. The list uses comma as separator. @param paths the list of path @return the computed String
[ "Compute", "a", "String", "form", "the", "given", "list", "of", "paths", ".", "The", "list", "uses", "comma", "as", "separator", "." ]
a35b6431200fec56b178c0ff60837ed73fd7874d
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/MavenUtils.java#L111-L123
103,818
KasualBusiness/MaterialNumberPicker
materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java
MaterialNumberPicker.initView
private void initView() { setMinValue(MIN_VALUE); setMaxValue(MAX_VALUE); setValue(DEFAULT_VALUE); setBackgroundColor(BACKGROUND_COLOR); setSeparatorColor(SEPARATOR_COLOR); setTextColor(TEXT_COLOR); setTextSize(TEXT_SIZE); setWrapSelectorWheel(false); ...
java
private void initView() { setMinValue(MIN_VALUE); setMaxValue(MAX_VALUE); setValue(DEFAULT_VALUE); setBackgroundColor(BACKGROUND_COLOR); setSeparatorColor(SEPARATOR_COLOR); setTextColor(TEXT_COLOR); setTextSize(TEXT_SIZE); setWrapSelectorWheel(false); ...
[ "private", "void", "initView", "(", ")", "{", "setMinValue", "(", "MIN_VALUE", ")", ";", "setMaxValue", "(", "MAX_VALUE", ")", ";", "setValue", "(", "DEFAULT_VALUE", ")", ";", "setBackgroundColor", "(", "BACKGROUND_COLOR", ")", ";", "setSeparatorColor", "(", "...
Init number picker by disabling focusability of edit text embedded inside the number picker We also override the edit text filter private attribute by using reflection as the formatter is still buggy while attempting to display the default value This is still an open Google @see <a href="https://code.google.com/p/andro...
[ "Init", "number", "picker", "by", "disabling", "focusability", "of", "edit", "text", "embedded", "inside", "the", "number", "picker", "We", "also", "override", "the", "edit", "text", "filter", "private", "attribute", "by", "using", "reflection", "as", "the", "...
1b0b884fdc15197683b84135c31342c7acd32901
https://github.com/KasualBusiness/MaterialNumberPicker/blob/1b0b884fdc15197683b84135c31342c7acd32901/materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java#L137-L156
103,819
KasualBusiness/MaterialNumberPicker
materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java
MaterialNumberPicker.setSeparatorColor
public void setSeparatorColor(int separatorColor) { mSeparatorColor = separatorColor; Field[] pickerFields = NumberPicker.class.getDeclaredFields(); for (Field pf : pickerFields) { if (pf.getName().equals("mSelectionDivider")) { pf.setAccessible(true); ...
java
public void setSeparatorColor(int separatorColor) { mSeparatorColor = separatorColor; Field[] pickerFields = NumberPicker.class.getDeclaredFields(); for (Field pf : pickerFields) { if (pf.getName().equals("mSelectionDivider")) { pf.setAccessible(true); ...
[ "public", "void", "setSeparatorColor", "(", "int", "separatorColor", ")", "{", "mSeparatorColor", "=", "separatorColor", ";", "Field", "[", "]", "pickerFields", "=", "NumberPicker", ".", "class", ".", "getDeclaredFields", "(", ")", ";", "for", "(", "Field", "p...
Uses reflection to access divider private attribute and override its color Use Color.Transparent if you wish to hide them
[ "Uses", "reflection", "to", "access", "divider", "private", "attribute", "and", "override", "its", "color", "Use", "Color", ".", "Transparent", "if", "you", "wish", "to", "hide", "them" ]
1b0b884fdc15197683b84135c31342c7acd32901
https://github.com/KasualBusiness/MaterialNumberPicker/blob/1b0b884fdc15197683b84135c31342c7acd32901/materialnumberpicker/src/main/java/biz/kasual/materialnumberpicker/MaterialNumberPicker.java#L162-L177
103,820
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java
DigitalOceanClient.rebootDroplet
@Override public Action rebootDroplet(Integer dropletId) throws DigitalOceanException, RequestUnsuccessfulException { validateDropletId(dropletId); Object[] params = {dropletId}; return (Action) perform( new ApiRequest(ApiAction.REBOOT_DROPLET, new DropletAction(ActionType.REBOOT), params))...
java
@Override public Action rebootDroplet(Integer dropletId) throws DigitalOceanException, RequestUnsuccessfulException { validateDropletId(dropletId); Object[] params = {dropletId}; return (Action) perform( new ApiRequest(ApiAction.REBOOT_DROPLET, new DropletAction(ActionType.REBOOT), params))...
[ "@", "Override", "public", "Action", "rebootDroplet", "(", "Integer", "dropletId", ")", "throws", "DigitalOceanException", ",", "RequestUnsuccessfulException", "{", "validateDropletId", "(", "dropletId", ")", ";", "Object", "[", "]", "params", "=", "{", "dropletId",...
Droplet action methods
[ "Droplet", "action", "methods" ]
79d7acfec191556a7be738654ff866ff34da666b
https://github.com/jeevatkm/digitalocean-api-java/blob/79d7acfec191556a7be738654ff866ff34da666b/src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java#L383-L392
103,821
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java
DigitalOceanClient.getSimpleHeaderValue
private String getSimpleHeaderValue(String header, HttpResponse httpResponse) { return getSimpleHeaderValue(header, httpResponse, true); }
java
private String getSimpleHeaderValue(String header, HttpResponse httpResponse) { return getSimpleHeaderValue(header, httpResponse, true); }
[ "private", "String", "getSimpleHeaderValue", "(", "String", "header", ",", "HttpResponse", "httpResponse", ")", "{", "return", "getSimpleHeaderValue", "(", "header", ",", "httpResponse", ",", "true", ")", ";", "}" ]
Easy method for HTTP header values. defaults to first one.
[ "Easy", "method", "for", "HTTP", "header", "values", ".", "defaults", "to", "first", "one", "." ]
79d7acfec191556a7be738654ff866ff34da666b
https://github.com/jeevatkm/digitalocean-api-java/blob/79d7acfec191556a7be738654ff866ff34da666b/src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java#L1878-L1880
103,822
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java
DigitalOceanClient.checkBlankAndThrowError
private void checkBlankAndThrowError(String str, String msg) { if (StringUtils.isBlank(str)) { log.error(msg); throw new IllegalArgumentException(msg); } }
java
private void checkBlankAndThrowError(String str, String msg) { if (StringUtils.isBlank(str)) { log.error(msg); throw new IllegalArgumentException(msg); } }
[ "private", "void", "checkBlankAndThrowError", "(", "String", "str", ",", "String", "msg", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "str", ")", ")", "{", "log", ".", "error", "(", "msg", ")", ";", "throw", "new", "IllegalArgumentException", ...
It checks for null, whitespace and length
[ "It", "checks", "for", "null", "whitespace", "and", "length" ]
79d7acfec191556a7be738654ff866ff34da666b
https://github.com/jeevatkm/digitalocean-api-java/blob/79d7acfec191556a7be738654ff866ff34da666b/src/main/java/com/myjeeva/digitalocean/impl/DigitalOceanClient.java#L1915-L1920
103,823
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java
CommonsArchiver.createArchiveOutputStream
protected ArchiveOutputStream createArchiveOutputStream(File archiveFile) throws IOException { try { return CommonsStreamFactory.createArchiveOutputStream(this, archiveFile); } catch (ArchiveException e) { throw new IOException(e); } }
java
protected ArchiveOutputStream createArchiveOutputStream(File archiveFile) throws IOException { try { return CommonsStreamFactory.createArchiveOutputStream(this, archiveFile); } catch (ArchiveException e) { throw new IOException(e); } }
[ "protected", "ArchiveOutputStream", "createArchiveOutputStream", "(", "File", "archiveFile", ")", "throws", "IOException", "{", "try", "{", "return", "CommonsStreamFactory", ".", "createArchiveOutputStream", "(", "this", ",", "archiveFile", ")", ";", "}", "catch", "("...
Returns a new ArchiveOutputStream for creating archives. Subclasses can override this to return their own custom implementation. @param archiveFile the archive file to stream to @return a new ArchiveOutputStream for the given archive file. @throws IOException propagated IO exceptions
[ "Returns", "a", "new", "ArchiveOutputStream", "for", "creating", "archives", ".", "Subclasses", "can", "override", "this", "to", "return", "their", "own", "custom", "implementation", "." ]
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java#L160-L166
103,824
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java
CommonsArchiver.assertExtractSource
protected void assertExtractSource(File archive) throws FileNotFoundException, IllegalArgumentException { if (archive.isDirectory()) { throw new IllegalArgumentException("Can not extract " + archive + ". Source is a directory."); } else if (!archive.exists()) { throw new FileNotF...
java
protected void assertExtractSource(File archive) throws FileNotFoundException, IllegalArgumentException { if (archive.isDirectory()) { throw new IllegalArgumentException("Can not extract " + archive + ". Source is a directory."); } else if (!archive.exists()) { throw new FileNotF...
[ "protected", "void", "assertExtractSource", "(", "File", "archive", ")", "throws", "FileNotFoundException", ",", "IllegalArgumentException", "{", "if", "(", "archive", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can no...
Asserts that the given File object is a readable file that can be used to extract from. @param archive the file to check @throws FileNotFoundException if the file does not exist @throws IllegalArgumentException if the file is a directory or not readable
[ "Asserts", "that", "the", "given", "File", "object", "is", "a", "readable", "file", "that", "can", "be", "used", "to", "extract", "from", "." ]
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java#L175-L183
103,825
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java
CommonsArchiver.createNewArchiveFile
protected File createNewArchiveFile(String archive, String extension, File destination) throws IOException { if (!archive.endsWith(extension)) { archive += extension; } File file = new File(destination, archive); file.createNewFile(); return file; }
java
protected File createNewArchiveFile(String archive, String extension, File destination) throws IOException { if (!archive.endsWith(extension)) { archive += extension; } File file = new File(destination, archive); file.createNewFile(); return file; }
[ "protected", "File", "createNewArchiveFile", "(", "String", "archive", ",", "String", "extension", ",", "File", "destination", ")", "throws", "IOException", "{", "if", "(", "!", "archive", ".", "endsWith", "(", "extension", ")", ")", "{", "archive", "+=", "e...
Creates a new File in the given destination. The resulting name will always be "archive"."fileExtension". If the archive name parameter already ends with the given file name extension, it is not additionally appended. @param archive the name of the archive @param extension the file extension (e.g. ".tar") @param desti...
[ "Creates", "a", "new", "File", "in", "the", "given", "destination", ".", "The", "resulting", "name", "will", "always", "be", "archive", ".", "fileExtension", ".", "If", "the", "archive", "name", "parameter", "already", "ends", "with", "the", "given", "file",...
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CommonsArchiver.java#L195-L204
103,826
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/AttributeAccessor.java
AttributeAccessor.create
public static AttributeAccessor<?> create(ArchiveEntry entry) { if (entry instanceof TarArchiveEntry) { return new TarAttributeAccessor((TarArchiveEntry) entry); } else if (entry instanceof ZipArchiveEntry) { return new ZipAttributeAccessor((ZipArchiveEntry) entry); } els...
java
public static AttributeAccessor<?> create(ArchiveEntry entry) { if (entry instanceof TarArchiveEntry) { return new TarAttributeAccessor((TarArchiveEntry) entry); } else if (entry instanceof ZipArchiveEntry) { return new ZipAttributeAccessor((ZipArchiveEntry) entry); } els...
[ "public", "static", "AttributeAccessor", "<", "?", ">", "create", "(", "ArchiveEntry", "entry", ")", "{", "if", "(", "entry", "instanceof", "TarArchiveEntry", ")", "{", "return", "new", "TarAttributeAccessor", "(", "(", "TarArchiveEntry", ")", "entry", ")", ";...
Detects the type of the given ArchiveEntry and returns an appropriate AttributeAccessor for it. @param entry the adaptee @return a new attribute accessor instance
[ "Detects", "the", "type", "of", "the", "given", "ArchiveEntry", "and", "returns", "an", "appropriate", "AttributeAccessor", "for", "it", "." ]
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/AttributeAccessor.java#L63-L77
103,827
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/CompressorFactory.java
CompressorFactory.createCompressor
public static Compressor createCompressor(String compression) throws IllegalArgumentException { if (!CompressionType.isValidCompressionType(compression)) { throw new IllegalArgumentException("Unkonwn compression type " + compression); } return createCompressor(CompressionType.fromSt...
java
public static Compressor createCompressor(String compression) throws IllegalArgumentException { if (!CompressionType.isValidCompressionType(compression)) { throw new IllegalArgumentException("Unkonwn compression type " + compression); } return createCompressor(CompressionType.fromSt...
[ "public", "static", "Compressor", "createCompressor", "(", "String", "compression", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "CompressionType", ".", "isValidCompressionType", "(", "compression", ")", ")", "{", "throw", "new", "IllegalArgumentExc...
Creates a compressor from the given compression type. @param compression the name of the compression algorithm e.g. "gz" or "bzip2". @return a new {@link Compressor} instance for the given compression algorithm @throws IllegalArgumentException if the compression type is unknown
[ "Creates", "a", "compressor", "from", "the", "given", "compression", "type", "." ]
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/CompressorFactory.java#L73-L79
103,828
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/IOUtils.java
IOUtils.copy
public static void copy(InputStream source, File destination) throws IOException { OutputStream output = null; try { output = new FileOutputStream(destination); copy(source, output); } finally { closeQuietly(output); } }
java
public static void copy(InputStream source, File destination) throws IOException { OutputStream output = null; try { output = new FileOutputStream(destination); copy(source, output); } finally { closeQuietly(output); } }
[ "public", "static", "void", "copy", "(", "InputStream", "source", ",", "File", "destination", ")", "throws", "IOException", "{", "OutputStream", "output", "=", "null", ";", "try", "{", "output", "=", "new", "FileOutputStream", "(", "destination", ")", ";", "...
Copies the content of an InputStream into a destination File. @param source the InputStream to copy @param destination the target File @throws IOException if an error occurs
[ "Copies", "the", "content", "of", "an", "InputStream", "into", "a", "destination", "File", "." ]
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/IOUtils.java#L46-L55
103,829
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/IOUtils.java
IOUtils.filesContainedIn
public static File[] filesContainedIn(File source) { if (source.isDirectory()) { return source.listFiles(); } else { return new File[] { source }; } }
java
public static File[] filesContainedIn(File source) { if (source.isDirectory()) { return source.listFiles(); } else { return new File[] { source }; } }
[ "public", "static", "File", "[", "]", "filesContainedIn", "(", "File", "source", ")", "{", "if", "(", "source", ".", "isDirectory", "(", ")", ")", "{", "return", "source", ".", "listFiles", "(", ")", ";", "}", "else", "{", "return", "new", "File", "[...
Given a source File, return its direct descendants if the File is a directory. Otherwise return the File itself. @param source File or folder to be examined @return a File[] array containing the files inside this folder, or a size-1 array containing the file itself.
[ "Given", "a", "source", "File", "return", "its", "direct", "descendants", "if", "the", "File", "is", "a", "directory", ".", "Otherwise", "return", "the", "File", "itself", "." ]
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/IOUtils.java#L148-L154
103,830
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/FileModeMapper.java
FileModeMapper.map
public static void map(ArchiveEntry entry, File file) throws IOException { create(entry).map(file); }
java
public static void map(ArchiveEntry entry, File file) throws IOException { create(entry).map(file); }
[ "public", "static", "void", "map", "(", "ArchiveEntry", "entry", ",", "File", "file", ")", "throws", "IOException", "{", "create", "(", "entry", ")", ".", "map", "(", "file", ")", ";", "}" ]
Utility method to create a FileModeMapper for the given entry, and use it to map the file mode onto the given file. @param entry the archive entry that holds the mode @param file the file to apply the mode onto
[ "Utility", "method", "to", "create", "a", "FileModeMapper", "for", "the", "given", "entry", "and", "use", "it", "to", "map", "the", "file", "mode", "onto", "the", "given", "file", "." ]
8afee5124c588f589306796985b722d63572bbfa
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/FileModeMapper.java#L59-L61
103,831
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java
CurrencyDateCalculatorBuilder.ccy1Calendar
public CurrencyDateCalculatorBuilder<E> ccy1Calendar(final HolidayCalendar<E> ccy1Calendar) { if (ccy1Calendar != null) { this.ccy1Calendar = ccy1Calendar; } return this; }
java
public CurrencyDateCalculatorBuilder<E> ccy1Calendar(final HolidayCalendar<E> ccy1Calendar) { if (ccy1Calendar != null) { this.ccy1Calendar = ccy1Calendar; } return this; }
[ "public", "CurrencyDateCalculatorBuilder", "<", "E", ">", "ccy1Calendar", "(", "final", "HolidayCalendar", "<", "E", ">", "ccy1Calendar", ")", "{", "if", "(", "ccy1Calendar", "!=", "null", ")", "{", "this", ".", "ccy1Calendar", "=", "ccy1Calendar", ";", "}", ...
The holiday calendar for ccy1, if null or not set, then a default calendar will be used with NO holidays. @param ccy1Calendar the Calendar for ccy1 @return the builder
[ "The", "holiday", "calendar", "for", "ccy1", "if", "null", "or", "not", "set", "then", "a", "default", "calendar", "will", "be", "used", "with", "NO", "holidays", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java#L236-L241
103,832
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java
CurrencyDateCalculatorBuilder.ccy2Calendar
public CurrencyDateCalculatorBuilder<E> ccy2Calendar(final HolidayCalendar<E> ccy2Calendar) { if (ccy2Calendar != null) { this.ccy2Calendar = ccy2Calendar; } return this; }
java
public CurrencyDateCalculatorBuilder<E> ccy2Calendar(final HolidayCalendar<E> ccy2Calendar) { if (ccy2Calendar != null) { this.ccy2Calendar = ccy2Calendar; } return this; }
[ "public", "CurrencyDateCalculatorBuilder", "<", "E", ">", "ccy2Calendar", "(", "final", "HolidayCalendar", "<", "E", ">", "ccy2Calendar", ")", "{", "if", "(", "ccy2Calendar", "!=", "null", ")", "{", "this", ".", "ccy2Calendar", "=", "ccy2Calendar", ";", "}", ...
The holiday calendar for ccy2, if null or not set, then a default calendar will be used with NO holidays. @param ccy2Calendar the Calendar for ccy2 @return the builder
[ "The", "holiday", "calendar", "for", "ccy2", "if", "null", "or", "not", "set", "then", "a", "default", "calendar", "will", "be", "used", "with", "NO", "holidays", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java#L248-L253
103,833
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java
CurrencyDateCalculatorBuilder.crossCcyCalendar
public CurrencyDateCalculatorBuilder<E> crossCcyCalendar(final HolidayCalendar<E> crossCcyCalendar) { if (crossCcyCalendar != null) { this.crossCcyCalendar = crossCcyCalendar; } return this; }
java
public CurrencyDateCalculatorBuilder<E> crossCcyCalendar(final HolidayCalendar<E> crossCcyCalendar) { if (crossCcyCalendar != null) { this.crossCcyCalendar = crossCcyCalendar; } return this; }
[ "public", "CurrencyDateCalculatorBuilder", "<", "E", ">", "crossCcyCalendar", "(", "final", "HolidayCalendar", "<", "E", ">", "crossCcyCalendar", ")", "{", "if", "(", "crossCcyCalendar", "!=", "null", ")", "{", "this", ".", "crossCcyCalendar", "=", "crossCcyCalend...
If brokenDate is not allowed, we do require to check the WorkingWeek and Holiday for the crossCcy when validating the SpotDate or a Tenor date. @param crossCcyCalendar the set of holidays for the crossCcy @return the builder
[ "If", "brokenDate", "is", "not", "allowed", "we", "do", "require", "to", "check", "the", "WorkingWeek", "and", "Holiday", "for", "the", "crossCcy", "when", "validating", "the", "SpotDate", "or", "a", "Tenor", "date", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/CurrencyDateCalculatorBuilder.java#L272-L277
103,834
Appendium/objectlabkit
datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java
CalendarKitCalculatorsFactory.getDateCalculator
public CalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType) { final CalendarDateCalculator cal = new CalendarDateCalculator(); cal.setName(name); setHolidays(name, cal); if (holidayHandlerType != null) { cal.setHolidayHandler(getHo...
java
public CalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType) { final CalendarDateCalculator cal = new CalendarDateCalculator(); cal.setName(name); setHolidays(name, cal); if (holidayHandlerType != null) { cal.setHolidayHandler(getHo...
[ "public", "CalendarDateCalculator", "getDateCalculator", "(", "final", "String", "name", ",", "final", "String", "holidayHandlerType", ")", "{", "final", "CalendarDateCalculator", "cal", "=", "new", "CalendarDateCalculator", "(", ")", ";", "cal", ".", "setName", "("...
Create a new DateCalculator for a given name and type of handling. @param name calendar name (holidays set interested in). If there is set of holidays with that name, it will return a DateCalculator with an empty holiday set (will work on Weekend only). @param holidayHandlerType typically one of the value of HolidayHa...
[ "Create", "a", "new", "DateCalculator", "for", "a", "given", "name", "and", "type", "of", "handling", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java#L132-L140
103,835
Appendium/objectlabkit
datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java
CalendarIMMDateCalculator.moveToIMMDay
private static void moveToIMMDay(final Calendar cal) { cal.set(DAY_OF_MONTH, 1); // go to 1st wed final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); if (dayOfWeek < WEDNESDAY) { cal.add(DAY_OF_MONTH, WEDNESDAY - dayOfWeek); } else if (dayOfWeek > WEDNESDAY) ...
java
private static void moveToIMMDay(final Calendar cal) { cal.set(DAY_OF_MONTH, 1); // go to 1st wed final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); if (dayOfWeek < WEDNESDAY) { cal.add(DAY_OF_MONTH, WEDNESDAY - dayOfWeek); } else if (dayOfWeek > WEDNESDAY) ...
[ "private", "static", "void", "moveToIMMDay", "(", "final", "Calendar", "cal", ")", "{", "cal", ".", "set", "(", "DAY_OF_MONTH", ",", "1", ")", ";", "// go to 1st wed\r", "final", "int", "dayOfWeek", "=", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEE...
Assumes that the month is correct, get the day for the 3rd wednesday. @param cal
[ "Assumes", "that", "the", "month", "is", "correct", "get", "the", "day", "for", "the", "3rd", "wednesday", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java#L178-L191
103,836
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
Utils.blastTime
public static Calendar blastTime(final Calendar cal) { cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; }
java
public static Calendar blastTime(final Calendar cal) { cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; }
[ "public", "static", "Calendar", "blastTime", "(", "final", "Calendar", "cal", ")", "{", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "cal", ".", "...
Removes set's all "time" fields to zero, leaving only the date portion of the Calendar. The Calendar passe @param cal to Calendar object to blast, note, it will be modified @return the calendar object modified (same instance)
[ "Removes", "set", "s", "all", "time", "fields", "to", "zero", "leaving", "only", "the", "date", "portion", "of", "the", "Calendar", ".", "The", "Calendar", "passe" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L64-L70
103,837
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
Utils.createDate
public static Date createDate(final String dateStr) { if (dateStr == null) { return createCalendar(null).getTime(); } final Calendar cal = getCal(dateStr); return cal != null ? cal.getTime() : null; }
java
public static Date createDate(final String dateStr) { if (dateStr == null) { return createCalendar(null).getTime(); } final Calendar cal = getCal(dateStr); return cal != null ? cal.getTime() : null; }
[ "public", "static", "Date", "createDate", "(", "final", "String", "dateStr", ")", "{", "if", "(", "dateStr", "==", "null", ")", "{", "return", "createCalendar", "(", "null", ")", ".", "getTime", "(", ")", ";", "}", "final", "Calendar", "cal", "=", "get...
Creates a Date object given a string representation of it @param dateStr string (return today if string is null) @return today if string is null, a Date object representing the string otherwise @throws IllegalArgumentException if the string cannot be parsed.
[ "Creates", "a", "Date", "object", "given", "a", "string", "representation", "of", "it" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L82-L88
103,838
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
Utils.createCalendar
public static Calendar createCalendar(final String dateStr) { if (dateStr == null) { return blastTime(Calendar.getInstance()); } return getCal(dateStr); }
java
public static Calendar createCalendar(final String dateStr) { if (dateStr == null) { return blastTime(Calendar.getInstance()); } return getCal(dateStr); }
[ "public", "static", "Calendar", "createCalendar", "(", "final", "String", "dateStr", ")", "{", "if", "(", "dateStr", "==", "null", ")", "{", "return", "blastTime", "(", "Calendar", ".", "getInstance", "(", ")", ")", ";", "}", "return", "getCal", "(", "da...
get a new Calendar based on the string date. @param dateStr the date string @return a new Calendar @throws IllegalArgumentException if the string cannot be parsed.
[ "get", "a", "new", "Calendar", "based", "on", "the", "string", "date", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L106-L111
103,839
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
Utils.getCal
public static Calendar getCal(final Date date) { if (date == null) { return null; } final Calendar cal = Calendar.getInstance(); cal.setTime(date); return blastTime(cal); }
java
public static Calendar getCal(final Date date) { if (date == null) { return null; } final Calendar cal = Calendar.getInstance(); cal.setTime(date); return blastTime(cal); }
[ "public", "static", "Calendar", "getCal", "(", "final", "Date", "date", ")", "{", "if", "(", "date", "==", "null", ")", "{", "return", "null", ";", "}", "final", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setT...
Get a Calendar object for a given Date representation. @param date @return the Calendar
[ "Get", "a", "Calendar", "object", "for", "a", "given", "Date", "representation", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L128-L135
103,840
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
Utils.toDateSet
public static Set<Date> toDateSet(final Set<Calendar> calendars) { return calendars.stream().map(Calendar::getTime).collect(Collectors.toSet()); }
java
public static Set<Date> toDateSet(final Set<Calendar> calendars) { return calendars.stream().map(Calendar::getTime).collect(Collectors.toSet()); }
[ "public", "static", "Set", "<", "Date", ">", "toDateSet", "(", "final", "Set", "<", "Calendar", ">", "calendars", ")", "{", "return", "calendars", ".", "stream", "(", ")", ".", "map", "(", "Calendar", "::", "getTime", ")", ".", "collect", "(", "Collect...
Converts a Set of Calendar objects to a Set of Date objects @param calendars @return the converset Set&lt;Date&gt;
[ "Converts", "a", "Set", "of", "Calendar", "objects", "to", "a", "Set", "of", "Date", "objects" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java#L167-L169
103,841
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
AbstractDateCalculator.setStartDate
@Override public DateCalculator<E> setStartDate(final E startDate) { this.startDate = startDate; setCurrentBusinessDate(startDate); return this; }
java
@Override public DateCalculator<E> setStartDate(final E startDate) { this.startDate = startDate; setCurrentBusinessDate(startDate); return this; }
[ "@", "Override", "public", "DateCalculator", "<", "E", ">", "setStartDate", "(", "final", "E", "startDate", ")", "{", "this", ".", "startDate", "=", "startDate", ";", "setCurrentBusinessDate", "(", "startDate", ")", ";", "return", "this", ";", "}" ]
Set both start date and current date
[ "Set", "both", "start", "date", "and", "current", "date" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java#L118-L123
103,842
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
AbstractDateCalculator.moveByTenor
@Override public DateCalculator<E> moveByTenor(final Tenor tenor, final int spotLag) { if (tenor == null) { throw new IllegalArgumentException("Tenor cannot be null"); } TenorCode tenorCode = tenor.getCode(); if (tenorCode != TenorCode.OVERNIGHT && tenorCode != Te...
java
@Override public DateCalculator<E> moveByTenor(final Tenor tenor, final int spotLag) { if (tenor == null) { throw new IllegalArgumentException("Tenor cannot be null"); } TenorCode tenorCode = tenor.getCode(); if (tenorCode != TenorCode.OVERNIGHT && tenorCode != Te...
[ "@", "Override", "public", "DateCalculator", "<", "E", ">", "moveByTenor", "(", "final", "Tenor", "tenor", ",", "final", "int", "spotLag", ")", "{", "if", "(", "tenor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Tenor cannot ...
move the current date by a given tenor, this means that if a date is either a 'weekend' or holiday, it will be skipped acording to the holiday handler and not count towards the number of days to move. @param tenor the tenor. @param spotLag number of days to "spot" days, this can vary from one market to the other. @ret...
[ "move", "the", "current", "date", "by", "a", "given", "tenor", "this", "means", "that", "if", "a", "date", "is", "either", "a", "weekend", "or", "holiday", "it", "will", "be", "skipped", "acording", "to", "the", "holiday", "handler", "and", "not", "count...
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java#L145-L168
103,843
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
AbstractDateCalculator.isNonWorkingDay
@Override public boolean isNonWorkingDay(final E date) { if (date != null && (holidayCalendar.getEarlyBoundary() != null || holidayCalendar.getLateBoundary() != null)) { checkBoundary(date); } return isWeekend(date) || holidayCalendar.isHoliday(date); }
java
@Override public boolean isNonWorkingDay(final E date) { if (date != null && (holidayCalendar.getEarlyBoundary() != null || holidayCalendar.getLateBoundary() != null)) { checkBoundary(date); } return isWeekend(date) || holidayCalendar.isHoliday(date); }
[ "@", "Override", "public", "boolean", "isNonWorkingDay", "(", "final", "E", "date", ")", "{", "if", "(", "date", "!=", "null", "&&", "(", "holidayCalendar", ".", "getEarlyBoundary", "(", ")", "!=", "null", "||", "holidayCalendar", ".", "getLateBoundary", "("...
is the given date a non working day?
[ "is", "the", "given", "date", "a", "non", "working", "day?" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java#L271-L277
103,844
Appendium/objectlabkit
utils-excel/src/main/java/net/objectlab/kit/util/excel/ExcelCell.java
ExcelCell.newCell
public ExcelCell newCell(String url, String label) { return row.newCell().link(url, label); }
java
public ExcelCell newCell(String url, String label) { return row.newCell().link(url, label); }
[ "public", "ExcelCell", "newCell", "(", "String", "url", ",", "String", "label", ")", "{", "return", "row", ".", "newCell", "(", ")", ".", "link", "(", "url", ",", "label", ")", ";", "}" ]
Add a hyperlink @param url URL @param label Label for the cell @return the cell
[ "Add", "a", "hyperlink" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils-excel/src/main/java/net/objectlab/kit/util/excel/ExcelCell.java#L71-L73
103,845
Appendium/objectlabkit
fxcalc/src/main/java/net/objectlab/kit/fxcalc/Cash.java
Cash.add
@Override public CurrencyAmount add(final CurrencyAmount money) { if (!money.getCurrency().equals(currency)) { throw new IllegalArgumentException("You cannot add " + money.getCurrency() + " with " + currency); } return new Cash(currency, BigDecimalUtil.add(amount, money.getAmount...
java
@Override public CurrencyAmount add(final CurrencyAmount money) { if (!money.getCurrency().equals(currency)) { throw new IllegalArgumentException("You cannot add " + money.getCurrency() + " with " + currency); } return new Cash(currency, BigDecimalUtil.add(amount, money.getAmount...
[ "@", "Override", "public", "CurrencyAmount", "add", "(", "final", "CurrencyAmount", "money", ")", "{", "if", "(", "!", "money", ".", "getCurrency", "(", ")", ".", "equals", "(", "currency", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\...
Add the amount with the existing one and return a new immutable Money. @throws IllegalArgumentException if the money.currency does not match the current one.
[ "Add", "the", "amount", "with", "the", "existing", "one", "and", "return", "a", "new", "immutable", "Money", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/Cash.java#L78-L84
103,846
Appendium/objectlabkit
datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java
DateDateCalculator.isWeekend
public boolean isWeekend(final Date date) { if (date != null && delegate != null) { return delegate.isWeekend(Utils.getCal(date)); } return false; }
java
public boolean isWeekend(final Date date) { if (date != null && delegate != null) { return delegate.isWeekend(Utils.getCal(date)); } return false; }
[ "public", "boolean", "isWeekend", "(", "final", "Date", "date", ")", "{", "if", "(", "date", "!=", "null", "&&", "delegate", "!=", "null", ")", "{", "return", "delegate", ".", "isWeekend", "(", "Utils", ".", "getCal", "(", "date", ")", ")", ";", "}",...
is the date a non-working day according to the WorkingWeek?
[ "is", "the", "date", "a", "non", "-", "working", "day", "according", "to", "the", "WorkingWeek?" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java#L97-L102
103,847
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.bd
public static BigDecimal bd(final String val) { return val != null && val.length() > 0 ? new BigDecimal(val) : null; }
java
public static BigDecimal bd(final String val) { return val != null && val.length() > 0 ? new BigDecimal(val) : null; }
[ "public", "static", "BigDecimal", "bd", "(", "final", "String", "val", ")", "{", "return", "val", "!=", "null", "&&", "val", ".", "length", "(", ")", ">", "0", "?", "new", "BigDecimal", "(", "val", ")", ":", "null", ";", "}" ]
Convenience method to create a BigDecimal with a String, can be statically imported. @param val a string representing the BigDecimal @return the new BigDecimal
[ "Convenience", "method", "to", "create", "a", "BigDecimal", "with", "a", "String", "can", "be", "statically", "imported", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L75-L77
103,848
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.inverse
public static BigDecimal inverse(final BigDecimal value) { if (isNotZero(value)) { return BigDecimal.ONE.setScale(MAX_SCALE_FOR_INVERSE).divide(value, BigDecimal.ROUND_HALF_UP); } return null; }
java
public static BigDecimal inverse(final BigDecimal value) { if (isNotZero(value)) { return BigDecimal.ONE.setScale(MAX_SCALE_FOR_INVERSE).divide(value, BigDecimal.ROUND_HALF_UP); } return null; }
[ "public", "static", "BigDecimal", "inverse", "(", "final", "BigDecimal", "value", ")", "{", "if", "(", "isNotZero", "(", "value", ")", ")", "{", "return", "BigDecimal", ".", "ONE", ".", "setScale", "(", "MAX_SCALE_FOR_INVERSE", ")", ".", "divide", "(", "va...
Return the inverse of value if no tnull of zero @param value the nullable BigDecimal @return 1 / value (if not null of zero)
[ "Return", "the", "inverse", "of", "value", "if", "no", "tnull", "of", "zero" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L108-L113
103,849
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.isSameAbsValue
public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) { 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", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L347-L349
103,850
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.roundTo
public static BigDecimal roundTo(final BigDecimal bd, final int numberOfDecPlaces, final int finalScale) { return setScale(setScale(bd, numberOfDecPlaces, BigDecimal.ROUND_HALF_UP), finalScale); }
java
public static BigDecimal roundTo(final BigDecimal bd, final int numberOfDecPlaces, final int finalScale) { return setScale(setScale(bd, numberOfDecPlaces, BigDecimal.ROUND_HALF_UP), finalScale); }
[ "public", "static", "BigDecimal", "roundTo", "(", "final", "BigDecimal", "bd", ",", "final", "int", "numberOfDecPlaces", ",", "final", "int", "finalScale", ")", "{", "return", "setScale", "(", "setScale", "(", "bd", ",", "numberOfDecPlaces", ",", "BigDecimal", ...
returns a new BigDecimal with correct scale after being round to n dec places. @param bd value @param numberOfDecPlaces number of dec place to round to @param finalScale final scale of result (typically numberOfDecPlaces &lt; finalScale); @return new bd or null
[ "returns", "a", "new", "BigDecimal", "with", "correct", "scale", "after", "being", "round", "to", "n", "dec", "places", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L397-L399
103,851
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.setScale
public static BigDecimal setScale(final BigDecimal bd, final int scale) { return setScale(bd, scale, BigDecimal.ROUND_HALF_UP); }
java
public static BigDecimal setScale(final BigDecimal bd, final int scale) { return setScale(bd, scale, BigDecimal.ROUND_HALF_UP); }
[ "public", "static", "BigDecimal", "setScale", "(", "final", "BigDecimal", "bd", ",", "final", "int", "scale", ")", "{", "return", "setScale", "(", "bd", ",", "scale", ",", "BigDecimal", ".", "ROUND_HALF_UP", ")", ";", "}" ]
returns a new BigDecimal with correct scale. @param bd @return new bd or null
[ "returns", "a", "new", "BigDecimal", "with", "correct", "scale", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L407-L409
103,852
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.setScale
public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) { if (bd != null && scale != null) { return bd.setScale(scale, rounding); } return null; }
java
public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) { if (bd != null && scale != null) { return bd.setScale(scale, rounding); } return null; }
[ "public", "static", "BigDecimal", "setScale", "(", "final", "BigDecimal", "bd", ",", "final", "Integer", "scale", ",", "final", "int", "rounding", ")", "{", "if", "(", "bd", "!=", "null", "&&", "scale", "!=", "null", ")", "{", "return", "bd", ".", "set...
returns a new BigDecimal with correct Scales.PERCENT_SCALE. This is used by the table renderer. @param bd @return new bd or null
[ "returns", "a", "new", "BigDecimal", "with", "correct", "Scales", ".", "PERCENT_SCALE", ".", "This", "is", "used", "by", "the", "table", "renderer", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L428-L433
103,853
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.percentFormat
public static String percentFormat(final BigDecimal bd) { return bd != null ? NUMBER_FORMAT.format(bd.movePointRight(2)) : ""; }
java
public static String percentFormat(final BigDecimal bd) { return bd != null ? NUMBER_FORMAT.format(bd.movePointRight(2)) : ""; }
[ "public", "static", "String", "percentFormat", "(", "final", "BigDecimal", "bd", ")", "{", "return", "bd", "!=", "null", "?", "NUMBER_FORMAT", ".", "format", "(", "bd", ".", "movePointRight", "(", "2", ")", ")", ":", "\"\"", ";", "}" ]
return a Number formatted or empty string if null. @param bd
[ "return", "a", "Number", "formatted", "or", "empty", "string", "if", "null", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L534-L536
103,854
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.ensureMin
public static BigDecimal ensureMin(final BigDecimal minimum, final BigDecimal value) { return BigDecimalUtil.compareTo(minimum, value) == 1 ? minimum : value; }
java
public static BigDecimal ensureMin(final BigDecimal minimum, final BigDecimal value) { return BigDecimalUtil.compareTo(minimum, value) == 1 ? minimum : value; }
[ "public", "static", "BigDecimal", "ensureMin", "(", "final", "BigDecimal", "minimum", ",", "final", "BigDecimal", "value", ")", "{", "return", "BigDecimalUtil", ".", "compareTo", "(", "minimum", ",", "value", ")", "==", "1", "?", "minimum", ":", "value", ";"...
Return minimum if the value is &lt; minimum.
[ "Return", "minimum", "if", "the", "value", "is", "&lt", ";", "minimum", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L694-L696
103,855
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.forceNegativeIfTrue
public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) { return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount); }
java
public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) { return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount); }
[ "public", "static", "BigDecimal", "forceNegativeIfTrue", "(", "final", "boolean", "condition", ",", "final", "BigDecimal", "amount", ")", "{", "return", "condition", "?", "BigDecimalUtil", ".", "negate", "(", "BigDecimalUtil", ".", "abs", "(", "amount", ")", ")"...
Return a negative amount based on amount if true, otherwise return the ABS.
[ "Return", "a", "negative", "amount", "based", "on", "amount", "if", "true", "otherwise", "return", "the", "ABS", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L708-L710
103,856
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.decimalPart
public static BigDecimal decimalPart(final BigDecimal val) { return BigDecimalUtil.subtract(val, val.setScale(0, BigDecimal.ROUND_DOWN)); }
java
public static BigDecimal decimalPart(final BigDecimal val) { return BigDecimalUtil.subtract(val, val.setScale(0, BigDecimal.ROUND_DOWN)); }
[ "public", "static", "BigDecimal", "decimalPart", "(", "final", "BigDecimal", "val", ")", "{", "return", "BigDecimalUtil", ".", "subtract", "(", "val", ",", "val", ".", "setScale", "(", "0", ",", "BigDecimal", ".", "ROUND_DOWN", ")", ")", ";", "}" ]
Return the decimal part of the value. @param val
[ "Return", "the", "decimal", "part", "of", "the", "value", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L772-L774
103,857
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.sqrtNewtonRaphson
private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) { BigDecimal fx = xn.pow(2).add(c.negate()); BigDecimal fpx = xn.multiply(new BigDecimal(2)); BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN); ...
java
private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) { BigDecimal fx = xn.pow(2).add(c.negate()); BigDecimal fpx = xn.multiply(new BigDecimal(2)); BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN); ...
[ "private", "static", "BigDecimal", "sqrtNewtonRaphson", "(", "final", "BigDecimal", "c", ",", "final", "BigDecimal", "xn", ",", "final", "BigDecimal", "precision", ")", "{", "BigDecimal", "fx", "=", "xn", ".", "pow", "(", "2", ")", ".", "add", "(", "c", ...
Private utility method used to compute the square root of a BigDecimal. @author Luciano Culacciatti @see <a href="http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal">http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal</a>
[ "Private", "utility", "method", "used", "to", "compute", "the", "square", "root", "of", "a", "BigDecimal", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L782-L794
103,858
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.bigSqrt
public static BigDecimal bigSqrt(final BigDecimal c) { if (c == null) { return null; } return c.signum() == 0 ? BigDecimal.ZERO : sqrtNewtonRaphson(c, BigDecimal.ONE, BigDecimal.ONE.divide(SQRT_PRE)); }
java
public static BigDecimal bigSqrt(final BigDecimal c) { if (c == null) { return null; } return c.signum() == 0 ? BigDecimal.ZERO : sqrtNewtonRaphson(c, BigDecimal.ONE, BigDecimal.ONE.divide(SQRT_PRE)); }
[ "public", "static", "BigDecimal", "bigSqrt", "(", "final", "BigDecimal", "c", ")", "{", "if", "(", "c", "==", "null", ")", "{", "return", "null", ";", "}", "return", "c", ".", "signum", "(", ")", "==", "0", "?", "BigDecimal", ".", "ZERO", ":", "sqr...
Uses Newton Raphson to compute the square root of a BigDecimal. @param c the BigDecimal for which we want the SQRT. @author Luciano Culacciatti @see <a href="http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal">http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal</a>
[ "Uses", "Newton", "Raphson", "to", "compute", "the", "square", "root", "of", "a", "BigDecimal", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L803-L809
103,859
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.addMenuItem
public void addMenuItem(final String menuDisplay, final String methodName, final boolean repeat) { menu.add(menuDisplay); methods.add(methodName); askForRepeat.add(Boolean.valueOf(repeat)); }
java
public void addMenuItem(final String menuDisplay, final String methodName, final boolean repeat) { menu.add(menuDisplay); methods.add(methodName); askForRepeat.add(Boolean.valueOf(repeat)); }
[ "public", "void", "addMenuItem", "(", "final", "String", "menuDisplay", ",", "final", "String", "methodName", ",", "final", "boolean", "repeat", ")", "{", "menu", ".", "add", "(", "menuDisplay", ")", ";", "methods", ".", "add", "(", "methodName", ")", ";",...
add an entry in the menu, sequentially @param menuDisplay how the entry will be displayed in the menu @param methodName name of the public method @param repeat call back for repeat
[ "add", "an", "entry", "in", "the", "menu", "sequentially" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L94-L98
103,860
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.displayMenu
public void displayMenu() { while (true) { ConsoleMenu.println(""); ConsoleMenu.println("Menu Options"); final int size = menu.size(); displayMenu(size); int opt; do { opt = ConsoleMenu.getInt("Enter your cho...
java
public void displayMenu() { while (true) { ConsoleMenu.println(""); ConsoleMenu.println("Menu Options"); final int size = menu.size(); displayMenu(size); int opt; do { opt = ConsoleMenu.getInt("Enter your cho...
[ "public", "void", "displayMenu", "(", ")", "{", "while", "(", "true", ")", "{", "ConsoleMenu", ".", "println", "(", "\"\"", ")", ";", "ConsoleMenu", ".", "println", "(", "\"Menu Options\"", ")", ";", "final", "int", "size", "=", "menu", ".", "size", "(...
display the menu, the application goes into a loop which provides the menu and fires the entries selected. It automatically adds an entry to exit.
[ "display", "the", "menu", "the", "application", "goes", "into", "a", "loop", "which", "provides", "the", "menu", "and", "fires", "the", "entries", "selected", ".", "It", "automatically", "adds", "an", "entry", "to", "exit", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L109-L131
103,861
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.getInt
public static int getInt(final String title, final int defaultValue) { int opt; do { try { final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")"); if (val.length() == 0) { opt = defaultValue; ...
java
public static int getInt(final String title, final int defaultValue) { int opt; do { try { final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")"); if (val.length() == 0) { opt = defaultValue; ...
[ "public", "static", "int", "getInt", "(", "final", "String", "title", ",", "final", "int", "defaultValue", ")", "{", "int", "opt", ";", "do", "{", "try", "{", "final", "String", "val", "=", "ConsoleMenu", ".", "getString", "(", "title", "+", "DEFAULT_TIT...
Gets an int from the System.in @param title for the command line @param defaultValue defaultValue if title not found @return int as entered by the user of the console app
[ "Gets", "an", "int", "from", "the", "System", ".", "in" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L218-L235
103,862
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.getBoolean
public static boolean getBoolean(final String title, final boolean defaultValue) { final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" }, new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() }, defaultValue ? 1 : 2); return Boolean.valueOf(val); ...
java
public static boolean getBoolean(final String title, final boolean defaultValue) { final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" }, new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() }, defaultValue ? 1 : 2); return Boolean.valueOf(val); ...
[ "public", "static", "boolean", "getBoolean", "(", "final", "String", "title", ",", "final", "boolean", "defaultValue", ")", "{", "final", "String", "val", "=", "ConsoleMenu", ".", "selectOne", "(", "title", ",", "new", "String", "[", "]", "{", "\"Yes\"", "...
Gets a boolean from the System.in @param title for the command line @return boolean as selected by the user of the console app
[ "Gets", "a", "boolean", "from", "the", "System", ".", "in" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L244-L249
103,863
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.getBigDecimal
public static BigDecimal getBigDecimal(final String title, final BigDecimal defaultValue) { BigDecimal opt; do { try { final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")"); if (val.length() == 0) { op...
java
public static BigDecimal getBigDecimal(final String title, final BigDecimal defaultValue) { BigDecimal opt; do { try { final String val = ConsoleMenu.getString(title + DEFAULT_TITLE + defaultValue + ")"); if (val.length() == 0) { op...
[ "public", "static", "BigDecimal", "getBigDecimal", "(", "final", "String", "title", ",", "final", "BigDecimal", "defaultValue", ")", "{", "BigDecimal", "opt", ";", "do", "{", "try", "{", "final", "String", "val", "=", "ConsoleMenu", ".", "getString", "(", "t...
Gets an BigDecimal from the System.in @param title for the command line @return int as entered by the user of the console app
[ "Gets", "an", "BigDecimal", "from", "the", "System", ".", "in" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L258-L275
103,864
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.getString
public static String getString(final String msg) { ConsoleMenu.print(msg); BufferedReader bufReader = null; String opt = null; try { bufReader = new BufferedReader(new InputStreamReader(System.in)); opt = bufReader.readLine(); } catch (final IOE...
java
public static String getString(final String msg) { ConsoleMenu.print(msg); BufferedReader bufReader = null; String opt = null; try { bufReader = new BufferedReader(new InputStreamReader(System.in)); opt = bufReader.readLine(); } catch (final IOE...
[ "public", "static", "String", "getString", "(", "final", "String", "msg", ")", "{", "ConsoleMenu", ".", "print", "(", "msg", ")", ";", "BufferedReader", "bufReader", "=", "null", ";", "String", "opt", "=", "null", ";", "try", "{", "bufReader", "=", "new"...
Gets a String from the System.in. @param msg for the command line @return String as entered by the user of the console app
[ "Gets", "a", "String", "from", "the", "System", ".", "in", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L307-L322
103,865
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.getString
public static String getString(final String msg, final String defaultVal) { String s = getString(msg + "(default:" + defaultVal + "):"); if (StringUtils.isBlank(s)) { s = defaultVal; } return s; }
java
public static String getString(final String msg, final String defaultVal) { String s = getString(msg + "(default:" + defaultVal + "):"); if (StringUtils.isBlank(s)) { s = defaultVal; } return s; }
[ "public", "static", "String", "getString", "(", "final", "String", "msg", ",", "final", "String", "defaultVal", ")", "{", "String", "s", "=", "getString", "(", "msg", "+", "\"(default:\"", "+", "defaultVal", "+", "\"):\"", ")", ";", "if", "(", "StringUtils...
Gets a String from the System.in @param msg for the command line @return String as entered by the user of the console app
[ "Gets", "a", "String", "from", "the", "System", ".", "in" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L331-L338
103,866
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.selectOne
public static String selectOne(final String title, final String[] optionNames, final String[] optionValues, final int defaultOption) { if (optionNames.length != optionValues.length) { throw new IllegalArgumentException("option names and values must have same length"); } Console...
java
public static String selectOne(final String title, final String[] optionNames, final String[] optionValues, final int defaultOption) { if (optionNames.length != optionValues.length) { throw new IllegalArgumentException("option names and values must have same length"); } Console...
[ "public", "static", "String", "selectOne", "(", "final", "String", "title", ",", "final", "String", "[", "]", "optionNames", ",", "final", "String", "[", "]", "optionValues", ",", "final", "int", "defaultOption", ")", "{", "if", "(", "optionNames", ".", "l...
Generates a menu with a list of options and return the value selected. @param title for the command line @param optionNames name for each option @param optionValues value for each option @return String as selected by the user of the console app
[ "Generates", "a", "menu", "with", "a", "list", "of", "options", "and", "return", "the", "value", "selected", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L351-L369
103,867
Appendium/objectlabkit
fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java
MajorCurrencyRankingImpl.selectMajorCurrency
@Override public String selectMajorCurrency(final String ccy1, final String ccy2) { return ranks.getOrDefault(StringUtil.toUpperCase(ccy1), DEFAULT_UNRANKED_VALUE).intValue() <= ranks.getOrDefault(StringUtil.toUpperCase(ccy2), DEFAULT_UNRANKED_VALUE).intValue() ? ccy1 : ccy2; }
java
@Override public String selectMajorCurrency(final String ccy1, final String ccy2) { return ranks.getOrDefault(StringUtil.toUpperCase(ccy1), DEFAULT_UNRANKED_VALUE).intValue() <= ranks.getOrDefault(StringUtil.toUpperCase(ccy2), DEFAULT_UNRANKED_VALUE).intValue() ? ccy1 : ccy2; }
[ "@", "Override", "public", "String", "selectMajorCurrency", "(", "final", "String", "ccy1", ",", "final", "String", "ccy2", ")", "{", "return", "ranks", ".", "getOrDefault", "(", "StringUtil", ".", "toUpperCase", "(", "ccy1", ")", ",", "DEFAULT_UNRANKED_VALUE", ...
Given 2 currencies, return the major one if there is one, otherwise returns the first currency.
[ "Given", "2", "currencies", "return", "the", "major", "one", "if", "there", "is", "one", "otherwise", "returns", "the", "first", "currency", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java#L38-L42
103,868
Appendium/objectlabkit
fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java
MajorCurrencyRankingImpl.selectMajorCurrency
@Override public String selectMajorCurrency(final CurrencyPair pair) { return selectMajorCurrency(pair.getCcy1(), pair.getCcy2()); }
java
@Override public String selectMajorCurrency(final CurrencyPair pair) { return selectMajorCurrency(pair.getCcy1(), pair.getCcy2()); }
[ "@", "Override", "public", "String", "selectMajorCurrency", "(", "final", "CurrencyPair", "pair", ")", "{", "return", "selectMajorCurrency", "(", "pair", ".", "getCcy1", "(", ")", ",", "pair", ".", "getCcy2", "(", ")", ")", ";", "}" ]
Given a CurrencyPair, return the major Currency if there is one, otherwise returns the first currency.
[ "Given", "a", "CurrencyPair", "return", "the", "major", "Currency", "if", "there", "is", "one", "otherwise", "returns", "the", "first", "currency", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java#L47-L50
103,869
Appendium/objectlabkit
fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java
MajorCurrencyRankingImpl.isMarketConvention
@Override public boolean isMarketConvention(final String ccy1, final String ccy2) { return selectMajorCurrency(ccy1, ccy2).equals(ccy1); }
java
@Override public boolean isMarketConvention(final String ccy1, final String ccy2) { return selectMajorCurrency(ccy1, ccy2).equals(ccy1); }
[ "@", "Override", "public", "boolean", "isMarketConvention", "(", "final", "String", "ccy1", ",", "final", "String", "ccy2", ")", "{", "return", "selectMajorCurrency", "(", "ccy1", ",", "ccy2", ")", ".", "equals", "(", "ccy1", ")", ";", "}" ]
returns true if the ccy1 is the major one for the given currency pair.
[ "returns", "true", "if", "the", "ccy1", "is", "the", "major", "one", "for", "the", "given", "currency", "pair", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/MajorCurrencyRankingImpl.java#L55-L58
103,870
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java
DefaultCurrencyCalculatorConfig.setCurrenciesSubjectToCrossCcyForT1
public void setCurrenciesSubjectToCrossCcyForT1(final Map<String, Set<String>> currenciesSubjectToCrossCcyForT1) { final Map<String, Set<String>> copy = new HashMap<>(); if (currenciesSubjectToCrossCcyForT1 != null) { copy.putAll(currenciesSubjectToCrossCcyForT1); } this.curr...
java
public void setCurrenciesSubjectToCrossCcyForT1(final Map<String, Set<String>> currenciesSubjectToCrossCcyForT1) { final Map<String, Set<String>> copy = new HashMap<>(); if (currenciesSubjectToCrossCcyForT1 != null) { copy.putAll(currenciesSubjectToCrossCcyForT1); } this.curr...
[ "public", "void", "setCurrenciesSubjectToCrossCcyForT1", "(", "final", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "currenciesSubjectToCrossCcyForT1", ")", "{", "final", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "copy", "=", "...
Will take a copy of a non null set but doing so by replacing the internal one in one go for consistency.
[ "Will", "take", "a", "copy", "of", "a", "non", "null", "set", "but", "doing", "so", "by", "replacing", "the", "internal", "one", "in", "one", "go", "for", "consistency", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java#L46-L52
103,871
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java
DefaultCurrencyCalculatorConfig.setWorkingWeeks
public void setWorkingWeeks(final Map<String, WorkingWeek> workingWeeks) { final Map<String, WorkingWeek> ww = new HashMap<>(); ww.putAll(workingWeeks); this.workingWeeks = ww; }
java
public void setWorkingWeeks(final Map<String, WorkingWeek> workingWeeks) { final Map<String, WorkingWeek> ww = new HashMap<>(); ww.putAll(workingWeeks); this.workingWeeks = ww; }
[ "public", "void", "setWorkingWeeks", "(", "final", "Map", "<", "String", ",", "WorkingWeek", ">", "workingWeeks", ")", "{", "final", "Map", "<", "String", ",", "WorkingWeek", ">", "ww", "=", "new", "HashMap", "<>", "(", ")", ";", "ww", ".", "putAll", "...
Will take a copy of a non null map but doing so by replacing the internal one in one go for consistency.
[ "Will", "take", "a", "copy", "of", "a", "non", "null", "map", "but", "doing", "so", "by", "replacing", "the", "internal", "one", "in", "one", "go", "for", "consistency", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java#L57-L61
103,872
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java
WorkingWeek.withWorkingDayFromCalendar
public WorkingWeek withWorkingDayFromCalendar(final boolean working, final int dayOfWeek) { final int day = adjustDay(dayOfWeek); WorkingWeek ret = this; if (working && !isWorkingDayFromCalendar(dayOfWeek)) { ret = new WorkingWeek((byte) (workingDays + WORKING_WEEK_DAYS_OFFSET[da...
java
public WorkingWeek withWorkingDayFromCalendar(final boolean working, final int dayOfWeek) { final int day = adjustDay(dayOfWeek); WorkingWeek ret = this; if (working && !isWorkingDayFromCalendar(dayOfWeek)) { ret = new WorkingWeek((byte) (workingDays + WORKING_WEEK_DAYS_OFFSET[da...
[ "public", "WorkingWeek", "withWorkingDayFromCalendar", "(", "final", "boolean", "working", ",", "final", "int", "dayOfWeek", ")", "{", "final", "int", "day", "=", "adjustDay", "(", "dayOfWeek", ")", ";", "WorkingWeek", "ret", "=", "this", ";", "if", "(", "wo...
If the value for the given day has changed, return a NEW WorkingWeek. @param working true if working day @param dayOfWeek e.g. Calendar.MONDAY, Calendar.TUESDAY, etc @return a new instance of a <code>WorkingWeek</code> with the working day set
[ "If", "the", "value", "for", "the", "given", "day", "has", "changed", "return", "a", "NEW", "WorkingWeek", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java#L133-L142
103,873
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
ObjectUtil.anyNull
public static boolean anyNull(final Object... o1s) { if (o1s != null && o1s.length > 0) { for (final Object o1 : o1s) { if (o1 == null) { return true; } } } else { return true; } return fals...
java
public static boolean anyNull(final Object... o1s) { if (o1s != null && o1s.length > 0) { for (final Object o1 : o1s) { if (o1 == null) { return true; } } } else { return true; } return fals...
[ "public", "static", "boolean", "anyNull", "(", "final", "Object", "...", "o1s", ")", "{", "if", "(", "o1s", "!=", "null", "&&", "o1s", ".", "length", ">", "0", ")", "{", "for", "(", "final", "Object", "o1", ":", "o1s", ")", "{", "if", "(", "o1", ...
Return true if any of the given objects are null.
[ "Return", "true", "if", "any", "of", "the", "given", "objects", "are", "null", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java#L134-L145
103,874
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
ObjectUtil.allNull
public static boolean allNull(final Object... o1s) { if (o1s != null && o1s.length > 0) { for (final Object o1 : o1s) { if (o1 != null) { return false; } } } return true; }
java
public static boolean allNull(final Object... o1s) { if (o1s != null && o1s.length > 0) { for (final Object o1 : o1s) { if (o1 != null) { return false; } } } return true; }
[ "public", "static", "boolean", "allNull", "(", "final", "Object", "...", "o1s", ")", "{", "if", "(", "o1s", "!=", "null", "&&", "o1s", ".", "length", ">", "0", ")", "{", "for", "(", "final", "Object", "o1", ":", "o1s", ")", "{", "if", "(", "o1", ...
Return true if ALL of the given objects are null.
[ "Return", "true", "if", "ALL", "of", "the", "given", "objects", "are", "null", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java#L150-L159
103,875
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
ObjectUtil.atLeastOneNotNull
public static boolean atLeastOneNotNull(final Object... o1s) { if (o1s != null && o1s.length > 0) { for (final Object o1 : o1s) { if (o1 != null) { return true; } } } return false; }
java
public static boolean atLeastOneNotNull(final Object... o1s) { if (o1s != null && o1s.length > 0) { for (final Object o1 : o1s) { if (o1 != null) { return true; } } } return false; }
[ "public", "static", "boolean", "atLeastOneNotNull", "(", "final", "Object", "...", "o1s", ")", "{", "if", "(", "o1s", "!=", "null", "&&", "o1s", ".", "length", ">", "0", ")", "{", "for", "(", "final", "Object", "o1", ":", "o1s", ")", "{", "if", "("...
Return true if at least one of the given objects is not null.
[ "Return", "true", "if", "at", "least", "one", "of", "the", "given", "objects", "is", "not", "null", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java#L164-L173
103,876
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
AbstractKitCalculatorsFactory.setHolidays
protected void setHolidays(final String name, final DateCalculator<E> dc) { if (name != null) { dc.setHolidayCalendar(holidays.get(name)); } }
java
protected void setHolidays(final String name, final DateCalculator<E> dc) { if (name != null) { dc.setHolidayCalendar(holidays.get(name)); } }
[ "protected", "void", "setHolidays", "(", "final", "String", "name", ",", "final", "DateCalculator", "<", "E", ">", "dc", ")", "{", "if", "(", "name", "!=", "null", ")", "{", "dc", ".", "setHolidayCalendar", "(", "holidays", ".", "get", "(", "name", ")"...
Used by extensions to set holidays in a DateCalculator. @param name holiday name @param dc the date calculator to configure.
[ "Used", "by", "extensions", "to", "set", "holidays", "in", "a", "DateCalculator", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java#L137-L141
103,877
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
AbstractKitCalculatorsFactory.configureCurrencyCalculatorBuilder
protected CurrencyDateCalculatorBuilder<E> configureCurrencyCalculatorBuilder(final CurrencyDateCalculatorBuilder<E> builder) { return builder// .ccy1Calendar(getHolidayCalendar(builder.getCcy1())) // .ccy1Week(getCurrencyCalculatorConfig().getWorkingWeek(builder.getCcy1())) /...
java
protected CurrencyDateCalculatorBuilder<E> configureCurrencyCalculatorBuilder(final CurrencyDateCalculatorBuilder<E> builder) { return builder// .ccy1Calendar(getHolidayCalendar(builder.getCcy1())) // .ccy1Week(getCurrencyCalculatorConfig().getWorkingWeek(builder.getCcy1())) /...
[ "protected", "CurrencyDateCalculatorBuilder", "<", "E", ">", "configureCurrencyCalculatorBuilder", "(", "final", "CurrencyDateCalculatorBuilder", "<", "E", ">", "builder", ")", "{", "return", "builder", "//\r", ".", "ccy1Calendar", "(", "getHolidayCalendar", "(", "build...
Method that may be called by the specialised factory methods and will fetch the registered holidayCalendar for all 3 currencies and the working weeks via the currencyCalculatorConfig and assigning currencyCalculatorConfig to the builder, using the DefaultCurrencyCalculatorConfig if not modified. @param builder the orig...
[ "Method", "that", "may", "be", "called", "by", "the", "specialised", "factory", "methods", "and", "will", "fetch", "the", "registered", "holidayCalendar", "for", "all", "3", "currencies", "and", "the", "working", "weeks", "via", "the", "currencyCalculatorConfig", ...
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java#L178-L187
103,878
Appendium/objectlabkit
fxcalc/src/main/java/net/objectlab/kit/fxcalc/CrossRateCalculator.java
CrossRateCalculator.calculateCross
public static FxRate calculateCross(final CurrencyPair targetPair, final FxRate fx1, final FxRate fx2, final int precision, final int precisionForInverseFxRate, final MajorCurrencyRanking ranking, final int bidRounding, final int askRounding, CurrencyProvider currencyProvider) { final Op...
java
public static FxRate calculateCross(final CurrencyPair targetPair, final FxRate fx1, final FxRate fx2, final int precision, final int precisionForInverseFxRate, final MajorCurrencyRanking ranking, final int bidRounding, final int askRounding, CurrencyProvider currencyProvider) { final Op...
[ "public", "static", "FxRate", "calculateCross", "(", "final", "CurrencyPair", "targetPair", ",", "final", "FxRate", "fx1", ",", "final", "FxRate", "fx2", ",", "final", "int", "precision", ",", "final", "int", "precisionForInverseFxRate", ",", "final", "MajorCurren...
Calculate the cross rate, use this only if required. @param targetPair the currency pair we want Bid/Ask for @param fx1 one rate involving either targetPair.ccy1 or targetPair.ccy2 @param fx2 one rate involving either targetPair.ccy1 or targetPair.ccy2 @param precision required in case we need to divide rates @param ra...
[ "Calculate", "the", "cross", "rate", "use", "this", "only", "if", "required", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/fxcalc/src/main/java/net/objectlab/kit/fxcalc/CrossRateCalculator.java#L33-L68
103,879
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/Util.java
Util.buildStackTraceString
public static String buildStackTraceString(final Throwable ex) { final StringBuilder context = new StringBuilder(ex.toString()); final StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw, true)); context.append('\n'); context.append(sw.toString()); ...
java
public static String buildStackTraceString(final Throwable ex) { final StringBuilder context = new StringBuilder(ex.toString()); final StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw, true)); context.append('\n'); context.append(sw.toString()); ...
[ "public", "static", "String", "buildStackTraceString", "(", "final", "Throwable", "ex", ")", "{", "final", "StringBuilder", "context", "=", "new", "StringBuilder", "(", "ex", ".", "toString", "(", ")", ")", ";", "final", "StringWriter", "sw", "=", "new", "St...
finds out the stack trace up to where the exception was thrown. @return String that contains the stack trace
[ "finds", "out", "the", "stack", "trace", "up", "to", "where", "the", "exception", "was", "thrown", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/Util.java#L110-L118
103,880
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/Util.java
Util.dumpThreads
public static String dumpThreads() { final StringWriter sout = new StringWriter(); // Capture listing in a // string final PrintWriter out = new PrintWriter(sout); Util.listAllThreads(out); out.flush(); return sout.toString(); }
java
public static String dumpThreads() { final StringWriter sout = new StringWriter(); // Capture listing in a // string final PrintWriter out = new PrintWriter(sout); Util.listAllThreads(out); out.flush(); return sout.toString(); }
[ "public", "static", "String", "dumpThreads", "(", ")", "{", "final", "StringWriter", "sout", "=", "new", "StringWriter", "(", ")", ";", "// Capture listing in a\r", "// string\r", "final", "PrintWriter", "out", "=", "new", "PrintWriter", "(", "sout", ")", ";", ...
Finds information about the threads and dumps them into a String. @return the String containing info about all threads
[ "Finds", "information", "about", "the", "threads", "and", "dumps", "them", "into", "a", "String", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/Util.java#L125-L132
103,881
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/Util.java
Util.listAllThreads
private static void listAllThreads(final PrintWriter out) { final ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup(); ThreadGroup rootThreadGroup = currentThreadGroup; ThreadGroup parent = rootThreadGroup.getParent(); while (parent != null) { root...
java
private static void listAllThreads(final PrintWriter out) { final ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup(); ThreadGroup rootThreadGroup = currentThreadGroup; ThreadGroup parent = rootThreadGroup.getParent(); while (parent != null) { root...
[ "private", "static", "void", "listAllThreads", "(", "final", "PrintWriter", "out", ")", "{", "final", "ThreadGroup", "currentThreadGroup", "=", "Thread", ".", "currentThread", "(", ")", ".", "getThreadGroup", "(", ")", ";", "ThreadGroup", "rootThreadGroup", "=", ...
Find the root thread group and list it recursively
[ "Find", "the", "root", "thread", "group", "and", "list", "it", "recursively" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/Util.java#L135-L147
103,882
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/Util.java
Util.printGroupInfo
private static void printGroupInfo(final PrintWriter out, final ThreadGroup group, final String indent) { if (group == null) { return; } final int numThreads = group.activeCount(); final int numGroups = group.activeGroupCount(); final Thread[] threads = new Th...
java
private static void printGroupInfo(final PrintWriter out, final ThreadGroup group, final String indent) { if (group == null) { return; } final int numThreads = group.activeCount(); final int numGroups = group.activeGroupCount(); final Thread[] threads = new Th...
[ "private", "static", "void", "printGroupInfo", "(", "final", "PrintWriter", "out", ",", "final", "ThreadGroup", "group", ",", "final", "String", "indent", ")", "{", "if", "(", "group", "==", "null", ")", "{", "return", ";", "}", "final", "int", "numThreads...
Display info about a thread group and its threads and groups
[ "Display", "info", "about", "a", "thread", "group", "and", "its", "threads", "and", "groups" ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/Util.java#L150-L170
103,883
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.replaceToken
public static String replaceToken(final String original, final String token, final String replacement) { final StringBuilder tok = new StringBuilder(TOKEN); tok.append(token).append(TOKEN); final String toReplace = replaceCRToken(original); return StringUtil.replace(tok.toString(...
java
public static String replaceToken(final String original, final String token, final String replacement) { final StringBuilder tok = new StringBuilder(TOKEN); tok.append(token).append(TOKEN); final String toReplace = replaceCRToken(original); return StringUtil.replace(tok.toString(...
[ "public", "static", "String", "replaceToken", "(", "final", "String", "original", ",", "final", "String", "token", ",", "final", "String", "replacement", ")", "{", "final", "StringBuilder", "tok", "=", "new", "StringBuilder", "(", "TOKEN", ")", ";", "tok", "...
Replaces the token, surrounded by % within a string with new value. Also replaces any %CR% tokens with the newline character. @return the <code>original</code> string with the <code>%token%</code> (if it exists) replaced with the <code>replacement</code> string. If <code>original</code> or <code>%token%</code> are nul...
[ "Replaces", "the", "token", "surrounded", "by", "%", "within", "a", "string", "with", "new", "value", ".", "Also", "replaces", "any", "%CR%", "tokens", "with", "the", "newline", "character", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L145-L152
103,884
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.replaceCRToken
public static String replaceCRToken(final String original) { String toReplace = original; if (original != null && original.indexOf(NEWLINE_TOKEN) >= 0) { toReplace = StringUtil.replace(NEWLINE_TOKEN, NEW_LINE, original); } return toReplace; }
java
public static String replaceCRToken(final String original) { String toReplace = original; if (original != null && original.indexOf(NEWLINE_TOKEN) >= 0) { toReplace = StringUtil.replace(NEWLINE_TOKEN, NEW_LINE, original); } return toReplace; }
[ "public", "static", "String", "replaceCRToken", "(", "final", "String", "original", ")", "{", "String", "toReplace", "=", "original", ";", "if", "(", "original", "!=", "null", "&&", "original", ".", "indexOf", "(", "NEWLINE_TOKEN", ")", ">=", "0", ")", "{"...
Replaces any %CR% tokens with the newline character. @return the <code>original</code> string with the '%CR%' tokens (if it exists) replaced with the new line character.
[ "Replaces", "any", "%CR%", "tokens", "with", "the", "newline", "character", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L160-L168
103,885
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.wrapText
public static String wrapText(final String inString, final String newline, final int wrapColumn) { if (inString == null) { return null; } final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true); final StringBuilder builder = new StringBuilder()...
java
public static String wrapText(final String inString, final String newline, final int wrapColumn) { if (inString == null) { return null; } final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true); final StringBuilder builder = new StringBuilder()...
[ "public", "static", "String", "wrapText", "(", "final", "String", "inString", ",", "final", "String", "newline", ",", "final", "int", "wrapColumn", ")", "{", "if", "(", "inString", "==", "null", ")", "{", "return", "null", ";", "}", "final", "StringTokeniz...
Takes a block of text which might have long lines in it and wraps the long lines based on the supplied wrapColumn parameter. It was initially implemented for use by VelocityEmail. If there are tabs in inString, you are going to get results that are a bit strange, since tabs are a single character but are displayed as 4...
[ "Takes", "a", "block", "of", "text", "which", "might", "have", "long", "lines", "in", "it", "and", "wraps", "the", "long", "lines", "based", "on", "the", "supplied", "wrapColumn", "parameter", ".", "It", "was", "initially", "implemented", "for", "use", "by...
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L183-L207
103,886
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.singleQuote
public static String singleQuote(final String text) { final StringBuilder b = new StringBuilder((text != null ? text.length() : 0) + 2); b.append(SINGLE_QUOTE); if (text != null) { b.append(text); } b.append(SINGLE_QUOTE); return b.toString(); }
java
public static String singleQuote(final String text) { final StringBuilder b = new StringBuilder((text != null ? text.length() : 0) + 2); b.append(SINGLE_QUOTE); if (text != null) { b.append(text); } b.append(SINGLE_QUOTE); return b.toString(); }
[ "public", "static", "String", "singleQuote", "(", "final", "String", "text", ")", "{", "final", "StringBuilder", "b", "=", "new", "StringBuilder", "(", "(", "text", "!=", "null", "?", "text", ".", "length", "(", ")", ":", "0", ")", "+", "2", ")", ";"...
Add single quotes ' around the text. @param text @return 'text'
[ "Add", "single", "quotes", "around", "the", "text", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L301-L309
103,887
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.allEquals
public static boolean allEquals(final String value, final String... strings) { if (strings != null) { for (final String s : strings) { if (s == null && value != null || s != null && !s.equals(value)) { return false; } } }...
java
public static boolean allEquals(final String value, final String... strings) { if (strings != null) { for (final String s : strings) { if (s == null && value != null || s != null && !s.equals(value)) { return false; } } }...
[ "public", "static", "boolean", "allEquals", "(", "final", "String", "value", ",", "final", "String", "...", "strings", ")", "{", "if", "(", "strings", "!=", "null", ")", "{", "for", "(", "final", "String", "s", ":", "strings", ")", "{", "if", "(", "s...
Return true if all strings are the same.
[ "Return", "true", "if", "all", "strings", "are", "the", "same", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L349-L361
103,888
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.prepareForNumericParsing
public static String prepareForNumericParsing(final String inputStr) { if (inputStr == null) { return EMPTY; } final Matcher matcher = PATTERN_FOR_NUM_PARSING_PREP.matcher(inputStr); return matcher.replaceAll(""); }
java
public static String prepareForNumericParsing(final String inputStr) { if (inputStr == null) { return EMPTY; } final Matcher matcher = PATTERN_FOR_NUM_PARSING_PREP.matcher(inputStr); return matcher.replaceAll(""); }
[ "public", "static", "String", "prepareForNumericParsing", "(", "final", "String", "inputStr", ")", "{", "if", "(", "inputStr", "==", "null", ")", "{", "return", "EMPTY", ";", "}", "final", "Matcher", "matcher", "=", "PATTERN_FOR_NUM_PARSING_PREP", ".", "matcher"...
Remove " and spaces from the input string. @param inputStr @return if null, return empty
[ "Remove", "and", "spaces", "from", "the", "input", "string", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L492-L498
103,889
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.compareTo
public static int compareTo(final String s1, final String s2) { int ret; if (s1 != null && s2 != null) { ret = s1.compareTo(s2); } else if (s1 == null && s2 == null) { ret = 0; } else if (s2 == null) { ret = 1; } else { ret...
java
public static int compareTo(final String s1, final String s2) { int ret; if (s1 != null && s2 != null) { ret = s1.compareTo(s2); } else if (s1 == null && s2 == null) { ret = 0; } else if (s2 == null) { ret = 1; } else { ret...
[ "public", "static", "int", "compareTo", "(", "final", "String", "s1", ",", "final", "String", "s2", ")", "{", "int", "ret", ";", "if", "(", "s1", "!=", "null", "&&", "s2", "!=", "null", ")", "{", "ret", "=", "s1", ".", "compareTo", "(", "s2", ")"...
Handle null.
[ "Handle", "null", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L511-L523
103,890
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.boxify
public static String boxify(final char boxing, final String text) { if (boxing != 0 && StringUtils.isNotBlank(text)) { final StringBuilder b = new StringBuilder(); b.append(NEW_LINE); final String line = StringUtils.repeat(String.valueOf(boxing), text.length() + 4); ...
java
public static String boxify(final char boxing, final String text) { if (boxing != 0 && StringUtils.isNotBlank(text)) { final StringBuilder b = new StringBuilder(); b.append(NEW_LINE); final String line = StringUtils.repeat(String.valueOf(boxing), text.length() + 4); ...
[ "public", "static", "String", "boxify", "(", "final", "char", "boxing", ",", "final", "String", "text", ")", "{", "if", "(", "boxing", "!=", "0", "&&", "StringUtils", ".", "isNotBlank", "(", "text", ")", ")", "{", "final", "StringBuilder", "b", "=", "n...
Returns a String which is surrounded by a box made of boxing char. @param boxing boxing character, eg '+' @param text @return
[ "Returns", "a", "String", "which", "is", "surrounded", "by", "a", "box", "made", "of", "boxing", "char", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L544-L555
103,891
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java
IntegerUtil.assign
public static Integer assign(final Integer value, final Integer defaultValueIfNull) { return value != null ? value : defaultValueIfNull; }
java
public static Integer assign(final Integer value, final Integer defaultValueIfNull) { return value != null ? value : defaultValueIfNull; }
[ "public", "static", "Integer", "assign", "(", "final", "Integer", "value", ",", "final", "Integer", "defaultValueIfNull", ")", "{", "return", "value", "!=", "null", "?", "value", ":", "defaultValueIfNull", ";", "}" ]
Return the value unless it is null, in which case it returns the default value. @param value @param defaultValueIfNull @return
[ "Return", "the", "value", "unless", "it", "is", "null", "in", "which", "case", "it", "returns", "the", "default", "value", "." ]
cd649bce7a32e4e926520e62cb765f3b1d451594
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java#L116-L118
103,892
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/adapter/AdapterUtil.java
AdapterUtil.setInternalComments
public static void setInternalComments(Node node, ParserRuleContext parserRuleContext, AdapterParameters adapterParameters) { BufferedTokenStream tokens = adapterParameters.getTokens(); if (node == null || parserRuleContext == null || tokens == null) { throw new IllegalArgumentException("Pa...
java
public static void setInternalComments(Node node, ParserRuleContext parserRuleContext, AdapterParameters adapterParameters) { BufferedTokenStream tokens = adapterParameters.getTokens(); if (node == null || parserRuleContext == null || tokens == null) { throw new IllegalArgumentException("Pa...
[ "public", "static", "void", "setInternalComments", "(", "Node", "node", ",", "ParserRuleContext", "parserRuleContext", ",", "AdapterParameters", "adapterParameters", ")", "{", "BufferedTokenStream", "tokens", "=", "adapterParameters", ".", "getTokens", "(", ")", ";", ...
If there are no statements within a block, we need a special method to grab any comments that might exist between braces. @param node @param parserRuleContext @param adapterParameters
[ "If", "there", "are", "no", "statements", "within", "a", "block", "we", "need", "a", "special", "method", "to", "grab", "any", "comments", "that", "might", "exist", "between", "braces", "." ]
077160deb44d952c40c442800abd91af7e6fe006
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/adapter/AdapterUtil.java#L283-L329
103,893
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/JavaParser.java
JavaParser.parse
public static CompilationUnit parse(String javaSource) throws IOException, ParseException { ByteArrayInputStream inputStream = new ByteArrayInputStream(javaSource.getBytes("UTF-8")); return parse(inputStream); }
java
public static CompilationUnit parse(String javaSource) throws IOException, ParseException { ByteArrayInputStream inputStream = new ByteArrayInputStream(javaSource.getBytes("UTF-8")); return parse(inputStream); }
[ "public", "static", "CompilationUnit", "parse", "(", "String", "javaSource", ")", "throws", "IOException", ",", "ParseException", "{", "ByteArrayInputStream", "inputStream", "=", "new", "ByteArrayInputStream", "(", "javaSource", ".", "getBytes", "(", "\"UTF-8\"", ")",...
Parses a UTF-8 encoded string as java source. @param javaSource @return @throws IOException @throws ParseException
[ "Parses", "a", "UTF", "-", "8", "encoded", "string", "as", "java", "source", "." ]
077160deb44d952c40c442800abd91af7e6fe006
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/JavaParser.java#L121-L124
103,894
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/api/visitor/CommentFormatter.java
CommentFormatter.format
public String format(Comment comment, int indentLevel, CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null || comment.getContent() == null) { return null; } return format(comment.getContent(), indentLevel, commentLocation); }
java
public String format(Comment comment, int indentLevel, CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null || comment.getContent() == null) { return null; } return format(comment.getContent(), indentLevel, commentLocation); }
[ "public", "String", "format", "(", "Comment", "comment", ",", "int", "indentLevel", ",", "CommentLocation", "commentLocation", ")", "{", "// Return if there's nothing to do", "if", "(", "comment", "==", "null", "||", "comment", ".", "getContent", "(", ")", "==", ...
Format a given comment with the indent level specified. @param comment @param indentLevel @return
[ "Format", "a", "given", "comment", "with", "the", "indent", "level", "specified", "." ]
077160deb44d952c40c442800abd91af7e6fe006
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/api/visitor/CommentFormatter.java#L47-L55
103,895
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/api/visitor/CommentFormatter.java
CommentFormatter.format
public String format(String comment, int indentLevel, CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null) { return null; } final StringBuilder indentString = new StringBuilder(); for (int i = 0; i < indentLevel; i++) { ...
java
public String format(String comment, int indentLevel, CommentLocation commentLocation) { // Return if there's nothing to do if (comment == null) { return null; } final StringBuilder indentString = new StringBuilder(); for (int i = 0; i < indentLevel; i++) { ...
[ "public", "String", "format", "(", "String", "comment", ",", "int", "indentLevel", ",", "CommentLocation", "commentLocation", ")", "{", "// Return if there's nothing to do", "if", "(", "comment", "==", "null", ")", "{", "return", "null", ";", "}", "final", "Stri...
Format a given comment string with the indent level specified. @param comment @param indentLevel @return
[ "Format", "a", "given", "comment", "string", "with", "the", "indent", "level", "specified", "." ]
077160deb44d952c40c442800abd91af7e6fe006
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/api/visitor/CommentFormatter.java#L64-L111
103,896
MoraisIgor/SlidingDrawer
SlidingDrawer/slidingdrawer/src/main/java/hollowsoft/slidingdrawer/SlidingDrawer.java
SlidingDrawer.animateOpen
public void animateOpen() { prepareContent(); if (onDrawerScrollListener != null) { onDrawerScrollListener.onScrollStarted(); } animateOpen(vertical ? viewHandle.getTop() : viewHandle.getLeft()); sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);...
java
public void animateOpen() { prepareContent(); if (onDrawerScrollListener != null) { onDrawerScrollListener.onScrollStarted(); } animateOpen(vertical ? viewHandle.getTop() : viewHandle.getLeft()); sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);...
[ "public", "void", "animateOpen", "(", ")", "{", "prepareContent", "(", ")", ";", "if", "(", "onDrawerScrollListener", "!=", "null", ")", "{", "onDrawerScrollListener", ".", "onScrollStarted", "(", ")", ";", "}", "animateOpen", "(", "vertical", "?", "viewHandle...
Opens the drawer with an animation. @see #animateToggle() @see #animateClose() @see #toggle() @see #open() @see #close()
[ "Opens", "the", "drawer", "with", "an", "animation", "." ]
7c704f354966382fe029855f1322c242f0a61934
https://github.com/MoraisIgor/SlidingDrawer/blob/7c704f354966382fe029855f1322c242f0a61934/SlidingDrawer/slidingdrawer/src/main/java/hollowsoft/slidingdrawer/SlidingDrawer.java#L918-L932
103,897
MoraisIgor/SlidingDrawer
SlidingDrawer/slidingdrawer/src/main/java/hollowsoft/slidingdrawer/SlidingDrawer.java
SlidingDrawer.animateClose
public void animateClose() { prepareContent(); if (onDrawerScrollListener != null) { onDrawerScrollListener.onScrollStarted(); } animateClose(vertical ? viewHandle.getTop() : viewHandle.getLeft()); if (onDrawerScrollListener != null) { onDrawerScrollLis...
java
public void animateClose() { prepareContent(); if (onDrawerScrollListener != null) { onDrawerScrollListener.onScrollStarted(); } animateClose(vertical ? viewHandle.getTop() : viewHandle.getLeft()); if (onDrawerScrollListener != null) { onDrawerScrollLis...
[ "public", "void", "animateClose", "(", ")", "{", "prepareContent", "(", ")", ";", "if", "(", "onDrawerScrollListener", "!=", "null", ")", "{", "onDrawerScrollListener", ".", "onScrollStarted", "(", ")", ";", "}", "animateClose", "(", "vertical", "?", "viewHand...
Closes the drawer with an animation. @see #animateToggle() @see #animateOpen() @see #toggle() @see #open() @see #close()
[ "Closes", "the", "drawer", "with", "an", "animation", "." ]
7c704f354966382fe029855f1322c242f0a61934
https://github.com/MoraisIgor/SlidingDrawer/blob/7c704f354966382fe029855f1322c242f0a61934/SlidingDrawer/slidingdrawer/src/main/java/hollowsoft/slidingdrawer/SlidingDrawer.java#L943-L955
103,898
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/ManifestBuilder.java
ManifestBuilder.builder
public static ManifestBuilder builder(ClassLoader classLoader, KnowledgeComponentImplementationModel implementationModel) { ManifestModel manifestModel = implementationModel != null ? implementationModel.getManifest() : null; return new ManifestBuilder(classLoader, manifestModel); }
java
public static ManifestBuilder builder(ClassLoader classLoader, KnowledgeComponentImplementationModel implementationModel) { ManifestModel manifestModel = implementationModel != null ? implementationModel.getManifest() : null; return new ManifestBuilder(classLoader, manifestModel); }
[ "public", "static", "ManifestBuilder", "builder", "(", "ClassLoader", "classLoader", ",", "KnowledgeComponentImplementationModel", "implementationModel", ")", "{", "ManifestModel", "manifestModel", "=", "implementationModel", "!=", "null", "?", "implementationModel", ".", "...
Creates a ManifestBuilder. @param classLoader classLoader @param implementationModel implementationModel @return a ManifestBuilder
[ "Creates", "a", "ManifestBuilder", "." ]
ca5c012bf867ea15d1250f0991af3cd7e708aaaf
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/ManifestBuilder.java#L74-L77
103,899
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java
KnowledgeOperations.registerOperations
public static void registerOperations(KnowledgeComponentImplementationModel model, Map<String, KnowledgeOperation> operations, KnowledgeOperation defaultOperation) { OperationsModel operationsModel = model.getOperations(); if (operationsModel != null) { for (OperationModel operationModel : o...
java
public static void registerOperations(KnowledgeComponentImplementationModel model, Map<String, KnowledgeOperation> operations, KnowledgeOperation defaultOperation) { OperationsModel operationsModel = model.getOperations(); if (operationsModel != null) { for (OperationModel operationModel : o...
[ "public", "static", "void", "registerOperations", "(", "KnowledgeComponentImplementationModel", "model", ",", "Map", "<", "String", ",", "KnowledgeOperation", ">", "operations", ",", "KnowledgeOperation", "defaultOperation", ")", "{", "OperationsModel", "operationsModel", ...
Registers operations. @param model the model @param operations the operations @param defaultOperation the default operation
[ "Registers", "operations", "." ]
ca5c012bf867ea15d1250f0991af3cd7e708aaaf
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java#L67-L94