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
28,200
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/log/LogRequestor.java
LogRequestor.fetchLogs
public void fetchLogs() { try { callback.open(); this.request = getLogRequest(false); final HttpResponse response = client.execute(request); parseResponse(response); } catch (LogCallback.DoneException e) { // Signifies we're finished with the l...
java
public void fetchLogs() { try { callback.open(); this.request = getLogRequest(false); final HttpResponse response = client.execute(request); parseResponse(response); } catch (LogCallback.DoneException e) { // Signifies we're finished with the l...
[ "public", "void", "fetchLogs", "(", ")", "{", "try", "{", "callback", ".", "open", "(", ")", ";", "this", ".", "request", "=", "getLogRequest", "(", "false", ")", ";", "final", "HttpResponse", "response", "=", "client", ".", "execute", "(", "request", ...
Get logs and feed a callback with the content
[ "Get", "logs", "and", "feed", "a", "callback", "with", "the", "content" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/log/LogRequestor.java#L82-L95
28,201
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/log/LogRequestor.java
LogRequestor.run
public void run() { try { callback.open(); this.request = getLogRequest(true); final HttpResponse response = client.execute(request); parseResponse(response); } catch (LogCallback.DoneException e) { // Signifies we're finished with the log stre...
java
public void run() { try { callback.open(); this.request = getLogRequest(true); final HttpResponse response = client.execute(request); parseResponse(response); } catch (LogCallback.DoneException e) { // Signifies we're finished with the log stre...
[ "public", "void", "run", "(", ")", "{", "try", "{", "callback", ".", "open", "(", ")", ";", "this", ".", "request", "=", "getLogRequest", "(", "true", ")", ";", "final", "HttpResponse", "response", "=", "client", ".", "execute", "(", "request", ")", ...
Fetch log asynchronously as stream and follow stream
[ "Fetch", "log", "asynchronously", "as", "stream", "and", "follow", "stream" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/log/LogRequestor.java#L98-L111
28,202
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/assembly/DockerAssemblyConfigurationSource.java
DockerAssemblyConfigurationSource.mainProjectInterpolator
private FixedStringSearchInterpolator mainProjectInterpolator(MavenProject mainProject) { if (mainProject != null) { // 5 return FixedStringSearchInterpolator.create( new org.codehaus.plexus.interpolation.fixed.PrefixedObjectValueSource( Interpolat...
java
private FixedStringSearchInterpolator mainProjectInterpolator(MavenProject mainProject) { if (mainProject != null) { // 5 return FixedStringSearchInterpolator.create( new org.codehaus.plexus.interpolation.fixed.PrefixedObjectValueSource( Interpolat...
[ "private", "FixedStringSearchInterpolator", "mainProjectInterpolator", "(", "MavenProject", "mainProject", ")", "{", "if", "(", "mainProject", "!=", "null", ")", "{", "// 5", "return", "FixedStringSearchInterpolator", ".", "create", "(", "new", "org", ".", "codehaus",...
Taken from AbstractAssemblyMojo
[ "Taken", "from", "AbstractAssemblyMojo" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/assembly/DockerAssemblyConfigurationSource.java#L280-L295
28,203
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/NamePatternUtil.java
NamePatternUtil.convertImageNamePattern
public static String convertImageNamePattern(String pattern) { final String REGEX_PREFIX = "%regex[", ANT_PREFIX = "%ant[", PATTERN_SUFFIX="]"; if(pattern.startsWith(REGEX_PREFIX) && pattern.endsWith(PATTERN_SUFFIX)) { return pattern.substring(REGEX_PREFIX.length(), pattern.length() - PATTE...
java
public static String convertImageNamePattern(String pattern) { final String REGEX_PREFIX = "%regex[", ANT_PREFIX = "%ant[", PATTERN_SUFFIX="]"; if(pattern.startsWith(REGEX_PREFIX) && pattern.endsWith(PATTERN_SUFFIX)) { return pattern.substring(REGEX_PREFIX.length(), pattern.length() - PATTE...
[ "public", "static", "String", "convertImageNamePattern", "(", "String", "pattern", ")", "{", "final", "String", "REGEX_PREFIX", "=", "\"%regex[\"", ",", "ANT_PREFIX", "=", "\"%ant[\"", ",", "PATTERN_SUFFIX", "=", "\"]\"", ";", "if", "(", "pattern", ".", "startsW...
Accepts an Ant-ish or regular expression pattern and compiles to a regular expression. This is similar to SelectorUtils in the Maven codebase, but there the code uses the platform File.separator, while here we always want to work with forward slashes. Also, for a more natural fit with repository tags, both * and ** sh...
[ "Accepts", "an", "Ant", "-", "ish", "or", "regular", "expression", "pattern", "and", "compiles", "to", "a", "regular", "expression", "." ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/NamePatternUtil.java#L29-L69
28,204
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/ecr/AwsSigner4.java
AwsSigner4.sign
void sign(HttpRequest request, AuthConfig credentials, Date signingTime) { AwsSigner4Request sr = new AwsSigner4Request(region, service, request, signingTime); if(!request.containsHeader("X-Amz-Date")) { request.addHeader("X-Amz-Date", sr.getSigningDateTime()); } request.addH...
java
void sign(HttpRequest request, AuthConfig credentials, Date signingTime) { AwsSigner4Request sr = new AwsSigner4Request(region, service, request, signingTime); if(!request.containsHeader("X-Amz-Date")) { request.addHeader("X-Amz-Date", sr.getSigningDateTime()); } request.addH...
[ "void", "sign", "(", "HttpRequest", "request", ",", "AuthConfig", "credentials", ",", "Date", "signingTime", ")", "{", "AwsSigner4Request", "sr", "=", "new", "AwsSigner4Request", "(", "region", ",", "service", ",", "request", ",", "signingTime", ")", ";", "if"...
Sign a request. Add the headers that authenticate the request. @param request The request to sign. @param credentials The credentials to use when signing. @param signingTime The invocation time to use;
[ "Sign", "a", "request", ".", "Add", "the", "headers", "that", "authenticate", "the", "request", "." ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/ecr/AwsSigner4.java#L55-L65
28,205
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/config/handler/property/PropertyConfigHandler.java
PropertyConfigHandler.buildConfigured
private boolean buildConfigured(BuildImageConfiguration config, ValueProvider valueProvider, MavenProject project) { if (isStringValueNull(valueProvider, config, FROM, () -> config.getFrom())) { return true; } if (valueProvider.getMap(FROM_EXT, config == null ? null : config.getFr...
java
private boolean buildConfigured(BuildImageConfiguration config, ValueProvider valueProvider, MavenProject project) { if (isStringValueNull(valueProvider, config, FROM, () -> config.getFrom())) { return true; } if (valueProvider.getMap(FROM_EXT, config == null ? null : config.getFr...
[ "private", "boolean", "buildConfigured", "(", "BuildImageConfiguration", "config", ",", "ValueProvider", "valueProvider", ",", "MavenProject", "project", ")", "{", "if", "(", "isStringValueNull", "(", "valueProvider", ",", "config", ",", "FROM", ",", "(", ")", "->...
Enable build config only when a `.from.`, `.dockerFile.`, or `.dockerFileDir.` is configured
[ "Enable", "build", "config", "only", "when", "a", ".", "from", ".", ".", "dockerFile", ".", "or", ".", "dockerFileDir", ".", "is", "configured" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/config/handler/property/PropertyConfigHandler.java#L96-L123
28,206
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/config/handler/property/PropertyConfigHandler.java
PropertyConfigHandler.extractPortValues
private List<String> extractPortValues(List<String> config, ValueProvider valueProvider) { List<String> ret = new ArrayList<>(); List<String> ports = valueProvider.getList(PORTS, config); if (ports == null) { return null; } List<String[]> parsedPorts = EnvUtil.splitOn...
java
private List<String> extractPortValues(List<String> config, ValueProvider valueProvider) { List<String> ret = new ArrayList<>(); List<String> ports = valueProvider.getList(PORTS, config); if (ports == null) { return null; } List<String[]> parsedPorts = EnvUtil.splitOn...
[ "private", "List", "<", "String", ">", "extractPortValues", "(", "List", "<", "String", ">", "config", ",", "ValueProvider", "valueProvider", ")", "{", "List", "<", "String", ">", "ret", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "String"...
Extract only the values of the port mapping
[ "Extract", "only", "the", "values", "of", "the", "port", "mapping" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/config/handler/property/PropertyConfigHandler.java#L265-L276
28,207
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/BuildMojo.java
BuildMojo.processImageConfig
private void processImageConfig(ServiceHub hub, ImageConfiguration aImageConfig) throws IOException, MojoExecutionException { BuildImageConfiguration buildConfig = aImageConfig.getBuildConfiguration(); if (buildConfig != null) { if(buildConfig.skip()) { log.info("%s : Skippe...
java
private void processImageConfig(ServiceHub hub, ImageConfiguration aImageConfig) throws IOException, MojoExecutionException { BuildImageConfiguration buildConfig = aImageConfig.getBuildConfiguration(); if (buildConfig != null) { if(buildConfig.skip()) { log.info("%s : Skippe...
[ "private", "void", "processImageConfig", "(", "ServiceHub", "hub", ",", "ImageConfiguration", "aImageConfig", ")", "throws", "IOException", ",", "MojoExecutionException", "{", "BuildImageConfiguration", "buildConfig", "=", "aImageConfig", ".", "getBuildConfiguration", "(", ...
Helper method to process an ImageConfiguration. @param hub ServiceHub @param aImageConfig ImageConfiguration that would be forwarded to build and tag @throws DockerAccessException @throws MojoExecutionException
[ "Helper", "method", "to", "process", "an", "ImageConfiguration", "." ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/BuildMojo.java#L98-L108
28,208
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/UrlBuilder.java
UrlBuilder.u
private Builder u(String format, String ... args) { return new Builder(createUrl(String.format(format, (Object[]) encodeArgs(args)))); }
java
private Builder u(String format, String ... args) { return new Builder(createUrl(String.format(format, (Object[]) encodeArgs(args)))); }
[ "private", "Builder", "u", "(", "String", "format", ",", "String", "...", "args", ")", "{", "return", "new", "Builder", "(", "createUrl", "(", "String", ".", "format", "(", "format", ",", "(", "Object", "[", "]", ")", "encodeArgs", "(", "args", ")", ...
Entry point for builder
[ "Entry", "point", "for", "builder" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/UrlBuilder.java#L199-L201
28,209
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/ImageName.java
ImageName.getSimpleName
public String getSimpleName() { String prefix = user + "/"; return repository.startsWith(prefix) ? repository.substring(prefix.length()) : repository; }
java
public String getSimpleName() { String prefix = user + "/"; return repository.startsWith(prefix) ? repository.substring(prefix.length()) : repository; }
[ "public", "String", "getSimpleName", "(", ")", "{", "String", "prefix", "=", "user", "+", "\"/\"", ";", "return", "repository", ".", "startsWith", "(", "prefix", ")", "?", "repository", ".", "substring", "(", "prefix", ".", "length", "(", ")", ")", ":", ...
Get the simple name of the image, which is the repository sans the user parts. @return simple name of the image
[ "Get", "the", "simple", "name", "of", "the", "image", "which", "is", "the", "repository", "sans", "the", "user", "parts", "." ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/ImageName.java#L210-L213
28,210
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/ImageName.java
ImageName.doValidate
private void doValidate() { List<String> errors = new ArrayList<>(); // Strip off user from repository name String image = user != null ? repository.substring(user.length() + 1) : repository; Object[] checks = new Object[] { "registry", DOMAIN_REGEXP, registry, "i...
java
private void doValidate() { List<String> errors = new ArrayList<>(); // Strip off user from repository name String image = user != null ? repository.substring(user.length() + 1) : repository; Object[] checks = new Object[] { "registry", DOMAIN_REGEXP, registry, "i...
[ "private", "void", "doValidate", "(", ")", "{", "List", "<", "String", ">", "errors", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Strip off user from repository name", "String", "image", "=", "user", "!=", "null", "?", "repository", ".", "substring", "...
Validate parts and throw an IllegalArgumentException if a part is not valid
[ "Validate", "parts", "and", "throw", "an", "IllegalArgumentException", "if", "a", "part", "is", "not", "valid" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/ImageName.java#L227-L256
28,211
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/ImageArchiveUtil.java
ImageArchiveUtil.findEntryByRepoTag
public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest) { if(repoTag == null || manifest == null) { return null; } for(ImageArchiveManifestEntry entry : manifest.getEntries()) { for(String entryRepoTag : entry.getRepoTags...
java
public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest) { if(repoTag == null || manifest == null) { return null; } for(ImageArchiveManifestEntry entry : manifest.getEntries()) { for(String entryRepoTag : entry.getRepoTags...
[ "public", "static", "ImageArchiveManifestEntry", "findEntryByRepoTag", "(", "String", "repoTag", ",", "ImageArchiveManifest", "manifest", ")", "{", "if", "(", "repoTag", "==", "null", "||", "manifest", "==", "null", ")", "{", "return", "null", ";", "}", "for", ...
Search the manifest for an entry that has the repository and tag provided. @param repoTag the repository and tag to search (e.g. busybox:latest). @param manifest the manifest to be searched @return the entry found, or null if no match.
[ "Search", "the", "manifest", "for", "an", "entry", "that", "has", "the", "repository", "and", "tag", "provided", "." ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/ImageArchiveUtil.java#L124-L138
28,212
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/ImageArchiveUtil.java
ImageArchiveUtil.mapEntriesById
public static Map<String, ImageArchiveManifestEntry> mapEntriesById(Iterable<ImageArchiveManifestEntry> entries) { Map<String, ImageArchiveManifestEntry> mapped = new LinkedHashMap<>(); for(ImageArchiveManifestEntry entry : entries) { mapped.put(entry.getId(), entry); } ret...
java
public static Map<String, ImageArchiveManifestEntry> mapEntriesById(Iterable<ImageArchiveManifestEntry> entries) { Map<String, ImageArchiveManifestEntry> mapped = new LinkedHashMap<>(); for(ImageArchiveManifestEntry entry : entries) { mapped.put(entry.getId(), entry); } ret...
[ "public", "static", "Map", "<", "String", ",", "ImageArchiveManifestEntry", ">", "mapEntriesById", "(", "Iterable", "<", "ImageArchiveManifestEntry", ">", "entries", ")", "{", "Map", "<", "String", ",", "ImageArchiveManifestEntry", ">", "mapped", "=", "new", "Link...
Build a map of entries by id from an iterable of entries. @param entries @return a map of entries by id
[ "Build", "a", "map", "of", "entries", "by", "id", "from", "an", "iterable", "of", "entries", "." ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/ImageArchiveUtil.java#L220-L228
28,213
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/StartMojo.java
StartMojo.hasBeenAllImagesStarted
private boolean hasBeenAllImagesStarted(Queue<ImageConfiguration> imagesWaitingToStart, Queue<ImageConfiguration> imagesStarting) { return imagesWaitingToStart.isEmpty() && imagesStarting.isEmpty(); }
java
private boolean hasBeenAllImagesStarted(Queue<ImageConfiguration> imagesWaitingToStart, Queue<ImageConfiguration> imagesStarting) { return imagesWaitingToStart.isEmpty() && imagesStarting.isEmpty(); }
[ "private", "boolean", "hasBeenAllImagesStarted", "(", "Queue", "<", "ImageConfiguration", ">", "imagesWaitingToStart", ",", "Queue", "<", "ImageConfiguration", ">", "imagesStarting", ")", "{", "return", "imagesWaitingToStart", ".", "isEmpty", "(", ")", "&&", "imagesSt...
Check if we are done
[ "Check", "if", "we", "are", "done" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/StartMojo.java#L229-L231
28,214
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/StartMojo.java
StartMojo.getImagesWhoseDependenciesHasStarted
private List<ImageConfiguration> getImagesWhoseDependenciesHasStarted(Queue<ImageConfiguration> imagesRemaining, Set<String> containersStarted, Set<String> aliases) { ...
java
private List<ImageConfiguration> getImagesWhoseDependenciesHasStarted(Queue<ImageConfiguration> imagesRemaining, Set<String> containersStarted, Set<String> aliases) { ...
[ "private", "List", "<", "ImageConfiguration", ">", "getImagesWhoseDependenciesHasStarted", "(", "Queue", "<", "ImageConfiguration", ">", "imagesRemaining", ",", "Set", "<", "String", ">", "containersStarted", ",", "Set", "<", "String", ">", "aliases", ")", "{", "f...
Pick out all images who can be started right now because all their dependencies has been started
[ "Pick", "out", "all", "images", "who", "can", "be", "started", "right", "now", "because", "all", "their", "dependencies", "has", "been", "started" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/StartMojo.java#L311-L325
28,215
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/StartMojo.java
StartMojo.prepareStart
private Queue<ImageConfiguration> prepareStart(ServiceHub hub, QueryService queryService, RunService runService, Set<String> imageAliases) throws DockerAccessException, MojoExecutionException { final Queue<ImageConfiguration> imagesWaitingToStart = new ArrayDeque<>(); for (StartOrderResolver.Res...
java
private Queue<ImageConfiguration> prepareStart(ServiceHub hub, QueryService queryService, RunService runService, Set<String> imageAliases) throws DockerAccessException, MojoExecutionException { final Queue<ImageConfiguration> imagesWaitingToStart = new ArrayDeque<>(); for (StartOrderResolver.Res...
[ "private", "Queue", "<", "ImageConfiguration", ">", "prepareStart", "(", "ServiceHub", "hub", ",", "QueryService", "queryService", ",", "RunService", "runService", ",", "Set", "<", "String", ">", "imageAliases", ")", "throws", "DockerAccessException", ",", "MojoExec...
to start in the correct order
[ "to", "start", "in", "the", "correct", "order" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/StartMojo.java#L329-L358
28,216
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/DockerFileUtil.java
DockerFileUtil.extractLines
public static List<String[]> extractLines(File dockerFile, String keyword, FixedStringSearchInterpolator interpolator) throws IOException { List<String[]> ret = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(dockerFile))) { String line; while ((...
java
public static List<String[]> extractLines(File dockerFile, String keyword, FixedStringSearchInterpolator interpolator) throws IOException { List<String[]> ret = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(dockerFile))) { String line; while ((...
[ "public", "static", "List", "<", "String", "[", "]", ">", "extractLines", "(", "File", "dockerFile", ",", "String", "keyword", ",", "FixedStringSearchInterpolator", "interpolator", ")", "throws", "IOException", "{", "List", "<", "String", "[", "]", ">", "ret",...
Extract all lines containing the given keyword @param dockerFile dockerfile to examine @param keyword keyword to extract the lines for @param interpolator interpolator for replacing properties @return list of matched lines or an empty list
[ "Extract", "all", "lines", "containing", "the", "given", "keyword" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/DockerFileUtil.java#L72-L85
28,217
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/DockerFileUtil.java
DockerFileUtil.interpolate
public static String interpolate(File dockerFile, FixedStringSearchInterpolator interpolator) throws IOException { StringBuilder ret = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new FileReader(dockerFile))) { String line; while ((line = reader.readLine()...
java
public static String interpolate(File dockerFile, FixedStringSearchInterpolator interpolator) throws IOException { StringBuilder ret = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new FileReader(dockerFile))) { String line; while ((line = reader.readLine()...
[ "public", "static", "String", "interpolate", "(", "File", "dockerFile", ",", "FixedStringSearchInterpolator", "interpolator", ")", "throws", "IOException", "{", "StringBuilder", "ret", "=", "new", "StringBuilder", "(", ")", ";", "try", "(", "BufferedReader", "reader...
Interpolate a docker file with the given properties and filter @param dockerFile docker file to interpolate @param interpolator interpolator for replacing properties @return The interpolated contents of the file. @throws IOException
[ "Interpolate", "a", "docker", "file", "with", "the", "given", "properties", "and", "filter" ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/DockerFileUtil.java#L95-L104
28,218
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/DockerFileUtil.java
DockerFileUtil.createInterpolator
public static FixedStringSearchInterpolator createInterpolator(MojoParameters params, String filter) { String[] delimiters = extractDelimiters(filter); if (delimiters == null) { // Don't interpolate anything return FixedStringSearchInterpolator.create(); } Docker...
java
public static FixedStringSearchInterpolator createInterpolator(MojoParameters params, String filter) { String[] delimiters = extractDelimiters(filter); if (delimiters == null) { // Don't interpolate anything return FixedStringSearchInterpolator.create(); } Docker...
[ "public", "static", "FixedStringSearchInterpolator", "createInterpolator", "(", "MojoParameters", "params", ",", "String", "filter", ")", "{", "String", "[", "]", "delimiters", "=", "extractDelimiters", "(", "filter", ")", ";", "if", "(", "delimiters", "==", "null...
Create an interpolator for the given maven parameters and filter configuration. @param params The maven parameters. @param filter The filter configuration. @return An interpolator for replacing maven properties.
[ "Create", "an", "interpolator", "for", "the", "given", "maven", "parameters", "and", "filter", "configuration", "." ]
70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/DockerFileUtil.java#L113-L127
28,219
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
FieldScopeLogicMap.with
public FieldScopeLogicMap<V> with(FieldScopeLogic fieldScopeLogic, V value) { ImmutableList.Builder<Entry<V>> newEntries = ImmutableList.builder(); // Earlier entries override later ones, so we insert the new one at the front of the list. newEntries.add(Entry.of(fieldScopeLogic, value)); newEntries.addA...
java
public FieldScopeLogicMap<V> with(FieldScopeLogic fieldScopeLogic, V value) { ImmutableList.Builder<Entry<V>> newEntries = ImmutableList.builder(); // Earlier entries override later ones, so we insert the new one at the front of the list. newEntries.add(Entry.of(fieldScopeLogic, value)); newEntries.addA...
[ "public", "FieldScopeLogicMap", "<", "V", ">", "with", "(", "FieldScopeLogic", "fieldScopeLogic", ",", "V", "value", ")", "{", "ImmutableList", ".", "Builder", "<", "Entry", "<", "V", ">>", "newEntries", "=", "ImmutableList", ".", "builder", "(", ")", ";", ...
Returns a new immutable map that adds the given fields -> value mapping.
[ "Returns", "a", "new", "immutable", "map", "that", "adds", "the", "given", "fields", "-", ">", "value", "mapping", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java#L76-L82
28,220
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
FieldScopeLogicMap.defaultValue
public static <V> FieldScopeLogicMap<V> defaultValue(V value) { return new FieldScopeLogicMap<>(ImmutableList.of(Entry.of(FieldScopeLogic.all(), value))); }
java
public static <V> FieldScopeLogicMap<V> defaultValue(V value) { return new FieldScopeLogicMap<>(ImmutableList.of(Entry.of(FieldScopeLogic.all(), value))); }
[ "public", "static", "<", "V", ">", "FieldScopeLogicMap", "<", "V", ">", "defaultValue", "(", "V", "value", ")", "{", "return", "new", "FieldScopeLogicMap", "<>", "(", "ImmutableList", ".", "of", "(", "Entry", ".", "of", "(", "FieldScopeLogic", ".", "all", ...
Returns a map which maps all fields to the given value by default.
[ "Returns", "a", "map", "which", "maps", "all", "fields", "to", "the", "given", "value", "by", "default", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java#L112-L114
28,221
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
FieldScopeUtil.fieldNumbersFunction
static Function<Optional<Descriptor>, String> fieldNumbersFunction( final String fmt, final Iterable<Integer> fieldNumbers) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> optDescriptor) { return resolveFieldNumbers(optDescriptor, ...
java
static Function<Optional<Descriptor>, String> fieldNumbersFunction( final String fmt, final Iterable<Integer> fieldNumbers) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> optDescriptor) { return resolveFieldNumbers(optDescriptor, ...
[ "static", "Function", "<", "Optional", "<", "Descriptor", ">", ",", "String", ">", "fieldNumbersFunction", "(", "final", "String", "fmt", ",", "final", "Iterable", "<", "Integer", ">", "fieldNumbers", ")", "{", "return", "new", "Function", "<", "Optional", "...
Returns a function which translates integer field numbers into field names using the Descriptor if available. @param fmt Format string that must contain exactly one '%s' and no other format parameters.
[ "Returns", "a", "function", "which", "translates", "integer", "field", "numbers", "into", "field", "names", "using", "the", "Descriptor", "if", "available", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java#L36-L44
28,222
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
FieldScopeUtil.fieldScopeFunction
static Function<Optional<Descriptor>, String> fieldScopeFunction( final String fmt, final FieldScope fieldScope) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> optDescriptor) { return String.format(fmt, fieldScope.usingCorresponde...
java
static Function<Optional<Descriptor>, String> fieldScopeFunction( final String fmt, final FieldScope fieldScope) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> optDescriptor) { return String.format(fmt, fieldScope.usingCorresponde...
[ "static", "Function", "<", "Optional", "<", "Descriptor", ">", ",", "String", ">", "fieldScopeFunction", "(", "final", "String", "fmt", ",", "final", "FieldScope", "fieldScope", ")", "{", "return", "new", "Function", "<", "Optional", "<", "Descriptor", ">", ...
Returns a function which formats the given string by getting the usingCorrespondenceString from the given FieldScope with the argument descriptor. @param fmt Format string that must contain exactly one '%s' and no other format parameters.
[ "Returns", "a", "function", "which", "formats", "the", "given", "string", "by", "getting", "the", "usingCorrespondenceString", "from", "the", "given", "FieldScope", "with", "the", "argument", "descriptor", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java#L52-L60
28,223
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
FieldScopeUtil.concat
static Function<Optional<Descriptor>, String> concat( final Function<? super Optional<Descriptor>, String> function1, final Function<? super Optional<Descriptor>, String> function2) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> opt...
java
static Function<Optional<Descriptor>, String> concat( final Function<? super Optional<Descriptor>, String> function1, final Function<? super Optional<Descriptor>, String> function2) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> opt...
[ "static", "Function", "<", "Optional", "<", "Descriptor", ">", ",", "String", ">", "concat", "(", "final", "Function", "<", "?", "super", "Optional", "<", "Descriptor", ">", ",", "String", ">", "function1", ",", "final", "Function", "<", "?", "super", "O...
Returns a function which concatenates the outputs of the two input functions.
[ "Returns", "a", "function", "which", "concatenates", "the", "outputs", "of", "the", "two", "input", "functions", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java#L63-L72
28,224
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
FieldScopeUtil.getSingleDescriptor
static Optional<Descriptor> getSingleDescriptor(Iterable<? extends Message> messages) { Optional<Descriptor> optDescriptor = Optional.absent(); for (Message message : messages) { if (message != null) { Descriptor descriptor = message.getDescriptorForType(); if (!optDescriptor.isPresent()) ...
java
static Optional<Descriptor> getSingleDescriptor(Iterable<? extends Message> messages) { Optional<Descriptor> optDescriptor = Optional.absent(); for (Message message : messages) { if (message != null) { Descriptor descriptor = message.getDescriptorForType(); if (!optDescriptor.isPresent()) ...
[ "static", "Optional", "<", "Descriptor", ">", "getSingleDescriptor", "(", "Iterable", "<", "?", "extends", "Message", ">", "messages", ")", "{", "Optional", "<", "Descriptor", ">", "optDescriptor", "=", "Optional", ".", "absent", "(", ")", ";", "for", "(", ...
Returns the singular descriptor used by all non-null messages in the list. <p>If there is no descriptor, or more than one, returns {@code Optional.absent()}.
[ "Returns", "the", "singular", "descriptor", "used", "by", "all", "non", "-", "null", "messages", "in", "the", "list", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java#L79-L93
28,225
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
MultimapSubject.containsExactly
@CanIgnoreReturnValue public Ordered containsExactly() { return check().about(iterableEntries()).that(actual().entries()).containsExactly(); }
java
@CanIgnoreReturnValue public Ordered containsExactly() { return check().about(iterableEntries()).that(actual().entries()).containsExactly(); }
[ "@", "CanIgnoreReturnValue", "public", "Ordered", "containsExactly", "(", ")", "{", "return", "check", "(", ")", ".", "about", "(", "iterableEntries", "(", ")", ")", ".", "that", "(", "actual", "(", ")", ".", "entries", "(", ")", ")", ".", "containsExact...
Fails if the multimap is not empty.
[ "Fails", "if", "the", "multimap", "is", "not", "empty", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MultimapSubject.java#L285-L288
28,226
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
MultimapSubject.advanceToFind
private static boolean advanceToFind(Iterator<?> iterator, Object value) { while (iterator.hasNext()) { if (Objects.equal(iterator.next(), value)) { return true; } } return false; }
java
private static boolean advanceToFind(Iterator<?> iterator, Object value) { while (iterator.hasNext()) { if (Objects.equal(iterator.next(), value)) { return true; } } return false; }
[ "private", "static", "boolean", "advanceToFind", "(", "Iterator", "<", "?", ">", "iterator", ",", "Object", "value", ")", "{", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "if", "(", "Objects", ".", "equal", "(", "iterator", ".", "next...
Advances the iterator until it either returns value, or has no more elements. <p>Returns true if the value was found, false if the end was reached before finding it. <p>This is basically the same as {@link Iterables#contains}, but where the contract explicitly states that the iterator isn't advanced beyond the value ...
[ "Advances", "the", "iterator", "until", "it", "either", "returns", "value", "or", "has", "no", "more", "elements", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MultimapSubject.java#L425-L432
28,227
google/truth
core/src/main/java/com/google/common/truth/TruthFailureSubject.java
TruthFailureSubject.factKeys
public IterableSubject factKeys() { if (!(actual() instanceof ErrorWithFacts)) { failWithActual(simpleFact("expected a failure thrown by Truth's new failure API")); return ignoreCheck().that(ImmutableList.of()); } ErrorWithFacts error = (ErrorWithFacts) actual(); return check("factKeys()").t...
java
public IterableSubject factKeys() { if (!(actual() instanceof ErrorWithFacts)) { failWithActual(simpleFact("expected a failure thrown by Truth's new failure API")); return ignoreCheck().that(ImmutableList.of()); } ErrorWithFacts error = (ErrorWithFacts) actual(); return check("factKeys()").t...
[ "public", "IterableSubject", "factKeys", "(", ")", "{", "if", "(", "!", "(", "actual", "(", ")", "instanceof", "ErrorWithFacts", ")", ")", "{", "failWithActual", "(", "simpleFact", "(", "\"expected a failure thrown by Truth's new failure API\"", ")", ")", ";", "re...
Returns a subject for the list of fact keys.
[ "Returns", "a", "subject", "for", "the", "list", "of", "fact", "keys", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/TruthFailureSubject.java#L77-L84
28,228
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java
MapWithProtoValuesSubject.usingFloatToleranceForFieldDescriptorsForValues
public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues( float tolerance, FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { return usingConfig( config.usingFloatToleranceForFieldDescriptors( tolerance, asList(firstFieldDescriptor, rest)));...
java
public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues( float tolerance, FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { return usingConfig( config.usingFloatToleranceForFieldDescriptors( tolerance, asList(firstFieldDescriptor, rest)));...
[ "public", "MapWithProtoValuesFluentAssertion", "<", "M", ">", "usingFloatToleranceForFieldDescriptorsForValues", "(", "float", "tolerance", ",", "FieldDescriptor", "firstFieldDescriptor", ",", "FieldDescriptor", "...", "rest", ")", "{", "return", "usingConfig", "(", "config...
Compares float fields with these explicitly specified fields using the provided absolute tolerance. @param tolerance A finite, non-negative tolerance.
[ "Compares", "float", "fields", "with", "these", "explicitly", "specified", "fields", "using", "the", "provided", "absolute", "tolerance", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L596-L601
28,229
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
FieldScopeLogic.ignoringFields
FieldScopeLogic ignoringFields(Iterable<Integer> fieldNumbers) { if (isEmpty(fieldNumbers)) { return this; } return and( this, new NegationFieldScopeLogic(new FieldNumbersLogic(fieldNumbers, /* isRecursive = */ true))); }
java
FieldScopeLogic ignoringFields(Iterable<Integer> fieldNumbers) { if (isEmpty(fieldNumbers)) { return this; } return and( this, new NegationFieldScopeLogic(new FieldNumbersLogic(fieldNumbers, /* isRecursive = */ true))); }
[ "FieldScopeLogic", "ignoringFields", "(", "Iterable", "<", "Integer", ">", "fieldNumbers", ")", "{", "if", "(", "isEmpty", "(", "fieldNumbers", ")", ")", "{", "return", "this", ";", "}", "return", "and", "(", "this", ",", "new", "NegationFieldScopeLogic", "(...
something else that doesn't tightly couple FieldScopeLogic to the 'ignore' concept.
[ "something", "else", "that", "doesn", "t", "tightly", "couple", "FieldScopeLogic", "to", "the", "ignore", "concept", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java#L116-L123
28,230
google/truth
extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java
IntStreamSubject.containsAnyOf
@SuppressWarnings("GoodTime") // false positive; b/122617528 public void containsAnyOf(int first, int second, int... rest) { check().that(actualList).containsAnyOf(first, second, box(rest)); }
java
@SuppressWarnings("GoodTime") // false positive; b/122617528 public void containsAnyOf(int first, int second, int... rest) { check().that(actualList).containsAnyOf(first, second, box(rest)); }
[ "@", "SuppressWarnings", "(", "\"GoodTime\"", ")", "// false positive; b/122617528", "public", "void", "containsAnyOf", "(", "int", "first", ",", "int", "second", ",", "int", "...", "rest", ")", "{", "check", "(", ")", ".", "that", "(", "actualList", ")", "....
Fails if the subject does not contain at least one of the given elements.
[ "Fails", "if", "the", "subject", "does", "not", "contain", "at", "least", "one", "of", "the", "given", "elements", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java#L98-L101
28,231
google/truth
core/src/main/java/com/google/common/truth/StringSubject.java
StringSubject.hasLength
public void hasLength(int expectedLength) { checkArgument(expectedLength >= 0, "expectedLength(%s) must be >= 0", expectedLength); check("length()").that(actual().length()).isEqualTo(expectedLength); }
java
public void hasLength(int expectedLength) { checkArgument(expectedLength >= 0, "expectedLength(%s) must be >= 0", expectedLength); check("length()").that(actual().length()).isEqualTo(expectedLength); }
[ "public", "void", "hasLength", "(", "int", "expectedLength", ")", "{", "checkArgument", "(", "expectedLength", ">=", "0", ",", "\"expectedLength(%s) must be >= 0\"", ",", "expectedLength", ")", ";", "check", "(", "\"length()\"", ")", ".", "that", "(", "actual", ...
Fails if the string does not have the given length.
[ "Fails", "if", "the", "string", "does", "not", "have", "the", "given", "length", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StringSubject.java#L53-L56
28,232
google/truth
core/src/main/java/com/google/common/truth/StringSubject.java
StringSubject.contains
public void contains(CharSequence string) { checkNotNull(string); if (actual() == null) { failWithActual("expected a string that contains", string); } else if (!actual().contains(string)) { failWithActual("expected to contain", string); } }
java
public void contains(CharSequence string) { checkNotNull(string); if (actual() == null) { failWithActual("expected a string that contains", string); } else if (!actual().contains(string)) { failWithActual("expected to contain", string); } }
[ "public", "void", "contains", "(", "CharSequence", "string", ")", "{", "checkNotNull", "(", "string", ")", ";", "if", "(", "actual", "(", ")", "==", "null", ")", "{", "failWithActual", "(", "\"expected a string that contains\"", ",", "string", ")", ";", "}",...
Fails if the string does not contain the given sequence.
[ "Fails", "if", "the", "string", "does", "not", "contain", "the", "given", "sequence", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StringSubject.java#L77-L84
28,233
google/truth
core/src/main/java/com/google/common/truth/StringSubject.java
StringSubject.startsWith
public void startsWith(String string) { checkNotNull(string); if (actual() == null) { failWithActual("expected a string that starts with", string); } else if (!actual().startsWith(string)) { failWithActual("expected to start with", string); } }
java
public void startsWith(String string) { checkNotNull(string); if (actual() == null) { failWithActual("expected a string that starts with", string); } else if (!actual().startsWith(string)) { failWithActual("expected to start with", string); } }
[ "public", "void", "startsWith", "(", "String", "string", ")", "{", "checkNotNull", "(", "string", ")", ";", "if", "(", "actual", "(", ")", "==", "null", ")", "{", "failWithActual", "(", "\"expected a string that starts with\"", ",", "string", ")", ";", "}", ...
Fails if the string does not start with the given string.
[ "Fails", "if", "the", "string", "does", "not", "start", "with", "the", "given", "string", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StringSubject.java#L97-L104
28,234
google/truth
core/src/main/java/com/google/common/truth/StringSubject.java
StringSubject.endsWith
public void endsWith(String string) { checkNotNull(string); if (actual() == null) { failWithActual("expected a string that ends with", string); } else if (!actual().endsWith(string)) { failWithActual("expected to end with", string); } }
java
public void endsWith(String string) { checkNotNull(string); if (actual() == null) { failWithActual("expected a string that ends with", string); } else if (!actual().endsWith(string)) { failWithActual("expected to end with", string); } }
[ "public", "void", "endsWith", "(", "String", "string", ")", "{", "checkNotNull", "(", "string", ")", ";", "if", "(", "actual", "(", ")", "==", "null", ")", "{", "failWithActual", "(", "\"expected a string that ends with\"", ",", "string", ")", ";", "}", "e...
Fails if the string does not end with the given string.
[ "Fails", "if", "the", "string", "does", "not", "end", "with", "the", "given", "string", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StringSubject.java#L107-L114
28,235
google/truth
core/src/main/java/com/google/common/truth/StringSubject.java
StringSubject.matches
@GwtIncompatible("java.util.regex.Pattern") public void matches(Pattern regex) { if (!regex.matcher(actual()).matches()) { failWithActual("expected to match", regex); } }
java
@GwtIncompatible("java.util.regex.Pattern") public void matches(Pattern regex) { if (!regex.matcher(actual()).matches()) { failWithActual("expected to match", regex); } }
[ "@", "GwtIncompatible", "(", "\"java.util.regex.Pattern\"", ")", "public", "void", "matches", "(", "Pattern", "regex", ")", "{", "if", "(", "!", "regex", ".", "matcher", "(", "actual", "(", ")", ")", ".", "matches", "(", ")", ")", "{", "failWithActual", ...
Fails if the string does not match the given regex.
[ "Fails", "if", "the", "string", "does", "not", "match", "the", "given", "regex", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StringSubject.java#L126-L131
28,236
google/truth
core/src/main/java/com/google/common/truth/StringSubject.java
StringSubject.containsMatch
@GwtIncompatible("java.util.regex.Pattern") public void containsMatch(Pattern regex) { if (!regex.matcher(actual()).find()) { failWithActual("expected to contain a match for", regex); } }
java
@GwtIncompatible("java.util.regex.Pattern") public void containsMatch(Pattern regex) { if (!regex.matcher(actual()).find()) { failWithActual("expected to contain a match for", regex); } }
[ "@", "GwtIncompatible", "(", "\"java.util.regex.Pattern\"", ")", "public", "void", "containsMatch", "(", "Pattern", "regex", ")", "{", "if", "(", "!", "regex", ".", "matcher", "(", "actual", "(", ")", ")", ".", "find", "(", ")", ")", "{", "failWithActual",...
Fails if the string does not contain a match on the given regex.
[ "Fails", "if", "the", "string", "does", "not", "contain", "a", "match", "on", "the", "given", "regex", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StringSubject.java#L149-L154
28,237
google/truth
core/src/main/java/com/google/common/truth/StringSubject.java
StringSubject.doesNotContainMatch
@GwtIncompatible("java.util.regex.Pattern") public void doesNotContainMatch(Pattern regex) { Matcher matcher = regex.matcher(actual()); if (matcher.find()) { failWithoutActual( fact("expected not to contain a match for", regex), fact("but contained", matcher.group()), fact(...
java
@GwtIncompatible("java.util.regex.Pattern") public void doesNotContainMatch(Pattern regex) { Matcher matcher = regex.matcher(actual()); if (matcher.find()) { failWithoutActual( fact("expected not to contain a match for", regex), fact("but contained", matcher.group()), fact(...
[ "@", "GwtIncompatible", "(", "\"java.util.regex.Pattern\"", ")", "public", "void", "doesNotContainMatch", "(", "Pattern", "regex", ")", "{", "Matcher", "matcher", "=", "regex", ".", "matcher", "(", "actual", "(", ")", ")", ";", "if", "(", "matcher", ".", "fi...
Fails if the string contains a match on the given regex.
[ "Fails", "if", "the", "string", "contains", "a", "match", "on", "the", "given", "regex", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StringSubject.java#L164-L173
28,238
google/truth
core/src/main/java/com/google/common/truth/Platform.java
Platform.containsMatch
static boolean containsMatch(String actual, String regex) { return Pattern.compile(regex).matcher(actual).find(); }
java
static boolean containsMatch(String actual, String regex) { return Pattern.compile(regex).matcher(actual).find(); }
[ "static", "boolean", "containsMatch", "(", "String", "actual", ",", "String", "regex", ")", "{", "return", "Pattern", ".", "compile", "(", "regex", ")", ".", "matcher", "(", "actual", ")", ".", "find", "(", ")", ";", "}" ]
Determines if the given subject contains a match for the given regex.
[ "Determines", "if", "the", "given", "subject", "contains", "a", "match", "for", "the", "given", "regex", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Platform.java#L50-L52
28,239
google/truth
core/src/main/java/com/google/common/truth/Correspondence.java
Correspondence.formattingDiffsUsing
public Correspondence<A, E> formattingDiffsUsing(DiffFormatter<? super A, ? super E> formatter) { return new FormattingDiffs<>(this, formatter); }
java
public Correspondence<A, E> formattingDiffsUsing(DiffFormatter<? super A, ? super E> formatter) { return new FormattingDiffs<>(this, formatter); }
[ "public", "Correspondence", "<", "A", ",", "E", ">", "formattingDiffsUsing", "(", "DiffFormatter", "<", "?", "super", "A", ",", "?", "super", "E", ">", "formatter", ")", "{", "return", "new", "FormattingDiffs", "<>", "(", "this", ",", "formatter", ")", "...
Returns a new correspondence which is like this one, except that the given formatter may be used to format the difference between a pair of elements that do not correspond. <p>Note that, if you the data you are asserting about contains null actual or expected values, the formatter may be invoked with a null argument. ...
[ "Returns", "a", "new", "correspondence", "which", "is", "like", "this", "one", "except", "that", "the", "given", "formatter", "may", "be", "used", "to", "format", "the", "difference", "between", "a", "pair", "of", "elements", "that", "do", "not", "correspond...
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Correspondence.java#L350-L352
28,240
google/truth
core/src/main/java/com/google/common/truth/ComparisonFailureWithFacts.java
ComparisonFailureWithFacts.formatExpectedAndActual
@VisibleForTesting static ImmutableList<Fact> formatExpectedAndActual(String expected, String actual) { ImmutableList<Fact> result; // TODO(cpovirk): Call attention to differences in trailing whitespace. // TODO(cpovirk): And changes in the *kind* of whitespace characters in the middle of the line. ...
java
@VisibleForTesting static ImmutableList<Fact> formatExpectedAndActual(String expected, String actual) { ImmutableList<Fact> result; // TODO(cpovirk): Call attention to differences in trailing whitespace. // TODO(cpovirk): And changes in the *kind* of whitespace characters in the middle of the line. ...
[ "@", "VisibleForTesting", "static", "ImmutableList", "<", "Fact", ">", "formatExpectedAndActual", "(", "String", "expected", ",", "String", "actual", ")", "{", "ImmutableList", "<", "Fact", ">", "result", ";", "// TODO(cpovirk): Call attention to differences in trailing w...
Returns one or more facts describing the difference between the given expected and actual values. <p>Currently, that means either 2 facts (one each for expected and actual) or 1 fact with a diff-like (but much simpler) view. <p>In the case of 2 facts, the facts contain either the full expected and actual values or, i...
[ "Returns", "one", "or", "more", "facts", "describing", "the", "difference", "between", "the", "given", "expected", "and", "actual", "values", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/ComparisonFailureWithFacts.java#L88-L106
28,241
google/truth
core/src/main/java/com/google/common/truth/ComparisonFailureWithFacts.java
ComparisonFailureWithFacts.validSurrogatePairAt
private static boolean validSurrogatePairAt(CharSequence string, int index) { return index >= 0 && index <= (string.length() - 2) && isHighSurrogate(string.charAt(index)) && isLowSurrogate(string.charAt(index + 1)); }
java
private static boolean validSurrogatePairAt(CharSequence string, int index) { return index >= 0 && index <= (string.length() - 2) && isHighSurrogate(string.charAt(index)) && isLowSurrogate(string.charAt(index + 1)); }
[ "private", "static", "boolean", "validSurrogatePairAt", "(", "CharSequence", "string", ",", "int", "index", ")", "{", "return", "index", ">=", "0", "&&", "index", "<=", "(", "string", ".", "length", "(", ")", "-", "2", ")", "&&", "isHighSurrogate", "(", ...
From c.g.c.base.Strings.
[ "From", "c", ".", "g", ".", "c", ".", "base", ".", "Strings", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/ComparisonFailureWithFacts.java#L154-L159
28,242
google/truth
core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java
Platform.isInstanceOfType
static boolean isInstanceOfType(Object instance, Class<?> clazz) { if (clazz.isInterface()) { throw new UnsupportedOperationException( "Under GWT, we can't determine whether an object is an instance of an interface Class"); } for (Class<?> current = instance.getClass(); current != n...
java
static boolean isInstanceOfType(Object instance, Class<?> clazz) { if (clazz.isInterface()) { throw new UnsupportedOperationException( "Under GWT, we can't determine whether an object is an instance of an interface Class"); } for (Class<?> current = instance.getClass(); current != n...
[ "static", "boolean", "isInstanceOfType", "(", "Object", "instance", ",", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "isInterface", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Under GWT, we can't determine...
Returns true if the instance is assignable to the type Clazz.
[ "Returns", "true", "if", "the", "instance", "is", "assignable", "to", "the", "type", "Clazz", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java#L37-L51
28,243
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java
ProtoTruthMessageDifferencer.diffMessages
DiffResult diffMessages(Message actual, Message expected) { checkNotNull(actual); checkNotNull(expected); checkArgument( actual.getDescriptorForType() == expected.getDescriptorForType(), "The actual [%s] and expected [%s] message descriptors do not match.", actual.getDescriptorForTyp...
java
DiffResult diffMessages(Message actual, Message expected) { checkNotNull(actual); checkNotNull(expected); checkArgument( actual.getDescriptorForType() == expected.getDescriptorForType(), "The actual [%s] and expected [%s] message descriptors do not match.", actual.getDescriptorForTyp...
[ "DiffResult", "diffMessages", "(", "Message", "actual", ",", "Message", "expected", ")", "{", "checkNotNull", "(", "actual", ")", ";", "checkNotNull", "(", "expected", ")", ";", "checkArgument", "(", "actual", ".", "getDescriptorForType", "(", ")", "==", "expe...
Compare the two non-null messages, and return a detailed comparison report.
[ "Compare", "the", "two", "non", "-", "null", "messages", "and", "return", "a", "detailed", "comparison", "report", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java#L79-L89
28,244
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java
ProtoTruthMessageDifferencer.findMatchingPairResult
@NullableDecl private RepeatedField.PairResult findMatchingPairResult( Deque<Integer> actualIndices, List<?> actualValues, int expectedIndex, Object expectedValue, boolean excludeNonRecursive, FieldDescriptor fieldDescriptor, FluentEqualityConfig config) { Iterator<Intege...
java
@NullableDecl private RepeatedField.PairResult findMatchingPairResult( Deque<Integer> actualIndices, List<?> actualValues, int expectedIndex, Object expectedValue, boolean excludeNonRecursive, FieldDescriptor fieldDescriptor, FluentEqualityConfig config) { Iterator<Intege...
[ "@", "NullableDecl", "private", "RepeatedField", ".", "PairResult", "findMatchingPairResult", "(", "Deque", "<", "Integer", ">", "actualIndices", ",", "List", "<", "?", ">", "actualValues", ",", "int", "expectedIndex", ",", "Object", "expectedValue", ",", "boolean...
If there is no match, returns null.
[ "If", "there", "is", "no", "match", "returns", "null", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java#L435-L463
28,245
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
SubjectUtils.annotateEmptyStrings
static <T> Iterable<T> annotateEmptyStrings(Iterable<T> items) { if (Iterables.contains(items, "")) { List<T> annotatedItems = Lists.newArrayList(); for (T item : items) { if (Objects.equal(item, "")) { // This is a safe cast because know that at least one instance of T (this item) is ...
java
static <T> Iterable<T> annotateEmptyStrings(Iterable<T> items) { if (Iterables.contains(items, "")) { List<T> annotatedItems = Lists.newArrayList(); for (T item : items) { if (Objects.equal(item, "")) { // This is a safe cast because know that at least one instance of T (this item) is ...
[ "static", "<", "T", ">", "Iterable", "<", "T", ">", "annotateEmptyStrings", "(", "Iterable", "<", "T", ">", "items", ")", "{", "if", "(", "Iterables", ".", "contains", "(", "items", ",", "\"\"", ")", ")", "{", "List", "<", "T", ">", "annotatedItems",...
Returns an iterable with all empty strings replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given iterable if it contains no empty strings.
[ "Returns", "an", "iterable", "with", "all", "empty", "strings", "replaced", "by", "a", "non", "-", "empty", "human", "understandable", "indicator", "for", "an", "empty", "string", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/SubjectUtils.java#L367-L385
28,246
google/truth
core/src/main/java/com/google/common/truth/FailureMetadata.java
FailureMetadata.description
private ImmutableList<Fact> description() { String description = null; boolean descriptionWasDerived = false; for (Step step : steps) { if (step.isCheckCall()) { checkState(description != null); if (step.descriptionUpdate == null) { description = null; descriptionWa...
java
private ImmutableList<Fact> description() { String description = null; boolean descriptionWasDerived = false; for (Step step : steps) { if (step.isCheckCall()) { checkState(description != null); if (step.descriptionUpdate == null) { description = null; descriptionWa...
[ "private", "ImmutableList", "<", "Fact", ">", "description", "(", ")", "{", "String", "description", "=", "null", ";", "boolean", "descriptionWasDerived", "=", "false", ";", "for", "(", "Step", "step", ":", "steps", ")", "{", "if", "(", "step", ".", "isC...
Returns a description of how the final actual value was derived from earlier actual values in the chain, if the chain ends with at least one derivation that we have a name for. <p>We don't want to say: "value of string: expected [foo] but was [bar]" (OK, we might still decide to say this, but for now, we don't.) <p>W...
[ "Returns", "a", "description", "of", "how", "the", "final", "actual", "value", "was", "derived", "from", "earlier", "actual", "values", "in", "the", "chain", "if", "the", "chain", "ends", "with", "at", "least", "one", "derivation", "that", "we", "have", "a...
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/FailureMetadata.java#L219-L243
28,247
google/truth
core/src/main/java/com/google/common/truth/MapSubject.java
MapSubject.containsExactlyEntriesIn
@CanIgnoreReturnValue public Ordered containsExactlyEntriesIn(Map<?, ?> expectedMap) { if (expectedMap.isEmpty()) { if (actual().isEmpty()) { return IN_ORDER; } else { isEmpty(); // fails return ALREADY_FAILED; } } boolean containsAnyOrder = containsEntrie...
java
@CanIgnoreReturnValue public Ordered containsExactlyEntriesIn(Map<?, ?> expectedMap) { if (expectedMap.isEmpty()) { if (actual().isEmpty()) { return IN_ORDER; } else { isEmpty(); // fails return ALREADY_FAILED; } } boolean containsAnyOrder = containsEntrie...
[ "@", "CanIgnoreReturnValue", "public", "Ordered", "containsExactlyEntriesIn", "(", "Map", "<", "?", ",", "?", ">", "expectedMap", ")", "{", "if", "(", "expectedMap", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "actual", "(", ")", ".", "isEmpty", "(", ...
Fails if the map does not contain exactly the given set of entries in the given map.
[ "Fails", "if", "the", "map", "does", "not", "contain", "exactly", "the", "given", "set", "of", "entries", "in", "the", "given", "map", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MapSubject.java#L231-L248
28,248
google/truth
core/src/main/java/com/google/common/truth/MapSubject.java
MapSubject.containsAtLeastEntriesIn
@CanIgnoreReturnValue public Ordered containsAtLeastEntriesIn(Map<?, ?> expectedMap) { if (expectedMap.isEmpty()) { return IN_ORDER; } boolean containsAnyOrder = containsEntriesInAnyOrder(expectedMap, "contains at least", /* allowUnexpected= */ true); if (containsAnyOrder) { return...
java
@CanIgnoreReturnValue public Ordered containsAtLeastEntriesIn(Map<?, ?> expectedMap) { if (expectedMap.isEmpty()) { return IN_ORDER; } boolean containsAnyOrder = containsEntriesInAnyOrder(expectedMap, "contains at least", /* allowUnexpected= */ true); if (containsAnyOrder) { return...
[ "@", "CanIgnoreReturnValue", "public", "Ordered", "containsAtLeastEntriesIn", "(", "Map", "<", "?", ",", "?", ">", "expectedMap", ")", "{", "if", "(", "expectedMap", ".", "isEmpty", "(", ")", ")", "{", "return", "IN_ORDER", ";", "}", "boolean", "containsAnyO...
Fails if the map does not contain at least the given set of entries in the given map.
[ "Fails", "if", "the", "map", "does", "not", "contain", "at", "least", "the", "given", "set", "of", "entries", "in", "the", "given", "map", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MapSubject.java#L251-L263
28,249
google/truth
core/src/main/java/com/google/common/truth/Fact.java
Fact.makeMessage
static String makeMessage(ImmutableList<String> messages, ImmutableList<Fact> facts) { int longestKeyLength = 0; boolean seenNewlineInValue = false; for (Fact fact : facts) { if (fact.value != null) { longestKeyLength = max(longestKeyLength, fact.key.length()); // TODO(cpovirk): Look f...
java
static String makeMessage(ImmutableList<String> messages, ImmutableList<Fact> facts) { int longestKeyLength = 0; boolean seenNewlineInValue = false; for (Fact fact : facts) { if (fact.value != null) { longestKeyLength = max(longestKeyLength, fact.key.length()); // TODO(cpovirk): Look f...
[ "static", "String", "makeMessage", "(", "ImmutableList", "<", "String", ">", "messages", ",", "ImmutableList", "<", "Fact", ">", "facts", ")", "{", "int", "longestKeyLength", "=", "0", ";", "boolean", "seenNewlineInValue", "=", "false", ";", "for", "(", "Fac...
Formats the given messages and facts into a string for use as the message of a test failure. In particular, this method horizontally aligns the beginning of fact values.
[ "Formats", "the", "given", "messages", "and", "facts", "into", "a", "string", "for", "use", "as", "the", "message", "of", "a", "test", "failure", ".", "In", "particular", "this", "method", "horizontally", "aligns", "the", "beginning", "of", "fact", "values",...
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Fact.java#L84-L127
28,250
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorOrUnknown.java
FieldDescriptorOrUnknown.shortName
final String shortName() { if (fieldDescriptor().isPresent()) { return fieldDescriptor().get().isExtension() ? "[" + fieldDescriptor().get() + "]" : fieldDescriptor().get().getName(); } else { return String.valueOf(unknownFieldDescriptor().get().fieldNumber()); } }
java
final String shortName() { if (fieldDescriptor().isPresent()) { return fieldDescriptor().get().isExtension() ? "[" + fieldDescriptor().get() + "]" : fieldDescriptor().get().getName(); } else { return String.valueOf(unknownFieldDescriptor().get().fieldNumber()); } }
[ "final", "String", "shortName", "(", ")", "{", "if", "(", "fieldDescriptor", "(", ")", ".", "isPresent", "(", ")", ")", "{", "return", "fieldDescriptor", "(", ")", ".", "get", "(", ")", ".", "isExtension", "(", ")", "?", "\"[\"", "+", "fieldDescriptor"...
Returns a short, human-readable version of this identifier.
[ "Returns", "a", "short", "human", "-", "readable", "version", "of", "this", "identifier", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldDescriptorOrUnknown.java#L41-L49
28,251
google/truth
core/src/main/java/com/google/common/truth/IterableSubject.java
IterableSubject.hasSize
public final void hasSize(int expectedSize) { checkArgument(expectedSize >= 0, "expectedSize(%s) must be >= 0", expectedSize); int actualSize = size(actual()); check("size()").that(actualSize).isEqualTo(expectedSize); }
java
public final void hasSize(int expectedSize) { checkArgument(expectedSize >= 0, "expectedSize(%s) must be >= 0", expectedSize); int actualSize = size(actual()); check("size()").that(actualSize).isEqualTo(expectedSize); }
[ "public", "final", "void", "hasSize", "(", "int", "expectedSize", ")", "{", "checkArgument", "(", "expectedSize", ">=", "0", ",", "\"expectedSize(%s) must be >= 0\"", ",", "expectedSize", ")", ";", "int", "actualSize", "=", "size", "(", "actual", "(", ")", ")"...
Fails if the subject does not have the given size.
[ "Fails", "if", "the", "subject", "does", "not", "have", "the", "given", "size", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/IterableSubject.java#L133-L137
28,252
google/truth
core/src/main/java/com/google/common/truth/IterableSubject.java
IterableSubject.containsNoDuplicates
public final void containsNoDuplicates() { List<Entry<?>> duplicates = newArrayList(); for (Multiset.Entry<?> entry : LinkedHashMultiset.create(actual()).entrySet()) { if (entry.getCount() > 1) { duplicates.add(entry); } } if (!duplicates.isEmpty()) { failWithoutActual( ...
java
public final void containsNoDuplicates() { List<Entry<?>> duplicates = newArrayList(); for (Multiset.Entry<?> entry : LinkedHashMultiset.create(actual()).entrySet()) { if (entry.getCount() > 1) { duplicates.add(entry); } } if (!duplicates.isEmpty()) { failWithoutActual( ...
[ "public", "final", "void", "containsNoDuplicates", "(", ")", "{", "List", "<", "Entry", "<", "?", ">", ">", "duplicates", "=", "newArrayList", "(", ")", ";", "for", "(", "Multiset", ".", "Entry", "<", "?", ">", "entry", ":", "LinkedHashMultiset", ".", ...
Checks that the subject does not contain duplicate elements.
[ "Checks", "that", "the", "subject", "does", "not", "contain", "duplicate", "elements", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/IterableSubject.java#L167-L180
28,253
google/truth
core/src/main/java/com/google/common/truth/IterableSubject.java
IterableSubject.containsAtLeastElementsIn
@CanIgnoreReturnValue public final Ordered containsAtLeastElementsIn(Iterable<?> expectedIterable) { List<?> actual = Lists.newLinkedList(actual()); final Collection<?> expected = iterableToCollection(expectedIterable); List<Object> missing = newArrayList(); List<Object> actualNotInOrder = newArrayLi...
java
@CanIgnoreReturnValue public final Ordered containsAtLeastElementsIn(Iterable<?> expectedIterable) { List<?> actual = Lists.newLinkedList(actual()); final Collection<?> expected = iterableToCollection(expectedIterable); List<Object> missing = newArrayList(); List<Object> actualNotInOrder = newArrayLi...
[ "@", "CanIgnoreReturnValue", "public", "final", "Ordered", "containsAtLeastElementsIn", "(", "Iterable", "<", "?", ">", "expectedIterable", ")", "{", "List", "<", "?", ">", "actual", "=", "Lists", ".", "newLinkedList", "(", "actual", "(", ")", ")", ";", "fin...
Checks that the actual iterable contains at least all of the expected elements or fails. If an element appears more than once in the expected elements then it must appear at least that number of times in the actual elements. <p>To also test that the contents appear in the given order, make a call to {@code inOrder()} ...
[ "Checks", "that", "the", "actual", "iterable", "contains", "at", "least", "all", "of", "the", "expected", "elements", "or", "fails", ".", "If", "an", "element", "appears", "more", "than", "once", "in", "the", "expected", "elements", "then", "it", "must", "...
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/IterableSubject.java#L299-L347
28,254
google/truth
core/src/main/java/com/google/common/truth/IterableSubject.java
IterableSubject.moveElements
private static void moveElements(List<?> input, Collection<Object> output, int maxElements) { for (int i = 0; i < maxElements; i++) { output.add(input.remove(0)); } }
java
private static void moveElements(List<?> input, Collection<Object> output, int maxElements) { for (int i = 0; i < maxElements; i++) { output.add(input.remove(0)); } }
[ "private", "static", "void", "moveElements", "(", "List", "<", "?", ">", "input", ",", "Collection", "<", "Object", ">", "output", ",", "int", "maxElements", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxElements", ";", "i", "++", ...
Removes at most the given number of available elements from the input list and adds them to the given output collection.
[ "Removes", "at", "most", "the", "given", "number", "of", "available", "elements", "from", "the", "input", "list", "and", "adds", "them", "to", "the", "given", "output", "collection", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/IterableSubject.java#L390-L394
28,255
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/RecursableDiffEntity.java
RecursableDiffEntity.isAnyChildMatched
final boolean isAnyChildMatched() { if (isAnyChildMatched == null) { isAnyChildMatched = false; for (RecursableDiffEntity entity : childEntities()) { if ((entity.isMatched() && !entity.isContentEmpty()) || entity.isAnyChildMatched()) { isAnyChildMatched = true; break; ...
java
final boolean isAnyChildMatched() { if (isAnyChildMatched == null) { isAnyChildMatched = false; for (RecursableDiffEntity entity : childEntities()) { if ((entity.isMatched() && !entity.isContentEmpty()) || entity.isAnyChildMatched()) { isAnyChildMatched = true; break; ...
[ "final", "boolean", "isAnyChildMatched", "(", ")", "{", "if", "(", "isAnyChildMatched", "==", "null", ")", "{", "isAnyChildMatched", "=", "false", ";", "for", "(", "RecursableDiffEntity", "entity", ":", "childEntities", "(", ")", ")", "{", "if", "(", "(", ...
Returns true if some child entity matched. <p>Caches the result for future calls.
[ "Returns", "true", "if", "some", "child", "entity", "matched", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/RecursableDiffEntity.java#L69-L80
28,256
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/RecursableDiffEntity.java
RecursableDiffEntity.isAnyChildIgnored
final boolean isAnyChildIgnored() { if (isAnyChildIgnored == null) { isAnyChildIgnored = false; for (RecursableDiffEntity entity : childEntities()) { if ((entity.isIgnored() && !entity.isContentEmpty()) || entity.isAnyChildIgnored()) { isAnyChildIgnored = true; break; ...
java
final boolean isAnyChildIgnored() { if (isAnyChildIgnored == null) { isAnyChildIgnored = false; for (RecursableDiffEntity entity : childEntities()) { if ((entity.isIgnored() && !entity.isContentEmpty()) || entity.isAnyChildIgnored()) { isAnyChildIgnored = true; break; ...
[ "final", "boolean", "isAnyChildIgnored", "(", ")", "{", "if", "(", "isAnyChildIgnored", "==", "null", ")", "{", "isAnyChildIgnored", "=", "false", ";", "for", "(", "RecursableDiffEntity", "entity", ":", "childEntities", "(", ")", ")", "{", "if", "(", "(", ...
Returns true if some child entity was ignored. <p>Caches the result for future calls.
[ "Returns", "true", "if", "some", "child", "entity", "was", "ignored", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/RecursableDiffEntity.java#L87-L98
28,257
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
StackTraceCleaner.addToStreak
private void addToStreak(StackTraceElementWrapper stackTraceElementWrapper) { if (stackTraceElementWrapper.getStackFrameType() != currentStreakType) { endStreak(); currentStreakType = stackTraceElementWrapper.getStackFrameType(); currentStreakLength = 1; } else { currentStreakLength++; ...
java
private void addToStreak(StackTraceElementWrapper stackTraceElementWrapper) { if (stackTraceElementWrapper.getStackFrameType() != currentStreakType) { endStreak(); currentStreakType = stackTraceElementWrapper.getStackFrameType(); currentStreakLength = 1; } else { currentStreakLength++; ...
[ "private", "void", "addToStreak", "(", "StackTraceElementWrapper", "stackTraceElementWrapper", ")", "{", "if", "(", "stackTraceElementWrapper", ".", "getStackFrameType", "(", ")", "!=", "currentStreakType", ")", "{", "endStreak", "(", ")", ";", "currentStreakType", "=...
Either adds the given frame to the running streak or closes out the running streak and starts a new one.
[ "Either", "adds", "the", "given", "frame", "to", "the", "running", "streak", "or", "closes", "out", "the", "running", "streak", "and", "starts", "a", "new", "one", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StackTraceCleaner.java#L161-L169
28,258
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
StackTraceCleaner.endStreak
private void endStreak() { if (currentStreakLength == 0) { return; } if (currentStreakLength == 1) { // A single frame isn't a streak. Just include the frame as-is in the result. cleanedStackTrace.add(lastStackFrameElementWrapper); } else { // Add a single frame to the result su...
java
private void endStreak() { if (currentStreakLength == 0) { return; } if (currentStreakLength == 1) { // A single frame isn't a streak. Just include the frame as-is in the result. cleanedStackTrace.add(lastStackFrameElementWrapper); } else { // Add a single frame to the result su...
[ "private", "void", "endStreak", "(", ")", "{", "if", "(", "currentStreakLength", "==", "0", ")", "{", "return", ";", "}", "if", "(", "currentStreakLength", "==", "1", ")", "{", "// A single frame isn't a streak. Just include the frame as-is in the result.", "cleanedSt...
Ends the current streak, adding a summary frame to the result. Resets the streak counter.
[ "Ends", "the", "current", "streak", "adding", "a", "summary", "frame", "to", "the", "result", ".", "Resets", "the", "streak", "counter", "." ]
60eceffd2e8c3297655d33ed87d965cf5af51108
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/StackTraceCleaner.java#L172-L186
28,259
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/MapFileWriter.java
MapFileWriter.writeFile
public static void writeFile(MapWriterConfiguration configuration, TileBasedDataProcessor dataProcessor) throws IOException { EXECUTOR_SERVICE = Executors.newFixedThreadPool(configuration.getThreads()); RandomAccessFile randomAccessFile = new RandomAccessFile(configuration.getOutputFile(), "...
java
public static void writeFile(MapWriterConfiguration configuration, TileBasedDataProcessor dataProcessor) throws IOException { EXECUTOR_SERVICE = Executors.newFixedThreadPool(configuration.getThreads()); RandomAccessFile randomAccessFile = new RandomAccessFile(configuration.getOutputFile(), "...
[ "public", "static", "void", "writeFile", "(", "MapWriterConfiguration", "configuration", ",", "TileBasedDataProcessor", "dataProcessor", ")", "throws", "IOException", "{", "EXECUTOR_SERVICE", "=", "Executors", ".", "newFixedThreadPool", "(", "configuration", ".", "getThre...
Writes the map file according to the given configuration using the given data processor. @param configuration the configuration @param dataProcessor the data processor @throws IOException thrown if any IO error occurs
[ "Writes", "the", "map", "file", "according", "to", "the", "given", "configuration", "using", "the", "given", "data", "processor", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/MapFileWriter.java#L353-L399
28,260
mapsforge/mapsforge
mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java
AbstractPoiPersistenceManager.stringToTags
protected static Set<Tag> stringToTags(String data) { Set<Tag> tags = new HashSet<>(); String[] split = data.split("\r"); for (String s : split) { if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) { String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR)); ...
java
protected static Set<Tag> stringToTags(String data) { Set<Tag> tags = new HashSet<>(); String[] split = data.split("\r"); for (String s : split) { if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) { String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR)); ...
[ "protected", "static", "Set", "<", "Tag", ">", "stringToTags", "(", "String", "data", ")", "{", "Set", "<", "Tag", ">", "tags", "=", "new", "HashSet", "<>", "(", ")", ";", "String", "[", "]", "split", "=", "data", ".", "split", "(", "\"\\r\"", ")",...
Convert tags string representation with '\r' delimiter to collection.
[ "Convert", "tags", "string", "representation", "with", "\\", "r", "delimiter", "to", "collection", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java#L124-L136
28,261
mapsforge/mapsforge
mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java
AbstractPoiPersistenceManager.tagsToString
protected static String tagsToString(Set<Tag> tags) { StringBuilder sb = new StringBuilder(); for (Tag tag : tags) { if (sb.length() > 0) { sb.append('\r'); } sb.append(tag.key).append(Tag.KEY_VALUE_SEPARATOR).append(tag.value); } retur...
java
protected static String tagsToString(Set<Tag> tags) { StringBuilder sb = new StringBuilder(); for (Tag tag : tags) { if (sb.length() > 0) { sb.append('\r'); } sb.append(tag.key).append(Tag.KEY_VALUE_SEPARATOR).append(tag.value); } retur...
[ "protected", "static", "String", "tagsToString", "(", "Set", "<", "Tag", ">", "tags", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Tag", "tag", ":", "tags", ")", "{", "if", "(", "sb", ".", "length", "(", ...
Convert tags collection to string representation with '\r' delimiter.
[ "Convert", "tags", "collection", "to", "string", "representation", "with", "\\", "r", "delimiter", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi/src/main/java/org/mapsforge/poi/storage/AbstractPoiPersistenceManager.java#L141-L150
28,262
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/cache/FileSystemTileCache.java
FileSystemTileCache.storeData
private void storeData(Job key, TileBitmap bitmap) { OutputStream outputStream = null; try { File file = getOutputFile(key); if (file == null) { // if the file cannot be written, silently return return; } outputStream = new ...
java
private void storeData(Job key, TileBitmap bitmap) { OutputStream outputStream = null; try { File file = getOutputFile(key); if (file == null) { // if the file cannot be written, silently return return; } outputStream = new ...
[ "private", "void", "storeData", "(", "Job", "key", ",", "TileBitmap", "bitmap", ")", "{", "OutputStream", "outputStream", "=", "null", ";", "try", "{", "File", "file", "=", "getOutputFile", "(", "key", ")", ";", "if", "(", "file", "==", "null", ")", "{...
stores the bitmap data on disk with filename key @param key filename @param bitmap tile image
[ "stores", "the", "bitmap", "data", "on", "disk", "with", "filename", "key" ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/cache/FileSystemTileCache.java#L387-L425
28,263
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/ClusterMapActivity.java
ClusterMapActivity.onOptionsItemSelected
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case 1234: if (clusterer != null) { break; } // create clusterer instance clu...
java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case 1234: if (clusterer != null) { break; } // create clusterer instance clu...
[ "@", "Override", "public", "boolean", "onOptionsItemSelected", "(", "MenuItem", "item", ")", "{", "super", ".", "onOptionsItemSelected", "(", "item", ")", ";", "switch", "(", "item", ".", "getItemId", "(", ")", ")", "{", "case", "1234", ":", "if", "(", "...
onOptionsItemSelected handler since clustering need MapView to be created and visible, this sample do clustering here.
[ "onOptionsItemSelected", "handler", "since", "clustering", "need", "MapView", "to", "be", "created", "and", "visible", "this", "sample", "do", "clustering", "here", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/ClusterMapActivity.java#L205-L269
28,264
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/GeoTagger.java
GeoTagger.updateTagData
private void updateTagData(Map<Poi, Map<String, String>> pois, String key, String value) { for (Map.Entry<Poi, Map<String, String>> entry : pois.entrySet()) { Poi poi = entry.getKey(); String tmpValue = value; Map<String, String> tagmap = entry.getValue(); if (!t...
java
private void updateTagData(Map<Poi, Map<String, String>> pois, String key, String value) { for (Map.Entry<Poi, Map<String, String>> entry : pois.entrySet()) { Poi poi = entry.getKey(); String tmpValue = value; Map<String, String> tagmap = entry.getValue(); if (!t...
[ "private", "void", "updateTagData", "(", "Map", "<", "Poi", ",", "Map", "<", "String", ",", "String", ">", ">", "pois", ",", "String", "key", ",", "String", "value", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Poi", ",", "Map", "<", "String", ...
Updates the tags of a POI-List with key and value. @param pois Pois, which should be tagged @param key The tag key @param value The tag value
[ "Updates", "the", "tags", "of", "a", "POI", "-", "List", "with", "key", "and", "value", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/GeoTagger.java#L334-L378
28,265
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/TDRelation.java
TDRelation.fromRelation
public static TDRelation fromRelation(Relation relation, WayResolver resolver, List<String> preferredLanguages) { if (relation == null) { return null; } if (relation.getMembers().isEmpty()) { return null; } SpecialTagExtractionResult ster = OSMUtils.extr...
java
public static TDRelation fromRelation(Relation relation, WayResolver resolver, List<String> preferredLanguages) { if (relation == null) { return null; } if (relation.getMembers().isEmpty()) { return null; } SpecialTagExtractionResult ster = OSMUtils.extr...
[ "public", "static", "TDRelation", "fromRelation", "(", "Relation", "relation", ",", "WayResolver", "resolver", ",", "List", "<", "String", ">", "preferredLanguages", ")", "{", "if", "(", "relation", "==", "null", ")", "{", "return", "null", ";", "}", "if", ...
Creates a new TDRelation from an osmosis entity using the given WayResolver. @param relation the relation @param resolver the resolver @param preferredLanguages the preferred(s) language or null if no preference @return a new TDRelation if all members are valid and the relation is of a known type, ...
[ "Creates", "a", "new", "TDRelation", "from", "an", "osmosis", "entity", "using", "the", "given", "WayResolver", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/TDRelation.java#L45-L88
28,266
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/GroupLayer.java
GroupLayer.onTap
@Override public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) { for (int i = layers.size() - 1; i >= 0; i--) { Layer layer = layers.get(i); if (layer.onTap(tapLatLong, layerXY, tapXY)) { return true; } } return false; }
java
@Override public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) { for (int i = layers.size() - 1; i >= 0; i--) { Layer layer = layers.get(i); if (layer.onTap(tapLatLong, layerXY, tapXY)) { return true; } } return false; }
[ "@", "Override", "public", "boolean", "onTap", "(", "LatLong", "tapLatLong", ",", "Point", "layerXY", ",", "Point", "tapXY", ")", "{", "for", "(", "int", "i", "=", "layers", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")...
GroupLayer does not have a position, layerXY is null.
[ "GroupLayer", "does", "not", "have", "a", "position", "layerXY", "is", "null", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/GroupLayer.java#L71-L80
28,267
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java
ClusterManager.isItemInViewport
protected boolean isItemInViewport(final GeoItem item) { BoundingBox curBounds = getCurBounds(); return curBounds != null && curBounds.contains(item.getLatLong()); }
java
protected boolean isItemInViewport(final GeoItem item) { BoundingBox curBounds = getCurBounds(); return curBounds != null && curBounds.contains(item.getLatLong()); }
[ "protected", "boolean", "isItemInViewport", "(", "final", "GeoItem", "item", ")", "{", "BoundingBox", "curBounds", "=", "getCurBounds", "(", ")", ";", "return", "curBounds", "!=", "null", "&&", "curBounds", ".", "contains", "(", "item", ".", "getLatLong", "(",...
check if the item is within current viewport. @return true if item is within viewport.
[ "check", "if", "the", "item", "is", "within", "current", "viewport", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java#L267-L270
28,268
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java
ClusterManager.getCurBounds
protected synchronized BoundingBox getCurBounds() { if (currBoundingBox == null) { if (mapView == null) { throw new NullPointerException("mapView == null"); } if (mapView.getWidth() <= 0 || mapView.getHeight() <= 0) { throw new IllegalArgumentE...
java
protected synchronized BoundingBox getCurBounds() { if (currBoundingBox == null) { if (mapView == null) { throw new NullPointerException("mapView == null"); } if (mapView.getWidth() <= 0 || mapView.getHeight() <= 0) { throw new IllegalArgumentE...
[ "protected", "synchronized", "BoundingBox", "getCurBounds", "(", ")", "{", "if", "(", "currBoundingBox", "==", "null", ")", "{", "if", "(", "mapView", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"mapView == null\"", ")", ";", "}", ...
get the current BoundingBox of the viewport @return current BoundingBox of the viewport
[ "get", "the", "current", "BoundingBox", "of", "the", "viewport" ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java#L277-L305
28,269
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java
ClusterManager.addLeftItems
private void addLeftItems() { // Log.w(TAG,"addLeftItems() {.... (0)"); if (leftItems.size() == 0) { return; } // Log.w(TAG,"addLeftItems() {.... (1)"); ArrayList<T> currentLeftItems = new ArrayList<T>(); currentLeftItems.addAll(leftItems); // Log.w(T...
java
private void addLeftItems() { // Log.w(TAG,"addLeftItems() {.... (0)"); if (leftItems.size() == 0) { return; } // Log.w(TAG,"addLeftItems() {.... (1)"); ArrayList<T> currentLeftItems = new ArrayList<T>(); currentLeftItems.addAll(leftItems); // Log.w(T...
[ "private", "void", "addLeftItems", "(", ")", "{", "// Log.w(TAG,\"addLeftItems() {.... (0)\");", "if", "(", "leftItems", ".", "size", "(", ")", "==", "0", ")", "{", "return", ";", "}", "// Log.w(TAG,\"addLeftItems() {.... (1)\");", "ArrayList", "<", "T", ">", "cur...
add items that were not clustered in last isClustering.
[ "add", "items", "that", "were", "not", "clustered", "in", "last", "isClustering", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java#L310-L332
28,270
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java
ClusterManager.resetViewport
private synchronized void resetViewport(boolean isMoving) { isClustering = true; clusterTask = new ClusterTask(); clusterTask.execute(new Boolean[]{isMoving}); }
java
private synchronized void resetViewport(boolean isMoving) { isClustering = true; clusterTask = new ClusterTask(); clusterTask.execute(new Boolean[]{isMoving}); }
[ "private", "synchronized", "void", "resetViewport", "(", "boolean", "isMoving", ")", "{", "isClustering", "=", "true", ";", "clusterTask", "=", "new", "ClusterTask", "(", ")", ";", "clusterTask", ".", "execute", "(", "new", "Boolean", "[", "]", "{", "isMovin...
reset current viewport, re-cluster the items when zoom has changed, else add not clustered items .
[ "reset", "current", "viewport", "re", "-", "cluster", "the", "items", "when", "zoom", "has", "changed", "else", "add", "not", "clustered", "items", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java#L370-L374
28,271
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.commit
private void commit() throws SQLException { LOGGER.info("Committing..."); this.progressManager.setMessage("Committing..."); this.pStmtIndex.executeBatch(); this.pStmtData.executeBatch(); this.pStmtCatMap.executeBatch(); if (this.configuration.isGeoTags()) { th...
java
private void commit() throws SQLException { LOGGER.info("Committing..."); this.progressManager.setMessage("Committing..."); this.pStmtIndex.executeBatch(); this.pStmtData.executeBatch(); this.pStmtCatMap.executeBatch(); if (this.configuration.isGeoTags()) { th...
[ "private", "void", "commit", "(", ")", "throws", "SQLException", "{", "LOGGER", ".", "info", "(", "\"Committing...\"", ")", ";", "this", ".", "progressManager", ".", "setMessage", "(", "\"Committing...\"", ")", ";", "this", ".", "pStmtIndex", ".", "executeBatc...
Commit changes.
[ "Commit", "changes", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L168-L178
28,272
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.complete
public void complete() { if (this.configuration.isGeoTags()) { this.geoTagger.processBoundaries(); } NumberFormat nfMegabyte = NumberFormat.getInstance(); nfMegabyte.setMaximumFractionDigits(2); try { commit(); if (this.configuration.isFilterC...
java
public void complete() { if (this.configuration.isGeoTags()) { this.geoTagger.processBoundaries(); } NumberFormat nfMegabyte = NumberFormat.getInstance(); nfMegabyte.setMaximumFractionDigits(2); try { commit(); if (this.configuration.isFilterC...
[ "public", "void", "complete", "(", ")", "{", "if", "(", "this", ".", "configuration", ".", "isGeoTags", "(", ")", ")", "{", "this", ".", "geoTagger", ".", "processBoundaries", "(", ")", ";", "}", "NumberFormat", "nfMegabyte", "=", "NumberFormat", ".", "g...
Complete task.
[ "Complete", "task", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L183-L209
28,273
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.filterCategories
private void filterCategories() throws SQLException { LOGGER.info("Filtering categories..."); PreparedStatement pStmtChildren = this.conn.prepareStatement("SELECT COUNT(*) FROM poi_categories WHERE parent = ?;"); PreparedStatement pStmtPoi = this.conn.prepareStatement("SELECT COUNT(*) FROM poi_c...
java
private void filterCategories() throws SQLException { LOGGER.info("Filtering categories..."); PreparedStatement pStmtChildren = this.conn.prepareStatement("SELECT COUNT(*) FROM poi_categories WHERE parent = ?;"); PreparedStatement pStmtPoi = this.conn.prepareStatement("SELECT COUNT(*) FROM poi_c...
[ "private", "void", "filterCategories", "(", ")", "throws", "SQLException", "{", "LOGGER", ".", "info", "(", "\"Filtering categories...\"", ")", ";", "PreparedStatement", "pStmtChildren", "=", "this", ".", "conn", ".", "prepareStatement", "(", "\"SELECT COUNT(*) FROM p...
Filter categories, i.e. without POIs and children.
[ "Filter", "categories", "i", ".", "e", ".", "without", "POIs", "and", "children", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L214-L241
28,274
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.findWayNodesByWayID
List<Long> findWayNodesByWayID(long id) { try { this.pStmtWayNodesR.setLong(1, id); ResultSet rs = this.pStmtWayNodesR.executeQuery(); Map<Integer, Long> nodeList = new TreeMap<>(); while (rs.next()) { // way, node, position Long n...
java
List<Long> findWayNodesByWayID(long id) { try { this.pStmtWayNodesR.setLong(1, id); ResultSet rs = this.pStmtWayNodesR.executeQuery(); Map<Integer, Long> nodeList = new TreeMap<>(); while (rs.next()) { // way, node, position Long n...
[ "List", "<", "Long", ">", "findWayNodesByWayID", "(", "long", "id", ")", "{", "try", "{", "this", ".", "pStmtWayNodesR", ".", "setLong", "(", "1", ",", "id", ")", ";", "ResultSet", "rs", "=", "this", ".", "pStmtWayNodesR", ".", "executeQuery", "(", ")"...
Find way nodes by its ID.
[ "Find", "way", "nodes", "by", "its", "ID", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L268-L286
28,275
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.getTagValue
String getTagValue(Collection<Tag> tags, String key) { for (Tag tag : tags) { if (tag.getKey().toLowerCase(Locale.ENGLISH).equals(key.toLowerCase(Locale.ENGLISH))) { return tag.getValue(); } } return null; }
java
String getTagValue(Collection<Tag> tags, String key) { for (Tag tag : tags) { if (tag.getKey().toLowerCase(Locale.ENGLISH).equals(key.toLowerCase(Locale.ENGLISH))) { return tag.getValue(); } } return null; }
[ "String", "getTagValue", "(", "Collection", "<", "Tag", ">", "tags", ",", "String", "key", ")", "{", "for", "(", "Tag", "tag", ":", "tags", ")", "{", "if", "(", "tag", ".", "getKey", "(", ")", ".", "toLowerCase", "(", "Locale", ".", "ENGLISH", ")",...
Returns value of given tag in a set of tags. @param tags collection of tags @param key tag key @return Tag value or null if not exists
[ "Returns", "value", "of", "given", "tag", "in", "a", "set", "of", "tags", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L295-L302
28,276
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.postProcess
private void postProcess() throws SQLException { LOGGER.info("Post-processing..."); this.conn = DriverManager.getConnection("jdbc:sqlite:" + this.configuration.getOutputFile().getAbsolutePath()); this.conn.createStatement().execute(DbConstants.DROP_NODES_STATEMENT); this.conn.createStat...
java
private void postProcess() throws SQLException { LOGGER.info("Post-processing..."); this.conn = DriverManager.getConnection("jdbc:sqlite:" + this.configuration.getOutputFile().getAbsolutePath()); this.conn.createStatement().execute(DbConstants.DROP_NODES_STATEMENT); this.conn.createStat...
[ "private", "void", "postProcess", "(", ")", "throws", "SQLException", "{", "LOGGER", ".", "info", "(", "\"Post-processing...\"", ")", ";", "this", ".", "conn", "=", "DriverManager", ".", "getConnection", "(", "\"jdbc:sqlite:\"", "+", "this", ".", "configuration"...
Post-process.
[ "Post", "-", "process", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L307-L318
28,277
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.prepareDatabase
private void prepareDatabase() throws ClassNotFoundException, SQLException, UnknownPoiCategoryException { Class.forName("org.sqlite.JDBC"); this.conn = DriverManager.getConnection("jdbc:sqlite:" + this.configuration.getOutputFile().getAbsolutePath()); this.conn.setAutoCommit(false); Sta...
java
private void prepareDatabase() throws ClassNotFoundException, SQLException, UnknownPoiCategoryException { Class.forName("org.sqlite.JDBC"); this.conn = DriverManager.getConnection("jdbc:sqlite:" + this.configuration.getOutputFile().getAbsolutePath()); this.conn.setAutoCommit(false); Sta...
[ "private", "void", "prepareDatabase", "(", ")", "throws", "ClassNotFoundException", ",", "SQLException", ",", "UnknownPoiCategoryException", "{", "Class", ".", "forName", "(", "\"org.sqlite.JDBC\"", ")", ";", "this", ".", "conn", "=", "DriverManager", ".", "getConne...
Prepare database.
[ "Prepare", "database", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L323-L375
28,278
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.process
public void process(EntityContainer entityContainer) { Entity entity = entityContainer.getEntity(); LOGGER.finest("Processing entity: " + entity.toString()); switch (entity.getType()) { case Node: Node node = (Node) entity; if (this.nNodes == 0) { ...
java
public void process(EntityContainer entityContainer) { Entity entity = entityContainer.getEntity(); LOGGER.finest("Processing entity: " + entity.toString()); switch (entity.getType()) { case Node: Node node = (Node) entity; if (this.nNodes == 0) { ...
[ "public", "void", "process", "(", "EntityContainer", "entityContainer", ")", "{", "Entity", "entity", "=", "entityContainer", ".", "getEntity", "(", ")", ";", "LOGGER", ".", "finest", "(", "\"Processing entity: \"", "+", "entity", ".", "toString", "(", ")", ")...
Process task.
[ "Process", "task", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L380-L445
28,279
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.stringToTags
Map<String, String> stringToTags(String tagsmapstring) { String[] sb = tagsmapstring.split("\\r"); Map<String, String> map = new HashMap<>(); for (String key : sb) { if (key.contains("=")) { String[] set = key.split("="); if (set.length == 2) ...
java
Map<String, String> stringToTags(String tagsmapstring) { String[] sb = tagsmapstring.split("\\r"); Map<String, String> map = new HashMap<>(); for (String key : sb) { if (key.contains("=")) { String[] set = key.split("="); if (set.length == 2) ...
[ "Map", "<", "String", ",", "String", ">", "stringToTags", "(", "String", "tagsmapstring", ")", "{", "String", "[", "]", "sb", "=", "tagsmapstring", ".", "split", "(", "\"\\\\r\"", ")", ";", "Map", "<", "String", ",", "String", ">", "map", "=", "new", ...
Convert string representation back to tags map.
[ "Convert", "string", "representation", "back", "to", "tags", "map", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L581-L592
28,280
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.tagsToString
String tagsToString(Map<String, String> tagMap) { StringBuilder sb = new StringBuilder(); for (String key : tagMap.keySet()) { // Skip some tags if (key.equalsIgnoreCase("created_by")) { continue; } if (sb.length() > 0) { sb...
java
String tagsToString(Map<String, String> tagMap) { StringBuilder sb = new StringBuilder(); for (String key : tagMap.keySet()) { // Skip some tags if (key.equalsIgnoreCase("created_by")) { continue; } if (sb.length() > 0) { sb...
[ "String", "tagsToString", "(", "Map", "<", "String", ",", "String", ">", "tagMap", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "key", ":", "tagMap", ".", "keySet", "(", ")", ")", "{", "// Skip some...
Convert tags to a string representation using '\r' delimiter.
[ "Convert", "tags", "to", "a", "string", "representation", "using", "\\", "r", "delimiter", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L597-L610
28,281
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.writeMetadata
private void writeMetadata() throws SQLException { LOGGER.info("Writing metadata..."); PreparedStatement pStmtMetadata = this.conn.prepareStatement(DbConstants.INSERT_METADATA_STATEMENT); // Bounds pStmtMetadata.setString(1, DbConstants.METADATA_BOUNDS); BoundingBox bb = this.co...
java
private void writeMetadata() throws SQLException { LOGGER.info("Writing metadata..."); PreparedStatement pStmtMetadata = this.conn.prepareStatement(DbConstants.INSERT_METADATA_STATEMENT); // Bounds pStmtMetadata.setString(1, DbConstants.METADATA_BOUNDS); BoundingBox bb = this.co...
[ "private", "void", "writeMetadata", "(", ")", "throws", "SQLException", "{", "LOGGER", ".", "info", "(", "\"Writing metadata...\"", ")", ";", "PreparedStatement", "pStmtMetadata", "=", "this", ".", "conn", ".", "prepareStatement", "(", "DbConstants", ".", "INSERT_...
Write the metadata to the database.
[ "Write", "the", "metadata", "to", "the", "database", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L615-L672
28,282
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.writePOI
private void writePOI(long id, double latitude, double longitude, Map<String, String> poiData, Set<PoiCategory> categories) { try { // Index data this.pStmtIndex.setLong(1, id); this.pStmtIndex.setDouble(2, latitude); this.pStmtIndex.setDouble(3, latitude); ...
java
private void writePOI(long id, double latitude, double longitude, Map<String, String> poiData, Set<PoiCategory> categories) { try { // Index data this.pStmtIndex.setLong(1, id); this.pStmtIndex.setDouble(2, latitude); this.pStmtIndex.setDouble(3, latitude); ...
[ "private", "void", "writePOI", "(", "long", "id", ",", "double", "latitude", ",", "double", "longitude", ",", "Map", "<", "String", ",", "String", ">", "poiData", ",", "Set", "<", "PoiCategory", ">", "categories", ")", "{", "try", "{", "// Index data", "...
Write a POI to the database.
[ "Write", "a", "POI", "to", "the", "database", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L698-L760
28,283
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/Tag.java
Tag.compareTo
@Override public int compareTo(Tag tag) { int keyResult = this.key.compareTo(tag.key); if (keyResult != 0) { return keyResult; } return this.value.compareTo(tag.value); }
java
@Override public int compareTo(Tag tag) { int keyResult = this.key.compareTo(tag.key); if (keyResult != 0) { return keyResult; } return this.value.compareTo(tag.value); }
[ "@", "Override", "public", "int", "compareTo", "(", "Tag", "tag", ")", "{", "int", "keyResult", "=", "this", ".", "key", ".", "compareTo", "(", "tag", ".", "key", ")", ";", "if", "(", "keyResult", "!=", "0", ")", "{", "return", "keyResult", ";", "}...
Compares this tag to the specified tag. The tag comparison is based on a comparison of key and value in that order. @param tag The tag to compare to. @return 0 if equal, &lt; 0 if considered "smaller", and &gt; 0 if considered "bigger".
[ "Compares", "this", "tag", "to", "the", "specified", "tag", ".", "The", "tag", "comparison", "is", "based", "on", "a", "comparison", "of", "key", "and", "value", "in", "that", "order", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/Tag.java#L65-L74
28,284
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/Rectangle.java
Rectangle.enlarge
public Rectangle enlarge(double left, double top, double right, double bottom) { return new Rectangle(this.left - left, this.top - top, this.right + right, this.bottom + bottom); }
java
public Rectangle enlarge(double left, double top, double right, double bottom) { return new Rectangle(this.left - left, this.top - top, this.right + right, this.bottom + bottom); }
[ "public", "Rectangle", "enlarge", "(", "double", "left", ",", "double", "top", ",", "double", "right", ",", "double", "bottom", ")", "{", "return", "new", "Rectangle", "(", "this", ".", "left", "-", "left", ",", "this", ".", "top", "-", "top", ",", "...
Enlarges the Rectangle sides individually @param left left enlargement @param top top enlargement @param right right enlargement @param bottom bottom enlargement @return
[ "Enlarges", "the", "Rectangle", "sides", "individually" ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/Rectangle.java#L58-L60
28,285
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/DualMapViewer.java
DualMapViewer.createLayers2
protected void createLayers2() { this.mapView2.getLayerManager() .getLayers().add(AndroidUtil.createTileRendererLayer(this.tileCaches.get(1), this.mapView2.getModel().mapViewPosition, getMapFile2(), getRenderTheme2(), false, true, false)); }
java
protected void createLayers2() { this.mapView2.getLayerManager() .getLayers().add(AndroidUtil.createTileRendererLayer(this.tileCaches.get(1), this.mapView2.getModel().mapViewPosition, getMapFile2(), getRenderTheme2(), false, true, false)); }
[ "protected", "void", "createLayers2", "(", ")", "{", "this", ".", "mapView2", ".", "getLayerManager", "(", ")", ".", "getLayers", "(", ")", ".", "add", "(", "AndroidUtil", ".", "createTileRendererLayer", "(", "this", ".", "tileCaches", ".", "get", "(", "1"...
creates the layers for the second map view.
[ "creates", "the", "layers", "for", "the", "second", "map", "view", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/DualMapViewer.java#L52-L57
28,286
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/Samples.java
Samples.startupDialog
private void startupDialog(String prefs, int message, final Class clazz) { final SharedPreferences preferences = getSharedPreferences(prefs, Activity.MODE_PRIVATE); final String accepted = "accepted"; if (!preferences.getBoolean(accepted, false)) { AlertDialog.Builder builder = new A...
java
private void startupDialog(String prefs, int message, final Class clazz) { final SharedPreferences preferences = getSharedPreferences(prefs, Activity.MODE_PRIVATE); final String accepted = "accepted"; if (!preferences.getBoolean(accepted, false)) { AlertDialog.Builder builder = new A...
[ "private", "void", "startupDialog", "(", "String", "prefs", ",", "int", "message", ",", "final", "Class", "clazz", ")", "{", "final", "SharedPreferences", "preferences", "=", "getSharedPreferences", "(", "prefs", ",", "Activity", ".", "MODE_PRIVATE", ")", ";", ...
Warning startup dialog.
[ "Warning", "startup", "dialog", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/Samples.java#L267-L285
28,287
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/mapelements/MapElementContainer.java
MapElementContainer.compareTo
@Override public int compareTo(MapElementContainer other) { if (this.priority < other.priority) { return -1; } if (this.priority > other.priority) { return 1; } return 0; }
java
@Override public int compareTo(MapElementContainer other) { if (this.priority < other.priority) { return -1; } if (this.priority > other.priority) { return 1; } return 0; }
[ "@", "Override", "public", "int", "compareTo", "(", "MapElementContainer", "other", ")", "{", "if", "(", "this", ".", "priority", "<", "other", ".", "priority", ")", "{", "return", "-", "1", ";", "}", "if", "(", "this", ".", "priority", ">", "other", ...
Compares elements according to their priority. @param other @return priority order
[ "Compares", "elements", "according", "to", "their", "priority", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/mapelements/MapElementContainer.java#L58-L67
28,288
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/mapelements/MapElementContainer.java
MapElementContainer.clashesWith
public boolean clashesWith(MapElementContainer other) { // if either of the elements is always drawn, the elements do not clash if (Display.ALWAYS == this.display || Display.ALWAYS == other.display) { return false; } return this.getBoundaryAbsolute().intersects(other.getBound...
java
public boolean clashesWith(MapElementContainer other) { // if either of the elements is always drawn, the elements do not clash if (Display.ALWAYS == this.display || Display.ALWAYS == other.display) { return false; } return this.getBoundaryAbsolute().intersects(other.getBound...
[ "public", "boolean", "clashesWith", "(", "MapElementContainer", "other", ")", "{", "// if either of the elements is always drawn, the elements do not clash", "if", "(", "Display", ".", "ALWAYS", "==", "this", ".", "display", "||", "Display", ".", "ALWAYS", "==", "other"...
Returns if MapElementContainers clash with each other @param other element to test against @return true if they overlap
[ "Returns", "if", "MapElementContainers", "clash", "with", "each", "other" ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/mapelements/MapElementContainer.java#L113-L119
28,289
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/OSMUtils.java
OSMUtils.extractKnownPOITags
public static Map<Short, Object> extractKnownPOITags(Entity entity) { Map<Short, Object> tagMap = new HashMap<>(); OSMTagMapping mapping = OSMTagMapping.getInstance(); if (entity.getTags() != null) { for (Tag tag : entity.getTags()) { OSMTag poiTag = mapping.getPoiTag...
java
public static Map<Short, Object> extractKnownPOITags(Entity entity) { Map<Short, Object> tagMap = new HashMap<>(); OSMTagMapping mapping = OSMTagMapping.getInstance(); if (entity.getTags() != null) { for (Tag tag : entity.getTags()) { OSMTag poiTag = mapping.getPoiTag...
[ "public", "static", "Map", "<", "Short", ",", "Object", ">", "extractKnownPOITags", "(", "Entity", "entity", ")", "{", "Map", "<", "Short", ",", "Object", ">", "tagMap", "=", "new", "HashMap", "<>", "(", ")", ";", "OSMTagMapping", "mapping", "=", "OSMTag...
Extracts known POI tags and returns their ids. @param entity the node @return the ids of the identified tags
[ "Extracts", "known", "POI", "tags", "and", "returns", "their", "ids", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/OSMUtils.java#L59-L72
28,290
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/OSMUtils.java
OSMUtils.extractKnownWayTags
public static Map<Short, Object> extractKnownWayTags(Entity entity) { Map<Short, Object> tagMap = new HashMap<>(); OSMTagMapping mapping = OSMTagMapping.getInstance(); if (entity.getTags() != null) { for (Tag tag : entity.getTags()) { OSMTag wayTag = mapping.getWayTag...
java
public static Map<Short, Object> extractKnownWayTags(Entity entity) { Map<Short, Object> tagMap = new HashMap<>(); OSMTagMapping mapping = OSMTagMapping.getInstance(); if (entity.getTags() != null) { for (Tag tag : entity.getTags()) { OSMTag wayTag = mapping.getWayTag...
[ "public", "static", "Map", "<", "Short", ",", "Object", ">", "extractKnownWayTags", "(", "Entity", "entity", ")", "{", "Map", "<", "Short", ",", "Object", ">", "tagMap", "=", "new", "HashMap", "<>", "(", ")", ";", "OSMTagMapping", "mapping", "=", "OSMTag...
Extracts known way tags and returns their ids. @param entity the way @return the ids of the identified tags
[ "Extracts", "known", "way", "tags", "and", "returns", "their", "ids", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/OSMUtils.java#L80-L93
28,291
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/DatabaseRenderer.java
DatabaseRenderer.createBackgroundBitmap
private TileBitmap createBackgroundBitmap(RenderContext renderContext) { TileBitmap bitmap = this.graphicFactory.createTileBitmap(renderContext.rendererJob.tile.tileSize, renderContext.rendererJob.hasAlpha); renderContext.canvasRasterer.setCanvasBitmap(bitmap); if (!renderContext.rendererJob.has...
java
private TileBitmap createBackgroundBitmap(RenderContext renderContext) { TileBitmap bitmap = this.graphicFactory.createTileBitmap(renderContext.rendererJob.tile.tileSize, renderContext.rendererJob.hasAlpha); renderContext.canvasRasterer.setCanvasBitmap(bitmap); if (!renderContext.rendererJob.has...
[ "private", "TileBitmap", "createBackgroundBitmap", "(", "RenderContext", "renderContext", ")", "{", "TileBitmap", "bitmap", "=", "this", ".", "graphicFactory", ".", "createTileBitmap", "(", "renderContext", ".", "rendererJob", ".", "tile", ".", "tileSize", ",", "ren...
Draws a bitmap just with outside colour, used for bitmaps outside of map area. @param renderContext the RenderContext @return bitmap drawn in single colour.
[ "Draws", "a", "bitmap", "just", "with", "outside", "colour", "used", "for", "bitmaps", "outside", "of", "map", "area", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/DatabaseRenderer.java#L159-L167
28,292
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.createExternalStorageTileCache
public static TileCache createExternalStorageTileCache(Context c, String id, int firstLevelSize, int tileSize) { return createExternalStorageTileCache(c, id, firstLevelSize, tileSize, false); }
java
public static TileCache createExternalStorageTileCache(Context c, String id, int firstLevelSize, int tileSize) { return createExternalStorageTileCache(c, id, firstLevelSize, tileSize, false); }
[ "public", "static", "TileCache", "createExternalStorageTileCache", "(", "Context", "c", ",", "String", "id", ",", "int", "firstLevelSize", ",", "int", "tileSize", ")", "{", "return", "createExternalStorageTileCache", "(", "c", ",", "id", ",", "firstLevelSize", ","...
Utility function to create a two-level tile cache along with its backends. This is the compatibility version that by default creates a non-persistent cache. @param c the Android context @param id name for the directory, which will be created as a subdirectory of the default cache directory (as...
[ "Utility", "function", "to", "create", "a", "two", "-", "level", "tile", "cache", "along", "with", "its", "backends", ".", "This", "is", "the", "compatibility", "version", "that", "by", "default", "creates", "a", "non", "-", "persistent", "cache", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L66-L68
28,293
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.createTileCache
public static TileCache createTileCache(Context c, String id, int tileSize, float screenRatio, double overdraw) { return createTileCache(c, id, tileSize, screenRatio, overdraw, false); }
java
public static TileCache createTileCache(Context c, String id, int tileSize, float screenRatio, double overdraw) { return createTileCache(c, id, tileSize, screenRatio, overdraw, false); }
[ "public", "static", "TileCache", "createTileCache", "(", "Context", "c", ",", "String", "id", ",", "int", "tileSize", ",", "float", "screenRatio", ",", "double", "overdraw", ")", "{", "return", "createTileCache", "(", "c", ",", "id", ",", "tileSize", ",", ...
Utility function to create a two-level tile cache with the right size. When the cache is created we do not actually know the size of the mapview, so the screenRatio is an approximation of the required size. This is the compatibility version that by default creates a non-persistent cache. @param c the Android...
[ "Utility", "function", "to", "create", "a", "two", "-", "level", "tile", "cache", "with", "the", "right", "size", ".", "When", "the", "cache", "is", "created", "we", "do", "not", "actually", "know", "the", "size", "of", "the", "mapview", "so", "the", "...
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L170-L172
28,294
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.createTileCache
public static TileCache createTileCache(Context c, String id, int tileSize, int width, int height, double overdraw) { return createTileCache(c, id, tileSize, width, height, overdraw, false); }
java
public static TileCache createTileCache(Context c, String id, int tileSize, int width, int height, double overdraw) { return createTileCache(c, id, tileSize, width, height, overdraw, false); }
[ "public", "static", "TileCache", "createTileCache", "(", "Context", "c", ",", "String", "id", ",", "int", "tileSize", ",", "int", "width", ",", "int", "height", ",", "double", "overdraw", ")", "{", "return", "createTileCache", "(", "c", ",", "id", ",", "...
Utility function to create a two-level tile cache with the right size, using the size of the map view. This is the compatibility version that by default creates a non-persistent cache. @param c the Android context @param id name for the storage directory @param tileSize tile size @param width the width...
[ "Utility", "function", "to", "create", "a", "two", "-", "level", "tile", "cache", "with", "the", "right", "size", "using", "the", "size", "of", "the", "map", "view", ".", "This", "is", "the", "compatibility", "version", "that", "by", "default", "creates", ...
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L222-L224
28,295
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.getAvailableCacheSlots
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public static long getAvailableCacheSlots(String directory, int fileSize) { StatFs statfs = new StatFs(directory); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { return statfs.getAvail...
java
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public static long getAvailableCacheSlots(String directory, int fileSize) { StatFs statfs = new StatFs(directory); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { return statfs.getAvail...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR2", ")", "public", "static", "long", "getAvailableCacheSlots", "(", "String", "directory", ",", "int", "fileSize", ")", "{", "StatFs", ...
Get the number of tiles that can be stored on the file system. @param directory where the cache will reside @param fileSize average size of tile to be cached @return number of tiles that can be stored without running out of space
[ "Get", "the", "number", "of", "tiles", "that", "can", "be", "stored", "on", "the", "file", "system", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L326-L337
28,296
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.getMinimumCacheSize
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public static int getMinimumCacheSize(Context c, int tileSize, double overdrawFactor, float screenRatio) { WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefault...
java
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public static int getMinimumCacheSize(Context c, int tileSize, double overdrawFactor, float screenRatio) { WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefault...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB_MR2", ")", "public", "static", "int", "getMinimumCacheSize", "(", "Context", "c", ",", "int", "tileSize", ",", "double", "overdrawFactor", ...
Compute the minimum cache size for a view. When the cache is created we do not actually know the size of the mapview, so the screenRatio is an approximation of the required size. For the view size we use the frame buffer calculated dimension. @param c the context @param tileSize the tile size @param...
[ "Compute", "the", "minimum", "cache", "size", "for", "a", "view", ".", "When", "the", "cache", "is", "created", "we", "do", "not", "actually", "know", "the", "size", "of", "the", "mapview", "so", "the", "screenRatio", "is", "an", "approximation", "of", "...
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L350-L379
28,297
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.getMinimumCacheSize
public static int getMinimumCacheSize(int tileSize, double overdrawFactor, int width, int height) { // height * overdrawFactor / tileSize calculates the number of tiles that would cover // the view port, adding 1 is required since we can have part tiles on either side, // adding 2 adds another r...
java
public static int getMinimumCacheSize(int tileSize, double overdrawFactor, int width, int height) { // height * overdrawFactor / tileSize calculates the number of tiles that would cover // the view port, adding 1 is required since we can have part tiles on either side, // adding 2 adds another r...
[ "public", "static", "int", "getMinimumCacheSize", "(", "int", "tileSize", ",", "double", "overdrawFactor", ",", "int", "width", ",", "int", "height", ")", "{", "// height * overdrawFactor / tileSize calculates the number of tiles that would cover", "// the view port, adding 1 i...
Compute the minimum cache size for a view, using the size of the map view. For the view size we use the frame buffer calculated dimension. @param tileSize the tile size @param overdrawFactor the overdraw factor applied to the mapview @param width the width of the map view @param height the heigh...
[ "Compute", "the", "minimum", "cache", "size", "for", "a", "view", "using", "the", "size", "of", "the", "map", "view", ".", "For", "the", "view", "size", "we", "use", "the", "frame", "buffer", "calculated", "dimension", "." ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L391-L401
28,298
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.setMapScaleBar
public static void setMapScaleBar(MapView mapView, DistanceUnitAdapter primaryDistanceUnitAdapter, DistanceUnitAdapter secondaryDistanceUnitAdapter) { if (null == primaryDistanceUnitAdapter && null == secondaryDistanceUnitAdapter) { ...
java
public static void setMapScaleBar(MapView mapView, DistanceUnitAdapter primaryDistanceUnitAdapter, DistanceUnitAdapter secondaryDistanceUnitAdapter) { if (null == primaryDistanceUnitAdapter && null == secondaryDistanceUnitAdapter) { ...
[ "public", "static", "void", "setMapScaleBar", "(", "MapView", "mapView", ",", "DistanceUnitAdapter", "primaryDistanceUnitAdapter", ",", "DistanceUnitAdapter", "secondaryDistanceUnitAdapter", ")", "{", "if", "(", "null", "==", "primaryDistanceUnitAdapter", "&&", "null", "=...
Sets the scale bar on a map view with implicit arguments. If no distance unit adapters are supplied, there will be no scalebar, with only a primary adapter supplied, the mode will be single, with two adapters supplied, the mode will be dual. @param mapView the map view to change @param primaryDist...
[ "Sets", "the", "scale", "bar", "on", "a", "map", "view", "with", "implicit", "arguments", ".", "If", "no", "distance", "unit", "adapters", "are", "supplied", "there", "will", "be", "no", "scalebar", "with", "only", "a", "primary", "adapter", "supplied", "t...
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L433-L455
28,299
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/dummy/ManyDummyContent.java
ManyDummyContent.loadXmlFromNetwork
private List<DummyItem> loadXmlFromNetwork(String urlString) throws IOException { String jString; // Instantiate the parser List<Entry> entries = null; List<DummyItem> rtnArray = new ArrayList<DummyItem>(); BufferedReader streamReader = null; try { streamReade...
java
private List<DummyItem> loadXmlFromNetwork(String urlString) throws IOException { String jString; // Instantiate the parser List<Entry> entries = null; List<DummyItem> rtnArray = new ArrayList<DummyItem>(); BufferedReader streamReader = null; try { streamReade...
[ "private", "List", "<", "DummyItem", ">", "loadXmlFromNetwork", "(", "String", "urlString", ")", "throws", "IOException", "{", "String", "jString", ";", "// Instantiate the parser", "List", "<", "Entry", ">", "entries", "=", "null", ";", "List", "<", "DummyItem"...
Uploads XML from nominatim.openstreetmap.org, parses it, and create DummyItems from it
[ "Uploads", "XML", "from", "nominatim", ".", "openstreetmap", ".", "org", "parses", "it", "and", "create", "DummyItems", "from", "it" ]
c49c83f7f727552f793dff15cefa532ade030842
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/dummy/ManyDummyContent.java#L83-L141