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
36,700
iipc/webarchive-commons
src/main/java/org/archive/url/LaxURI.java
LaxURI.decode
protected static String decode(String component, String charset) throws URIException { if (component == null) { throw new IllegalArgumentException( "Component array of chars may not be null"); } byte[] rawdata = null; // try { rawdata = LaxURLCodec.decodeUrlLoose(EncodingUtil .getAsciiBytes(component)); // } catch (DecoderException e) { // throw new URIException(e.getMessage()); // } return EncodingUtil.getString(rawdata, charset); }
java
protected static String decode(String component, String charset) throws URIException { if (component == null) { throw new IllegalArgumentException( "Component array of chars may not be null"); } byte[] rawdata = null; // try { rawdata = LaxURLCodec.decodeUrlLoose(EncodingUtil .getAsciiBytes(component)); // } catch (DecoderException e) { // throw new URIException(e.getMessage()); // } return EncodingUtil.getString(rawdata, charset); }
[ "protected", "static", "String", "decode", "(", "String", "component", ",", "String", "charset", ")", "throws", "URIException", "{", "if", "(", "component", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Component array of chars may not ...
overridden to use IA's LaxURLCodec, which never throws DecoderException
[ "overridden", "to", "use", "IA", "s", "LaxURLCodec", "which", "never", "throws", "DecoderException" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/LaxURI.java#L117-L131
36,701
iipc/webarchive-commons
src/main/java/org/archive/url/LaxURI.java
LaxURI.parseAuthority
protected void parseAuthority(String original, boolean escaped) throws URIException { super.parseAuthority(original, escaped); if (_host != null && _authority != null && _host.length == _authority.length) { _host = _authority; } }
java
protected void parseAuthority(String original, boolean escaped) throws URIException { super.parseAuthority(original, escaped); if (_host != null && _authority != null && _host.length == _authority.length) { _host = _authority; } }
[ "protected", "void", "parseAuthority", "(", "String", "original", ",", "boolean", "escaped", ")", "throws", "URIException", "{", "super", ".", "parseAuthority", "(", "original", ",", "escaped", ")", ";", "if", "(", "_host", "!=", "null", "&&", "_authority", ...
Coalesce the _host and _authority fields where possible. In the web crawl/http domain, most URIs have an identical _host and _authority. (There is no port or user info.) However, the superclass always creates two separate char[] instances. Notably, the lengths of these char[] fields are equal if and only if their values are identical. This method makes use of this fact to reduce the two instances to one where possible, slimming instances. @see org.apache.commons.httpclient.URI#parseAuthority(java.lang.String, boolean)
[ "Coalesce", "the", "_host", "and", "_authority", "fields", "where", "possible", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/LaxURI.java#L188-L195
36,702
iipc/webarchive-commons
src/main/java/org/archive/url/LaxURI.java
LaxURI.setURI
protected void setURI() { if (_scheme != null) { if (_scheme.length == 4 && Arrays.equals(_scheme, HTTP_SCHEME)) { _scheme = HTTP_SCHEME; } else if (_scheme.length == 5 && Arrays.equals(_scheme, HTTPS_SCHEME)) { _scheme = HTTPS_SCHEME; } } super.setURI(); }
java
protected void setURI() { if (_scheme != null) { if (_scheme.length == 4 && Arrays.equals(_scheme, HTTP_SCHEME)) { _scheme = HTTP_SCHEME; } else if (_scheme.length == 5 && Arrays.equals(_scheme, HTTPS_SCHEME)) { _scheme = HTTPS_SCHEME; } } super.setURI(); }
[ "protected", "void", "setURI", "(", ")", "{", "if", "(", "_scheme", "!=", "null", ")", "{", "if", "(", "_scheme", ".", "length", "==", "4", "&&", "Arrays", ".", "equals", "(", "_scheme", ",", "HTTP_SCHEME", ")", ")", "{", "_scheme", "=", "HTTP_SCHEME...
Coalesce _scheme to existing instances, where appropriate. In the web-crawl domain, most _schemes are 'http' or 'https', but the superclass always creates a new char[] instance. For these two cases, we replace the created instance with a long-lived instance from a static field, saving 12-14 bytes per instance. @see org.apache.commons.httpclient.URI#setURI()
[ "Coalesce", "_scheme", "to", "existing", "instances", "where", "appropriate", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/LaxURI.java#L209-L219
36,703
iipc/webarchive-commons
src/main/java/org/archive/io/WriterPoolMember.java
WriterPoolMember.generateNewBasename
protected void generateNewBasename() { Properties localProps = new Properties(); localProps.setProperty("prefix", settings.getPrefix()); synchronized(this.getClass()) { // ensure that serialNo and timestamp are minted together (never inverted sort order) String paddedSerialNumber = WriterPoolMember.serialNoFormatter.format(serialNo.getAndIncrement()); String timestamp17 = ArchiveUtils.getUnique17DigitDate(); String timestamp14 = ArchiveUtils.getUnique14DigitDate(); currentTimestamp = timestamp17; localProps.setProperty("serialno", paddedSerialNumber); localProps.setProperty("timestamp17", timestamp17); localProps.setProperty("timestamp14", timestamp14); } currentBasename = PropertyUtils.interpolateWithProperties(settings.getTemplate(), localProps, System.getProperties()); }
java
protected void generateNewBasename() { Properties localProps = new Properties(); localProps.setProperty("prefix", settings.getPrefix()); synchronized(this.getClass()) { // ensure that serialNo and timestamp are minted together (never inverted sort order) String paddedSerialNumber = WriterPoolMember.serialNoFormatter.format(serialNo.getAndIncrement()); String timestamp17 = ArchiveUtils.getUnique17DigitDate(); String timestamp14 = ArchiveUtils.getUnique14DigitDate(); currentTimestamp = timestamp17; localProps.setProperty("serialno", paddedSerialNumber); localProps.setProperty("timestamp17", timestamp17); localProps.setProperty("timestamp14", timestamp14); } currentBasename = PropertyUtils.interpolateWithProperties(settings.getTemplate(), localProps, System.getProperties()); }
[ "protected", "void", "generateNewBasename", "(", ")", "{", "Properties", "localProps", "=", "new", "Properties", "(", ")", ";", "localProps", ".", "setProperty", "(", "\"prefix\"", ",", "settings", ".", "getPrefix", "(", ")", ")", ";", "synchronized", "(", "...
Generate a new basename by interpolating values in the configured template. Values come from local state, other configured values, and global system properties. The recommended default template will generate a unique basename under reasonable assumptions.
[ "Generate", "a", "new", "basename", "by", "interpolating", "values", "in", "the", "configured", "template", ".", "Values", "come", "from", "local", "state", "other", "configured", "values", "and", "global", "system", "properties", ".", "The", "recommended", "def...
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/WriterPoolMember.java#L270-L285
36,704
iipc/webarchive-commons
src/main/java/org/archive/io/WriterPoolMember.java
WriterPoolMember.getBaseFilename
protected String getBaseFilename() { String name = this.f.getName(); if (settings.getCompress() && name.endsWith(DOT_COMPRESSED_FILE_EXTENSION)) { return name.substring(0,name.length() - 3); } else if(settings.getCompress() && name.endsWith(DOT_COMPRESSED_FILE_EXTENSION + OCCUPIED_SUFFIX)) { return name.substring(0, name.length() - (3 + OCCUPIED_SUFFIX.length())); } else { return name; } }
java
protected String getBaseFilename() { String name = this.f.getName(); if (settings.getCompress() && name.endsWith(DOT_COMPRESSED_FILE_EXTENSION)) { return name.substring(0,name.length() - 3); } else if(settings.getCompress() && name.endsWith(DOT_COMPRESSED_FILE_EXTENSION + OCCUPIED_SUFFIX)) { return name.substring(0, name.length() - (3 + OCCUPIED_SUFFIX.length())); } else { return name; } }
[ "protected", "String", "getBaseFilename", "(", ")", "{", "String", "name", "=", "this", ".", "f", ".", "getName", "(", ")", ";", "if", "(", "settings", ".", "getCompress", "(", ")", "&&", "name", ".", "endsWith", "(", "DOT_COMPRESSED_FILE_EXTENSION", ")", ...
Get the file name @return the filename, as if uncompressed
[ "Get", "the", "file", "name" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/WriterPoolMember.java#L293-L305
36,705
iipc/webarchive-commons
src/main/java/org/archive/io/WriterPoolMember.java
WriterPoolMember.preWriteRecordTasks
protected void preWriteRecordTasks() throws IOException { if (this.out == null) { createFile(); } if (settings.getCompress()) { // Wrap stream in GZIP Writer. // The below construction immediately writes the GZIP 'default' // header out on the underlying stream. this.out = new CompressedStream(this.out); } }
java
protected void preWriteRecordTasks() throws IOException { if (this.out == null) { createFile(); } if (settings.getCompress()) { // Wrap stream in GZIP Writer. // The below construction immediately writes the GZIP 'default' // header out on the underlying stream. this.out = new CompressedStream(this.out); } }
[ "protected", "void", "preWriteRecordTasks", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "out", "==", "null", ")", "{", "createFile", "(", ")", ";", "}", "if", "(", "settings", ".", "getCompress", "(", ")", ")", "{", "// Wrap stream in...
Post write tasks. Has side effects. Will open new file if we're at the upper bound. If we're writing compressed files, it will wrap output stream with a GZIP writer with side effect that GZIP header is written out on the stream. @exception IOException
[ "Post", "write", "tasks", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/WriterPoolMember.java#L329-L340
36,706
iipc/webarchive-commons
src/main/java/org/archive/io/WriterPoolMember.java
WriterPoolMember.postWriteRecordTasks
protected void postWriteRecordTasks() throws IOException { if (settings.getCompress()) { CompressedStream o = (CompressedStream)this.out; o.finish(); o.flush(); o.end(); this.out = o.getWrappedStream(); } }
java
protected void postWriteRecordTasks() throws IOException { if (settings.getCompress()) { CompressedStream o = (CompressedStream)this.out; o.finish(); o.flush(); o.end(); this.out = o.getWrappedStream(); } }
[ "protected", "void", "postWriteRecordTasks", "(", ")", "throws", "IOException", "{", "if", "(", "settings", ".", "getCompress", "(", ")", ")", "{", "CompressedStream", "o", "=", "(", "CompressedStream", ")", "this", ".", "out", ";", "o", ".", "finish", "("...
Post file write tasks. If compressed, finishes up compression and flushes stream so any subsequent checks get good reading. @exception IOException
[ "Post", "file", "write", "tasks", ".", "If", "compressed", "finishes", "up", "compression", "and", "flushes", "stream", "so", "any", "subsequent", "checks", "get", "good", "reading", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/WriterPoolMember.java#L349-L358
36,707
iipc/webarchive-commons
src/main/java/org/archive/format/gzip/zipnum/ZipNumCluster.java
ZipNumCluster.computeTotalLines
public long computeTotalLines() { long numLines = 0; try { numLines = this.getNumLines(summary.getRange("", "")); } catch (IOException e) { LOGGER.warning(e.toString()); return 0; } long adjustment = getTotalAdjustment(); numLines -= (getNumBlocks() - 1); numLines *= this.getCdxLinesPerBlock(); numLines += adjustment; return numLines; }
java
public long computeTotalLines() { long numLines = 0; try { numLines = this.getNumLines(summary.getRange("", "")); } catch (IOException e) { LOGGER.warning(e.toString()); return 0; } long adjustment = getTotalAdjustment(); numLines -= (getNumBlocks() - 1); numLines *= this.getCdxLinesPerBlock(); numLines += adjustment; return numLines; }
[ "public", "long", "computeTotalLines", "(", ")", "{", "long", "numLines", "=", "0", ";", "try", "{", "numLines", "=", "this", ".", "getNumLines", "(", "summary", ".", "getRange", "(", "\"\"", ",", "\"\"", ")", ")", ";", "}", "catch", "(", "IOException"...
Adjust from shorter blocks, if loaded
[ "Adjust", "from", "shorter", "blocks", "if", "loaded" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/gzip/zipnum/ZipNumCluster.java#L493-L509
36,708
iipc/webarchive-commons
src/main/java/org/archive/format/text/charset/CharsetDetector.java
CharsetDetector.getCharsetFromMeta
protected String getCharsetFromMeta(byte buffer[],int len) throws IOException { String charsetName = null; // convert to UTF-8 String -- which hopefully will not mess up the // characters we're interested in... String sample = new String(buffer,0,len,DEFAULT_CHARSET); String metaContentType = findMetaContentType(sample); if(metaContentType != null) { charsetName = contentTypeToCharset(metaContentType); } return charsetName; }
java
protected String getCharsetFromMeta(byte buffer[],int len) throws IOException { String charsetName = null; // convert to UTF-8 String -- which hopefully will not mess up the // characters we're interested in... String sample = new String(buffer,0,len,DEFAULT_CHARSET); String metaContentType = findMetaContentType(sample); if(metaContentType != null) { charsetName = contentTypeToCharset(metaContentType); } return charsetName; }
[ "protected", "String", "getCharsetFromMeta", "(", "byte", "buffer", "[", "]", ",", "int", "len", ")", "throws", "IOException", "{", "String", "charsetName", "=", "null", ";", "// convert to UTF-8 String -- which hopefully will not mess up the", "// characters we're interest...
Attempt to find a META tag in the HTML that hints at the character set used to write the document. @param resource @return String character set found from META tags in the HTML @throws IOException
[ "Attempt", "to", "find", "a", "META", "tag", "in", "the", "HTML", "that", "hints", "at", "the", "character", "set", "used", "to", "write", "the", "document", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/text/charset/CharsetDetector.java#L168-L179
36,709
iipc/webarchive-commons
src/main/java/org/archive/format/text/charset/CharsetDetector.java
CharsetDetector.getCharsetFromBytes
protected String getCharsetFromBytes(byte buffer[], int len) throws IOException { String charsetName = null; UniversalDetector detector = new UniversalDetector(null); detector.handleData(buffer, 0, len); detector.dataEnd(); charsetName = detector.getDetectedCharset(); detector.reset(); if(isCharsetSupported(charsetName)) { return mapCharset(charsetName); } return null; }
java
protected String getCharsetFromBytes(byte buffer[], int len) throws IOException { String charsetName = null; UniversalDetector detector = new UniversalDetector(null); detector.handleData(buffer, 0, len); detector.dataEnd(); charsetName = detector.getDetectedCharset(); detector.reset(); if(isCharsetSupported(charsetName)) { return mapCharset(charsetName); } return null; }
[ "protected", "String", "getCharsetFromBytes", "(", "byte", "buffer", "[", "]", ",", "int", "len", ")", "throws", "IOException", "{", "String", "charsetName", "=", "null", ";", "UniversalDetector", "detector", "=", "new", "UniversalDetector", "(", "null", ")", ...
Attempts to figure out the character set of the document using the excellent juniversalchardet library. @param resource @return String character encoding found, or null if nothing looked good. @throws IOException
[ "Attempts", "to", "figure", "out", "the", "character", "set", "of", "the", "document", "using", "the", "excellent", "juniversalchardet", "library", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/text/charset/CharsetDetector.java#L231-L243
36,710
iipc/webarchive-commons
src/main/java/org/archive/io/ReplayInputStream.java
ReplayInputStream.readContentTo
public void readContentTo(OutputStream os, long maxSize) throws IOException { setToResponseBodyStart(); byte[] buf = new byte[4096]; int c = read(buf); long tot = 0; while (c != -1 && tot < maxSize) { os.write(buf,0,c); c = read(buf); tot += c; } }
java
public void readContentTo(OutputStream os, long maxSize) throws IOException { setToResponseBodyStart(); byte[] buf = new byte[4096]; int c = read(buf); long tot = 0; while (c != -1 && tot < maxSize) { os.write(buf,0,c); c = read(buf); tot += c; } }
[ "public", "void", "readContentTo", "(", "OutputStream", "os", ",", "long", "maxSize", ")", "throws", "IOException", "{", "setToResponseBodyStart", "(", ")", ";", "byte", "[", "]", "buf", "=", "new", "byte", "[", "4096", "]", ";", "int", "c", "=", "read",...
Convenience method to copy content out to target stream. @param os stream to write content to @param maxSize maximum count of bytes to copy @throws IOException
[ "Convenience", "method", "to", "copy", "content", "out", "to", "target", "stream", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ReplayInputStream.java#L234-L244
36,711
iipc/webarchive-commons
src/main/java/org/archive/io/ReplayInputStream.java
ReplayInputStream.position
public void position(long p) throws IOException { if (p < 0) { throw new IOException("Negative seek offset."); } if (p > size) { throw new IOException("Desired position exceeds size."); } if (p < buffer.length) { // Only seek file if necessary if (position > buffer.length) { diskStream.position(0); } } else { diskStream.position(p - buffer.length); } this.position = p; }
java
public void position(long p) throws IOException { if (p < 0) { throw new IOException("Negative seek offset."); } if (p > size) { throw new IOException("Desired position exceeds size."); } if (p < buffer.length) { // Only seek file if necessary if (position > buffer.length) { diskStream.position(0); } } else { diskStream.position(p - buffer.length); } this.position = p; }
[ "public", "void", "position", "(", "long", "p", ")", "throws", "IOException", "{", "if", "(", "p", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"Negative seek offset.\"", ")", ";", "}", "if", "(", "p", ">", "size", ")", "{", "throw", "ne...
Reposition the stream. @param p the new position for this stream @throws IOException if an IO error occurs
[ "Reposition", "the", "stream", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ReplayInputStream.java#L298-L314
36,712
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveRecord.java
ArchiveRecord.close
public void close() throws IOException { if (this.in != null) { skip(); this.in = null; if (this.digest != null) { this.digestStr = Base32.encode(this.digest.digest()); } } }
java
public void close() throws IOException { if (this.in != null) { skip(); this.in = null; if (this.digest != null) { this.digestStr = Base32.encode(this.digest.digest()); } } }
[ "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "in", "!=", "null", ")", "{", "skip", "(", ")", ";", "this", ".", "in", "=", "null", ";", "if", "(", "this", ".", "digest", "!=", "null", ")", "{", "this...
Calling close on a record skips us past this record to the next record in the stream. It does not actually close the stream. The underlying steam is probably being used by the next arc record. @throws IOException
[ "Calling", "close", "on", "a", "record", "skips", "us", "past", "this", "record", "to", "the", "next", "record", "in", "the", "stream", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveRecord.java#L170-L178
36,713
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveRecord.java
ArchiveRecord.available
public int available() { long amount = getHeader().getLength() - getPosition(); return (amount > Integer.MAX_VALUE? Integer.MAX_VALUE: (int)amount); }
java
public int available() { long amount = getHeader().getLength() - getPosition(); return (amount > Integer.MAX_VALUE? Integer.MAX_VALUE: (int)amount); }
[ "public", "int", "available", "(", ")", "{", "long", "amount", "=", "getHeader", "(", ")", ".", "getLength", "(", ")", "-", "getPosition", "(", ")", ";", "return", "(", "amount", ">", "Integer", ".", "MAX_VALUE", "?", "Integer", ".", "MAX_VALUE", ":", ...
This available is not the stream's available. Its an available based on what the stated Archive record length is minus what we've read to date. @return True if bytes remaining in record content.
[ "This", "available", "is", "not", "the", "stream", "s", "available", ".", "Its", "an", "available", "based", "on", "what", "the", "stated", "Archive", "record", "length", "is", "minus", "what", "we", "ve", "read", "to", "date", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveRecord.java#L228-L231
36,714
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveRecord.java
ArchiveRecord.skip
protected void skip() throws IOException { if (this.eor) { return; } // Read to the end of the body of the record. Exhaust the stream. // Can't skip direct to end because underlying stream may be compressed // and we're calculating the digest for the record. int r = available(); while (r > 0 && !this.eor) { skip(r); r = available(); } }
java
protected void skip() throws IOException { if (this.eor) { return; } // Read to the end of the body of the record. Exhaust the stream. // Can't skip direct to end because underlying stream may be compressed // and we're calculating the digest for the record. int r = available(); while (r > 0 && !this.eor) { skip(r); r = available(); } }
[ "protected", "void", "skip", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "eor", ")", "{", "return", ";", "}", "// Read to the end of the body of the record. Exhaust the stream.", "// Can't skip direct to end because underlying stream may be compressed", "...
Skip over this records content. @throws IOException
[ "Skip", "over", "this", "records", "content", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveRecord.java#L238-L251
36,715
iipc/webarchive-commons
src/main/java/org/archive/io/GenerationFileHandler.java
GenerationFileHandler.rotate
public GenerationFileHandler rotate(String storeSuffix, String activeSuffix) throws IOException { return rotate(storeSuffix, activeSuffix, false); }
java
public GenerationFileHandler rotate(String storeSuffix, String activeSuffix) throws IOException { return rotate(storeSuffix, activeSuffix, false); }
[ "public", "GenerationFileHandler", "rotate", "(", "String", "storeSuffix", ",", "String", "activeSuffix", ")", "throws", "IOException", "{", "return", "rotate", "(", "storeSuffix", ",", "activeSuffix", ",", "false", ")", ";", "}" ]
Move the current file to a new filename with the storeSuffix in place of the activeSuffix; continuing logging to a new file under the original filename. @param storeSuffix Suffix to put in place of <code>activeSuffix</code> @param activeSuffix Suffix to replace with <code>storeSuffix</code>. @return GenerationFileHandler instance. @throws IOException
[ "Move", "the", "current", "file", "to", "a", "new", "filename", "with", "the", "storeSuffix", "in", "place", "of", "the", "activeSuffix", ";", "continuing", "logging", "to", "a", "new", "file", "under", "the", "original", "filename", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/GenerationFileHandler.java#L91-L95
36,716
iipc/webarchive-commons
src/main/java/org/archive/io/GenerationFileHandler.java
GenerationFileHandler.makeNew
public static GenerationFileHandler makeNew(String filename, boolean append, boolean shouldManifest) throws SecurityException, IOException { FileUtils.moveAsideIfExists(new File(filename)); return new GenerationFileHandler(filename, append, shouldManifest); }
java
public static GenerationFileHandler makeNew(String filename, boolean append, boolean shouldManifest) throws SecurityException, IOException { FileUtils.moveAsideIfExists(new File(filename)); return new GenerationFileHandler(filename, append, shouldManifest); }
[ "public", "static", "GenerationFileHandler", "makeNew", "(", "String", "filename", ",", "boolean", "append", ",", "boolean", "shouldManifest", ")", "throws", "SecurityException", ",", "IOException", "{", "FileUtils", ".", "moveAsideIfExists", "(", "new", "File", "("...
Constructor-helper that rather than clobbering any existing file, moves it aside with a timestamp suffix. @param filename @param append @param shouldManifest @return @throws SecurityException @throws IOException
[ "Constructor", "-", "helper", "that", "rather", "than", "clobbering", "any", "existing", "file", "moves", "it", "aside", "with", "a", "timestamp", "suffix", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/GenerationFileHandler.java#L156-L159
36,717
iipc/webarchive-commons
src/main/java/org/archive/util/iterator/LookaheadIterator.java
LookaheadIterator.next
public T next() { if (!hasNext()) { throw new NoSuchElementException(); } // 'next' is guaranteed non-null by a hasNext() which returned true T returnObj = this.next; this.next = null; return returnObj; }
java
public T next() { if (!hasNext()) { throw new NoSuchElementException(); } // 'next' is guaranteed non-null by a hasNext() which returned true T returnObj = this.next; this.next = null; return returnObj; }
[ "public", "T", "next", "(", ")", "{", "if", "(", "!", "hasNext", "(", ")", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "// 'next' is guaranteed non-null by a hasNext() which returned true", "T", "returnObj", "=", "this", ".", "next", ...
Return the next item. @see java.util.Iterator#next()
[ "Return", "the", "next", "item", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/iterator/LookaheadIterator.java#L57-L65
36,718
iipc/webarchive-commons
src/main/java/org/archive/util/ByteOp.java
ByteOp.readToNull
public static byte[] readToNull(InputStream is, int maxSize) throws IOException { byte[] bytes = new byte[maxSize]; int i = 0; while(i < maxSize) { int b = is.read(); if(b == -1) { throw new EOFException("NO NULL"); } bytes[i] = (byte) (b & 0xff); i++; if(b == 0) { return copy(bytes,0,i); } } // BUGBUG: This isn't the right exception!!! // TODO: just skip any more bytes until NULL or EOF // throw an EOF if we find it... produce warning, too throw new IOException("Buffer too small"); }
java
public static byte[] readToNull(InputStream is, int maxSize) throws IOException { byte[] bytes = new byte[maxSize]; int i = 0; while(i < maxSize) { int b = is.read(); if(b == -1) { throw new EOFException("NO NULL"); } bytes[i] = (byte) (b & 0xff); i++; if(b == 0) { return copy(bytes,0,i); } } // BUGBUG: This isn't the right exception!!! // TODO: just skip any more bytes until NULL or EOF // throw an EOF if we find it... produce warning, too throw new IOException("Buffer too small"); }
[ "public", "static", "byte", "[", "]", "readToNull", "(", "InputStream", "is", ",", "int", "maxSize", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "maxSize", "]", ";", "int", "i", "=", "0", ";", "while", "(", ...
Read, buffer, and return bytes from is until a null byte is encountered @param is InputStream to read from @param maxSize maximum number of bytes to search for the null @return array of bytes read, INCLUDING TRAILING NULL @throws IOException if the underlying stream throws on, OR if the specified maximum buffer size is reached before a null byte is found @throws ShortByteReadException if EOF is encountered before a null byte
[ "Read", "buffer", "and", "return", "bytes", "from", "is", "until", "a", "null", "byte", "is", "encountered" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/ByteOp.java#L196-L216
36,719
iipc/webarchive-commons
src/main/java/org/archive/util/Base32.java
Base32.main
static public void main(String[] args) { if (args.length == 0) { System.out.println("Supply a Base32-encoded argument."); return; } System.out.println(" Original: " + args[0]); byte[] decoded = Base32.decode(args[0]); System.out.print(" Hex: "); for (int i = 0; i < decoded.length; i++) { int b = decoded[i]; if (b < 0) { b += 256; } System.out.print((Integer.toHexString(b + 256)).substring(1)); } System.out.println(); System.out.println("Reencoded: " + Base32.encode(decoded)); }
java
static public void main(String[] args) { if (args.length == 0) { System.out.println("Supply a Base32-encoded argument."); return; } System.out.println(" Original: " + args[0]); byte[] decoded = Base32.decode(args[0]); System.out.print(" Hex: "); for (int i = 0; i < decoded.length; i++) { int b = decoded[i]; if (b < 0) { b += 256; } System.out.print((Integer.toHexString(b + 256)).substring(1)); } System.out.println(); System.out.println("Reencoded: " + Base32.encode(decoded)); }
[ "static", "public", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"Supply a Base32-encoded argument.\"", ")", ";", "return", ";", "}", "Sys...
For testing, take a command-line argument in Base32, decode, print in hex, encode, print @param args
[ "For", "testing", "take", "a", "command", "-", "line", "argument", "in", "Base32", "decode", "print", "in", "hex", "encode", "print" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/Base32.java#L141-L158
36,720
iipc/webarchive-commons
src/main/java/org/archive/util/zip/GzipHeader.java
GzipHeader.readHeader
public void readHeader(InputStream in) throws IOException { CRC32 crc = new CRC32(); crc.reset(); if (!testGzipMagic(in, crc)) { throw new NoGzipMagicException(); } this.length += 2; if (readByte(in, crc) != Deflater.DEFLATED) { throw new IOException("Unknown compression"); } this.length++; // Get gzip header flag. this.flg = readByte(in, crc); this.length++; // Get MTIME. this.mtime = readInt(in, crc); this.length += 4; // Read XFL and OS. this.xfl = readByte(in, crc); this.length++; this.os = readByte(in, crc); this.length++; // Skip optional extra field -- stuff w/ alexa stuff in it. final int FLG_FEXTRA = 4; if ((this.flg & FLG_FEXTRA) == FLG_FEXTRA) { int count = readShort(in, crc); this.length +=2; this.fextra = new byte[count]; readByte(in, crc, this.fextra, 0, count); this.length += count; } // Skip file name. It ends in null. final int FLG_FNAME = 8; if ((this.flg & FLG_FNAME) == FLG_FNAME) { while (readByte(in, crc) != 0) { this.length++; } } // Skip file comment. It ends in null. final int FLG_FCOMMENT = 16; // File comment if ((this.flg & FLG_FCOMMENT) == FLG_FCOMMENT) { while (readByte(in, crc) != 0) { this.length++; } } // Check optional CRC. final int FLG_FHCRC = 2; if ((this.flg & FLG_FHCRC) == FLG_FHCRC) { int calcCrc = (int)(crc.getValue() & 0xffff); if (readShort(in, crc) != calcCrc) { throw new IOException("Bad header CRC"); } this.length += 2; } }
java
public void readHeader(InputStream in) throws IOException { CRC32 crc = new CRC32(); crc.reset(); if (!testGzipMagic(in, crc)) { throw new NoGzipMagicException(); } this.length += 2; if (readByte(in, crc) != Deflater.DEFLATED) { throw new IOException("Unknown compression"); } this.length++; // Get gzip header flag. this.flg = readByte(in, crc); this.length++; // Get MTIME. this.mtime = readInt(in, crc); this.length += 4; // Read XFL and OS. this.xfl = readByte(in, crc); this.length++; this.os = readByte(in, crc); this.length++; // Skip optional extra field -- stuff w/ alexa stuff in it. final int FLG_FEXTRA = 4; if ((this.flg & FLG_FEXTRA) == FLG_FEXTRA) { int count = readShort(in, crc); this.length +=2; this.fextra = new byte[count]; readByte(in, crc, this.fextra, 0, count); this.length += count; } // Skip file name. It ends in null. final int FLG_FNAME = 8; if ((this.flg & FLG_FNAME) == FLG_FNAME) { while (readByte(in, crc) != 0) { this.length++; } } // Skip file comment. It ends in null. final int FLG_FCOMMENT = 16; // File comment if ((this.flg & FLG_FCOMMENT) == FLG_FCOMMENT) { while (readByte(in, crc) != 0) { this.length++; } } // Check optional CRC. final int FLG_FHCRC = 2; if ((this.flg & FLG_FHCRC) == FLG_FHCRC) { int calcCrc = (int)(crc.getValue() & 0xffff); if (readShort(in, crc) != calcCrc) { throw new IOException("Bad header CRC"); } this.length += 2; } }
[ "public", "void", "readHeader", "(", "InputStream", "in", ")", "throws", "IOException", "{", "CRC32", "crc", "=", "new", "CRC32", "(", ")", ";", "crc", ".", "reset", "(", ")", ";", "if", "(", "!", "testGzipMagic", "(", "in", ",", "crc", ")", ")", "...
Read in gzip header. Advances the stream past the gzip header. @param in InputStream. @throws IOException Throws if does not start with GZIP Header.
[ "Read", "in", "gzip", "header", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/GzipHeader.java#L112-L173
36,721
iipc/webarchive-commons
src/main/java/org/archive/util/zip/GzipHeader.java
GzipHeader.readInt
private int readInt(InputStream in, CRC32 crc) throws IOException { int s = readShort(in, crc); return ((readShort(in, crc) << 16) & 0xffff0000) | s; }
java
private int readInt(InputStream in, CRC32 crc) throws IOException { int s = readShort(in, crc); return ((readShort(in, crc) << 16) & 0xffff0000) | s; }
[ "private", "int", "readInt", "(", "InputStream", "in", ",", "CRC32", "crc", ")", "throws", "IOException", "{", "int", "s", "=", "readShort", "(", "in", ",", "crc", ")", ";", "return", "(", "(", "readShort", "(", "in", ",", "crc", ")", "<<", "16", "...
Read an int. We do not expect to get a -1 reading. If we do, we throw exception. Update the crc as we go. @param in InputStream to read. @param crc CRC to update. @return int read. @throws IOException
[ "Read", "an", "int", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/GzipHeader.java#L213-L216
36,722
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.getHostBasename
public String getHostBasename() throws URIException { // caching eliminated because this is rarely used // (only benefits legacy DomainScope, which should // be retired). Saves 4-byte object pointer in UURI // instances. return (this.getReferencedHost() == null) ? null : TextUtils.replaceFirst(MASSAGEHOST_PATTERN, this.getReferencedHost(), UsableURIFactory.EMPTY_STRING); }
java
public String getHostBasename() throws URIException { // caching eliminated because this is rarely used // (only benefits legacy DomainScope, which should // be retired). Saves 4-byte object pointer in UURI // instances. return (this.getReferencedHost() == null) ? null : TextUtils.replaceFirst(MASSAGEHOST_PATTERN, this.getReferencedHost(), UsableURIFactory.EMPTY_STRING); }
[ "public", "String", "getHostBasename", "(", ")", "throws", "URIException", "{", "// caching eliminated because this is rarely used", "// (only benefits legacy DomainScope, which should", "// be retired). Saves 4-byte object pointer in UURI", "// instances.", "return", "(", "this", ".",...
Strips www variants from the host. Strips www[0-9]*\. from the host. If calling getHostBaseName becomes a performance issue we should consider adding the hostBasename member that is set on initialization. @return Host's basename. @throws URIException
[ "Strips", "www", "variants", "from", "the", "host", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L238-L247
36,723
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.coalesceUriStrings
protected void coalesceUriStrings() { if (this.cachedString != null && this.cachedEscapedURI != null && this.cachedString.length() == this.cachedEscapedURI.length()) { // lengths will only be identical if contents are identical // (deescaping will always shrink length), so coalesce to // use only single cached instance this.cachedString = this.cachedEscapedURI; } }
java
protected void coalesceUriStrings() { if (this.cachedString != null && this.cachedEscapedURI != null && this.cachedString.length() == this.cachedEscapedURI.length()) { // lengths will only be identical if contents are identical // (deescaping will always shrink length), so coalesce to // use only single cached instance this.cachedString = this.cachedEscapedURI; } }
[ "protected", "void", "coalesceUriStrings", "(", ")", "{", "if", "(", "this", ".", "cachedString", "!=", "null", "&&", "this", ".", "cachedEscapedURI", "!=", "null", "&&", "this", ".", "cachedString", ".", "length", "(", ")", "==", "this", ".", "cachedEscap...
The two String fields cachedString and cachedEscapedURI are usually identical; if so, coalesce into a single instance.
[ "The", "two", "String", "fields", "cachedString", "and", "cachedEscapedURI", "are", "usually", "identical", ";", "if", "so", "coalesce", "into", "a", "single", "instance", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L336-L344
36,724
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.coalesceHostAuthorityStrings
protected void coalesceHostAuthorityStrings() { if (this.cachedAuthorityMinusUserinfo != null && this.cachedHost != null && this.cachedHost.length() == this.cachedAuthorityMinusUserinfo.length()) { // lengths can only be identical if contents // are identical; use only one instance this.cachedAuthorityMinusUserinfo = this.cachedHost; } }
java
protected void coalesceHostAuthorityStrings() { if (this.cachedAuthorityMinusUserinfo != null && this.cachedHost != null && this.cachedHost.length() == this.cachedAuthorityMinusUserinfo.length()) { // lengths can only be identical if contents // are identical; use only one instance this.cachedAuthorityMinusUserinfo = this.cachedHost; } }
[ "protected", "void", "coalesceHostAuthorityStrings", "(", ")", "{", "if", "(", "this", ".", "cachedAuthorityMinusUserinfo", "!=", "null", "&&", "this", ".", "cachedHost", "!=", "null", "&&", "this", ".", "cachedHost", ".", "length", "(", ")", "==", "this", "...
The two String fields cachedHost and cachedAuthorityMinusUserInfo are usually identical; if so, coalesce into a single instance.
[ "The", "two", "String", "fields", "cachedHost", "and", "cachedAuthorityMinusUserInfo", "are", "usually", "identical", ";", "if", "so", "coalesce", "into", "a", "single", "instance", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L362-L371
36,725
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.getReferencedHost
public String getReferencedHost() throws URIException { String referencedHost = this.getHost(); if(referencedHost==null && this.getScheme().equals("dns")) { // extract target domain of DNS lookup String possibleHost = this.getCurrentHierPath(); if(possibleHost != null && possibleHost.matches("[-_\\w\\.:]+")) { referencedHost = possibleHost; } } return referencedHost; }
java
public String getReferencedHost() throws URIException { String referencedHost = this.getHost(); if(referencedHost==null && this.getScheme().equals("dns")) { // extract target domain of DNS lookup String possibleHost = this.getCurrentHierPath(); if(possibleHost != null && possibleHost.matches("[-_\\w\\.:]+")) { referencedHost = possibleHost; } } return referencedHost; }
[ "public", "String", "getReferencedHost", "(", ")", "throws", "URIException", "{", "String", "referencedHost", "=", "this", ".", "getHost", "(", ")", ";", "if", "(", "referencedHost", "==", "null", "&&", "this", ".", "getScheme", "(", ")", ".", "equals", "(...
Return the referenced host in the UURI, if any, also extracting the host of a DNS-lookup URI where necessary. @return the target or topic host of the URI @throws URIException
[ "Return", "the", "referenced", "host", "in", "the", "UURI", "if", "any", "also", "extracting", "the", "host", "of", "a", "DNS", "-", "lookup", "URI", "where", "necessary", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L380-L390
36,726
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.hasScheme
public static boolean hasScheme(String possibleUrl) { boolean result = false; for (int i = 0; i < possibleUrl.length(); i++) { char c = possibleUrl.charAt(i); if (c == ':') { if (i != 0) { result = true; } break; } if (!scheme.get(c)) { break; } } return result; }
java
public static boolean hasScheme(String possibleUrl) { boolean result = false; for (int i = 0; i < possibleUrl.length(); i++) { char c = possibleUrl.charAt(i); if (c == ':') { if (i != 0) { result = true; } break; } if (!scheme.get(c)) { break; } } return result; }
[ "public", "static", "boolean", "hasScheme", "(", "String", "possibleUrl", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "possibleUrl", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "...
Test if passed String has likely URI scheme prefix. @param possibleUrl URL string to examine. @return True if passed string looks like it could be an URL.
[ "Test", "if", "passed", "String", "has", "likely", "URI", "scheme", "prefix", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L461-L476
36,727
iipc/webarchive-commons
src/main/java/org/archive/format/http/HttpHeaders.java
HttpHeaders.write
public void write(OutputStream out) throws IOException { for(HttpHeader header: this) { header.write(out); } out.write(CR); out.write(LF); }
java
public void write(OutputStream out) throws IOException { for(HttpHeader header: this) { header.write(out); } out.write(CR); out.write(LF); }
[ "public", "void", "write", "(", "OutputStream", "out", ")", "throws", "IOException", "{", "for", "(", "HttpHeader", "header", ":", "this", ")", "{", "header", ".", "write", "(", "out", ")", ";", "}", "out", ".", "write", "(", "CR", ")", ";", "out", ...
Write all Headers and a trailing CRLF, CRLF @param out @throws IOException
[ "Write", "all", "Headers", "and", "a", "trailing", "CRLF", "CRLF" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/http/HttpHeaders.java#L143-L149
36,728
iipc/webarchive-commons
src/main/java/org/archive/httpclient/ThreadLocalHttpConnectionManager.java
ThreadLocalHttpConnectionManager.finishLastResponse
private static boolean finishLastResponse(final HttpConnection conn) { InputStream lastResponse = conn.getLastResponseInputStream(); if(lastResponse != null) { conn.setLastResponseInputStream(null); try { lastResponse.close(); return true; } catch (IOException ioe) { // force reconnect. return false; } } else { return false; } }
java
private static boolean finishLastResponse(final HttpConnection conn) { InputStream lastResponse = conn.getLastResponseInputStream(); if(lastResponse != null) { conn.setLastResponseInputStream(null); try { lastResponse.close(); return true; } catch (IOException ioe) { // force reconnect. return false; } } else { return false; } }
[ "private", "static", "boolean", "finishLastResponse", "(", "final", "HttpConnection", "conn", ")", "{", "InputStream", "lastResponse", "=", "conn", ".", "getLastResponseInputStream", "(", ")", ";", "if", "(", "lastResponse", "!=", "null", ")", "{", "conn", ".", ...
Since the same connection is about to be reused, make sure the previous request was completely processed, and if not consume it now. @param conn The connection @return true, if the connection is reusable
[ "Since", "the", "same", "connection", "is", "about", "to", "be", "reused", "make", "sure", "the", "previous", "request", "was", "completely", "processed", "and", "if", "not", "consume", "it", "now", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/httpclient/ThreadLocalHttpConnectionManager.java#L78-L92
36,729
iipc/webarchive-commons
src/main/java/org/archive/io/arc/ARCWriter.java
ARCWriter.generateARCFileMetaData
private byte [] generateARCFileMetaData(String date) throws IOException { if(date!=null && date.length()>14) { date = date.substring(0,14); } int metadataBodyLength = getMetadataLength(); // If metadata body, then the minor part of the version is '1' rather // than '0'. String metadataHeaderLinesTwoAndThree = getMetadataHeaderLinesTwoAndThree("1 " + ((metadataBodyLength > 0)? "1": "0")); int recordLength = metadataBodyLength + metadataHeaderLinesTwoAndThree.getBytes(DEFAULT_ENCODING).length; String metadataHeaderStr = ARC_MAGIC_NUMBER + getBaseFilename() + " 0.0.0.0 " + date + " text/plain " + recordLength + metadataHeaderLinesTwoAndThree; ByteArrayOutputStream metabaos = new ByteArrayOutputStream(recordLength); // Write the metadata header. metabaos.write(metadataHeaderStr.getBytes(DEFAULT_ENCODING)); // Write the metadata body, if anything to write. if (metadataBodyLength > 0) { writeMetaData(metabaos); } // Write out a LINE_SEPARATORs to end this record. metabaos.write(LINE_SEPARATOR); // Now get bytes of all just written and compress if flag set. byte [] bytes = metabaos.toByteArray(); if(isCompressed()) { // GZIP the header but catch the gzipping into a byte array so we // can add the special IA GZIP header to the product. After // manipulations, write to the output stream (The JAVA GZIP // implementation does not give access to GZIP header. It // produces a 'default' header only). We can get away w/ these // maniupulations because the GZIP 'default' header doesn't // do the 'optional' CRC'ing of the header. byte [] gzippedMetaData = ArchiveUtils.gzip(bytes); if (gzippedMetaData[3] != 0) { throw new IOException("The GZIP FLG header is unexpectedly " + " non-zero. Need to add smarter code that can deal " + " when already extant extra GZIP header fields."); } // Set the GZIP FLG header to '4' which says that the GZIP header // has extra fields. Then insert the alex {'L', 'X', '0', '0', '0, // '0'} 'extra' field. The IA GZIP header will also set byte // 9 (zero-based), the OS byte, to 3 (Unix). We'll do the same. gzippedMetaData[3] = 4; gzippedMetaData[9] = 3; byte [] assemblyBuffer = new byte[gzippedMetaData.length + ARC_GZIP_EXTRA_FIELD.length]; // '10' in the below is a pointer past the following bytes of the // GZIP header: ID1 ID2 CM FLG + MTIME(4-bytes) XFL OS. See // RFC1952 for explaination of the abbreviations just used. System.arraycopy(gzippedMetaData, 0, assemblyBuffer, 0, 10); System.arraycopy(ARC_GZIP_EXTRA_FIELD, 0, assemblyBuffer, 10, ARC_GZIP_EXTRA_FIELD.length); System.arraycopy(gzippedMetaData, 10, assemblyBuffer, 10 + ARC_GZIP_EXTRA_FIELD.length, gzippedMetaData.length - 10); bytes = assemblyBuffer; } return bytes; }
java
private byte [] generateARCFileMetaData(String date) throws IOException { if(date!=null && date.length()>14) { date = date.substring(0,14); } int metadataBodyLength = getMetadataLength(); // If metadata body, then the minor part of the version is '1' rather // than '0'. String metadataHeaderLinesTwoAndThree = getMetadataHeaderLinesTwoAndThree("1 " + ((metadataBodyLength > 0)? "1": "0")); int recordLength = metadataBodyLength + metadataHeaderLinesTwoAndThree.getBytes(DEFAULT_ENCODING).length; String metadataHeaderStr = ARC_MAGIC_NUMBER + getBaseFilename() + " 0.0.0.0 " + date + " text/plain " + recordLength + metadataHeaderLinesTwoAndThree; ByteArrayOutputStream metabaos = new ByteArrayOutputStream(recordLength); // Write the metadata header. metabaos.write(metadataHeaderStr.getBytes(DEFAULT_ENCODING)); // Write the metadata body, if anything to write. if (metadataBodyLength > 0) { writeMetaData(metabaos); } // Write out a LINE_SEPARATORs to end this record. metabaos.write(LINE_SEPARATOR); // Now get bytes of all just written and compress if flag set. byte [] bytes = metabaos.toByteArray(); if(isCompressed()) { // GZIP the header but catch the gzipping into a byte array so we // can add the special IA GZIP header to the product. After // manipulations, write to the output stream (The JAVA GZIP // implementation does not give access to GZIP header. It // produces a 'default' header only). We can get away w/ these // maniupulations because the GZIP 'default' header doesn't // do the 'optional' CRC'ing of the header. byte [] gzippedMetaData = ArchiveUtils.gzip(bytes); if (gzippedMetaData[3] != 0) { throw new IOException("The GZIP FLG header is unexpectedly " + " non-zero. Need to add smarter code that can deal " + " when already extant extra GZIP header fields."); } // Set the GZIP FLG header to '4' which says that the GZIP header // has extra fields. Then insert the alex {'L', 'X', '0', '0', '0, // '0'} 'extra' field. The IA GZIP header will also set byte // 9 (zero-based), the OS byte, to 3 (Unix). We'll do the same. gzippedMetaData[3] = 4; gzippedMetaData[9] = 3; byte [] assemblyBuffer = new byte[gzippedMetaData.length + ARC_GZIP_EXTRA_FIELD.length]; // '10' in the below is a pointer past the following bytes of the // GZIP header: ID1 ID2 CM FLG + MTIME(4-bytes) XFL OS. See // RFC1952 for explaination of the abbreviations just used. System.arraycopy(gzippedMetaData, 0, assemblyBuffer, 0, 10); System.arraycopy(ARC_GZIP_EXTRA_FIELD, 0, assemblyBuffer, 10, ARC_GZIP_EXTRA_FIELD.length); System.arraycopy(gzippedMetaData, 10, assemblyBuffer, 10 + ARC_GZIP_EXTRA_FIELD.length, gzippedMetaData.length - 10); bytes = assemblyBuffer; } return bytes; }
[ "private", "byte", "[", "]", "generateARCFileMetaData", "(", "String", "date", ")", "throws", "IOException", "{", "if", "(", "date", "!=", "null", "&&", "date", ".", "length", "(", ")", ">", "14", ")", "{", "date", "=", "date", ".", "substring", "(", ...
Write out the ARCMetaData. <p>Generate ARC file meta data. Currently we only do version 1 of the ARC file formats or version 1.1 when metadata has been supplied (We write it into the body of the first record in the arc file). <p>Version 1 metadata looks roughly like this: <pre>filedesc://testWriteRecord-JunitIAH20040110013326-2.arc 0.0.0.0 \\ 20040110013326 text/plain 77 1 0 InternetArchive URL IP-address Archive-date Content-type Archive-length </pre> <p>If compress is set, then we generate a header that has been gzipped in the Internet Archive manner. Such a gzipping enables the FEXTRA flag in the FLG field of the gzip header. It then appends an extra header field: '8', '0', 'L', 'X', '0', '0', '0', '0'. The first two bytes are the length of the field and the last 6 bytes the Internet Archive header. To learn about GZIP format, see RFC1952. To learn about the Internet Archive extra header field, read the source for av_ziparc which can be found at <code>alexa/vista/alexa-tools-1.2/src/av_ziparc.cc</code>. <p>We do things in this roundabout manner because the java GZIPOutputStream does not give access to GZIP header fields. @param date Date to put into the ARC metadata; if 17-digit will be truncated to traditional 14-digits @return Byte array filled w/ the arc header. @throws IOException
[ "Write", "out", "the", "ARCMetaData", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/arc/ARCWriter.java#L202-L266
36,730
iipc/webarchive-commons
src/main/java/org/archive/io/arc/ARCWriter.java
ARCWriter.validateMetaLine
protected String validateMetaLine(String metaLineStr) throws IOException { if (metaLineStr.length() > MAX_METADATA_LINE_LENGTH) { throw new IOException("Metadata line too long (" + metaLineStr.length() + ">" + MAX_METADATA_LINE_LENGTH + "): " + metaLineStr); } Matcher m = METADATA_LINE_PATTERN.matcher(metaLineStr); if (!m.matches()) { throw new IOException("Metadata line doesn't match expected" + " pattern: " + metaLineStr); } return metaLineStr; }
java
protected String validateMetaLine(String metaLineStr) throws IOException { if (metaLineStr.length() > MAX_METADATA_LINE_LENGTH) { throw new IOException("Metadata line too long (" + metaLineStr.length() + ">" + MAX_METADATA_LINE_LENGTH + "): " + metaLineStr); } Matcher m = METADATA_LINE_PATTERN.matcher(metaLineStr); if (!m.matches()) { throw new IOException("Metadata line doesn't match expected" + " pattern: " + metaLineStr); } return metaLineStr; }
[ "protected", "String", "validateMetaLine", "(", "String", "metaLineStr", ")", "throws", "IOException", "{", "if", "(", "metaLineStr", ".", "length", "(", ")", ">", "MAX_METADATA_LINE_LENGTH", ")", "{", "throw", "new", "IOException", "(", "\"Metadata line too long (\...
Test that the metadata line is valid before writing. @param metaLineStr @throws IOException @return The passed in metaline.
[ "Test", "that", "the", "metadata", "line", "is", "valid", "before", "writing", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/arc/ARCWriter.java#L445-L458
36,731
iipc/webarchive-commons
src/main/java/org/archive/format/warc/WARCRecordWriter.java
WARCRecordWriter.writeRecord
private void writeRecord( OutputStream out, HttpHeaders headers, byte[] contents) throws IOException { if ( contents == null ) { headers.add(CONTENT_LENGTH, "0"); } else { headers.add(CONTENT_LENGTH,String.valueOf(contents.length)); } out.write(WARC_ID.getBytes(DEFAULT_ENCODING)); out.write(CR); out.write(LF); // NOTE: HttpHeaders.write() method includes the trailing CRLF. // So we don't need to write it out here. headers.write(out); if ( contents != null ) { out.write( contents ); } // Emit the 2 trailing CRLF sequences. out.write(CR); out.write(LF); out.write(CR); out.write(LF); }
java
private void writeRecord( OutputStream out, HttpHeaders headers, byte[] contents) throws IOException { if ( contents == null ) { headers.add(CONTENT_LENGTH, "0"); } else { headers.add(CONTENT_LENGTH,String.valueOf(contents.length)); } out.write(WARC_ID.getBytes(DEFAULT_ENCODING)); out.write(CR); out.write(LF); // NOTE: HttpHeaders.write() method includes the trailing CRLF. // So we don't need to write it out here. headers.write(out); if ( contents != null ) { out.write( contents ); } // Emit the 2 trailing CRLF sequences. out.write(CR); out.write(LF); out.write(CR); out.write(LF); }
[ "private", "void", "writeRecord", "(", "OutputStream", "out", ",", "HttpHeaders", "headers", ",", "byte", "[", "]", "contents", ")", "throws", "IOException", "{", "if", "(", "contents", "==", "null", ")", "{", "headers", ".", "add", "(", "CONTENT_LENGTH", ...
Write the headers and contents as a WARC record to the given output stream. WARC record format: <pre>warc-file = 1*warc-record warc-record = header CRLF block CRLF CRLF header = version warc-fields version = "WARC/0.18" CRLF warc-fields = *named-field CRLF block = *OCTET</pre>
[ "Write", "the", "headers", "and", "contents", "as", "a", "WARC", "record", "to", "the", "given", "output", "stream", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/warc/WARCRecordWriter.java#L29-L60
36,732
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveReaderFactory.java
ArchiveReaderFactory.get
public static ArchiveReader get(final String arcFileOrUrl) throws MalformedURLException, IOException { return ArchiveReaderFactory.factory.getArchiveReader(arcFileOrUrl); }
java
public static ArchiveReader get(final String arcFileOrUrl) throws MalformedURLException, IOException { return ArchiveReaderFactory.factory.getArchiveReader(arcFileOrUrl); }
[ "public", "static", "ArchiveReader", "get", "(", "final", "String", "arcFileOrUrl", ")", "throws", "MalformedURLException", ",", "IOException", "{", "return", "ArchiveReaderFactory", ".", "factory", ".", "getArchiveReader", "(", "arcFileOrUrl", ")", ";", "}" ]
Get an Archive file Reader on passed path or url. Does primitive heuristic figuring if path or URL. @param arcFileOrUrl File path or URL pointing at an Archive file. @return An Archive file Reader. @throws IOException @throws MalformedURLException @throws IOException
[ "Get", "an", "Archive", "file", "Reader", "on", "passed", "path", "or", "url", ".", "Does", "primitive", "heuristic", "figuring", "if", "path", "or", "URL", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveReaderFactory.java#L74-L77
36,733
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.getIntegerValue
public int getIntegerValue() throws IOException, SaneException { // check for type agreement Preconditions.checkState(getValueType() == OptionValueType.INT, "option is not an integer"); Preconditions.checkState(getValueCount() == 1, "option is an integer array, not integer"); // Send RCP corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = readOption(); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState( result.getValueSize() == SaneWord.SIZE_IN_BYTES, "unexpected value size " + result.getValueSize() + ", expecting " + SaneWord.SIZE_IN_BYTES); // TODO: handle resource authorisation // TODO: check status -- may have to reload options!! return SaneWord.fromBytes(result.getValue()).integerValue(); // the // value }
java
public int getIntegerValue() throws IOException, SaneException { // check for type agreement Preconditions.checkState(getValueType() == OptionValueType.INT, "option is not an integer"); Preconditions.checkState(getValueCount() == 1, "option is an integer array, not integer"); // Send RCP corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = readOption(); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState( result.getValueSize() == SaneWord.SIZE_IN_BYTES, "unexpected value size " + result.getValueSize() + ", expecting " + SaneWord.SIZE_IN_BYTES); // TODO: handle resource authorisation // TODO: check status -- may have to reload options!! return SaneWord.fromBytes(result.getValue()).integerValue(); // the // value }
[ "public", "int", "getIntegerValue", "(", ")", "throws", "IOException", ",", "SaneException", "{", "// check for type agreement", "Preconditions", ".", "checkState", "(", "getValueType", "(", ")", "==", "OptionValueType", ".", "INT", ",", "\"option is not an integer\"", ...
Reads the current Integer value option. We do not cache value from previous get or set operations so each get involves a round trip to the server. TODO: consider caching the returned value for "fast read" later @return the value of the option @throws IOException if a problem occurred while talking to SANE
[ "Reads", "the", "current", "Integer", "value", "option", ".", "We", "do", "not", "cache", "value", "from", "previous", "get", "or", "set", "operations", "so", "each", "get", "involves", "a", "round", "trip", "to", "the", "server", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L343-L364
36,734
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.setBooleanValue
public boolean setBooleanValue(boolean value) throws IOException, SaneException { ControlOptionResult result = writeOption(SaneWord.forInt(value ? 1 : 0)); Preconditions.checkState(result.getType() == OptionValueType.BOOLEAN); return SaneWord.fromBytes(result.getValue()).integerValue() != 0; }
java
public boolean setBooleanValue(boolean value) throws IOException, SaneException { ControlOptionResult result = writeOption(SaneWord.forInt(value ? 1 : 0)); Preconditions.checkState(result.getType() == OptionValueType.BOOLEAN); return SaneWord.fromBytes(result.getValue()).integerValue() != 0; }
[ "public", "boolean", "setBooleanValue", "(", "boolean", "value", ")", "throws", "IOException", ",", "SaneException", "{", "ControlOptionResult", "result", "=", "writeOption", "(", "SaneWord", ".", "forInt", "(", "value", "?", "1", ":", "0", ")", ")", ";", "P...
Sets the value of the current option to the supplied boolean value. Option value must be of boolean type. SANE may ignore your preference, so if you need to ensure the value has been set correctly, you should examine the return value of this method. @return the value that the option now has according to SANE
[ "Sets", "the", "value", "of", "the", "current", "option", "to", "the", "supplied", "boolean", "value", ".", "Option", "value", "must", "be", "of", "boolean", "type", ".", "SANE", "may", "ignore", "your", "preference", "so", "if", "you", "need", "to", "en...
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L473-L478
36,735
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.setFixedValue
public double setFixedValue(double value) throws IOException, SaneException { Preconditions.checkArgument( value >= -32768 && value <= 32767.9999, "value " + value + " is out of range"); SaneWord wordValue = SaneWord.forFixedPrecision(value); ControlOptionResult result = writeOption(wordValue); Preconditions.checkState( result.getType() == OptionValueType.FIXED, "setFixedValue is not appropriate for option of type " + result.getType()); return SaneWord.fromBytes(result.getValue()).fixedPrecisionValue(); }
java
public double setFixedValue(double value) throws IOException, SaneException { Preconditions.checkArgument( value >= -32768 && value <= 32767.9999, "value " + value + " is out of range"); SaneWord wordValue = SaneWord.forFixedPrecision(value); ControlOptionResult result = writeOption(wordValue); Preconditions.checkState( result.getType() == OptionValueType.FIXED, "setFixedValue is not appropriate for option of type " + result.getType()); return SaneWord.fromBytes(result.getValue()).fixedPrecisionValue(); }
[ "public", "double", "setFixedValue", "(", "double", "value", ")", "throws", "IOException", ",", "SaneException", "{", "Preconditions", ".", "checkArgument", "(", "value", ">=", "-", "32768", "&&", "value", "<=", "32767.9999", ",", "\"value \"", "+", "value", "...
Sets the value of the current option to the supplied fixed-precision value. Option value must be of fixed-precision type.
[ "Sets", "the", "value", "of", "the", "current", "option", "to", "the", "supplied", "fixed", "-", "precision", "value", ".", "Option", "value", "must", "be", "of", "fixed", "-", "precision", "type", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L488-L498
36,736
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.setIntegerValue
public int setIntegerValue(int newValue) throws IOException, SaneException { Preconditions.checkState(getValueCount() == 1, "option is an array"); // check that this option is readable Preconditions.checkState(isWriteable()); // Send RPC corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = writeOption(ImmutableList.of(newValue)); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState(result.getValueSize() == SaneWord.SIZE_IN_BYTES); return SaneWord.fromBytes(result.getValue()).integerValue(); }
java
public int setIntegerValue(int newValue) throws IOException, SaneException { Preconditions.checkState(getValueCount() == 1, "option is an array"); // check that this option is readable Preconditions.checkState(isWriteable()); // Send RPC corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = writeOption(ImmutableList.of(newValue)); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState(result.getValueSize() == SaneWord.SIZE_IN_BYTES); return SaneWord.fromBytes(result.getValue()).integerValue(); }
[ "public", "int", "setIntegerValue", "(", "int", "newValue", ")", "throws", "IOException", ",", "SaneException", "{", "Preconditions", ".", "checkState", "(", "getValueCount", "(", ")", "==", "1", ",", "\"option is an array\"", ")", ";", "// check that this option is...
Set the value of the current option to the supplied value. Option value must be of integer type TODO: consider caching the returned value for "fast read" later @param newValue for the option @return the value actually set @throws IOException
[ "Set", "the", "value", "of", "the", "current", "option", "to", "the", "supplied", "value", ".", "Option", "value", "must", "be", "of", "integer", "type" ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L571-L588
36,737
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneDevice.java
SaneDevice.close
@Override public void close() throws IOException { if (!isOpen()) { throw new IOException("device is already closed"); } session.closeDevice(handle); handle = null; }
java
@Override public void close() throws IOException { if (!isOpen()) { throw new IOException("device is already closed"); } session.closeDevice(handle); handle = null; }
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "!", "isOpen", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"device is already closed\"", ")", ";", "}", "session", ".", "closeDevice", "(", "handle...
Closes the device. @throws IOException if an error occurs talking to the SANE backend @throws IllegalStateException if the device is already closed
[ "Closes", "the", "device", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneDevice.java#L130-L138
36,738
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneDevice.java
SaneDevice.listOptions
public List<SaneOption> listOptions() throws IOException { if (optionTitleMap == null) { groups.clear(); optionTitleMap = Maps.uniqueIndex( SaneOption.optionsFor(this), new Function<SaneOption, String>() { @Override public String apply(SaneOption input) { return input.getName(); } }); } // Maps.uniqueIndex guarantees the order of optionTitleMap.values() return ImmutableList.copyOf(optionTitleMap.values()); }
java
public List<SaneOption> listOptions() throws IOException { if (optionTitleMap == null) { groups.clear(); optionTitleMap = Maps.uniqueIndex( SaneOption.optionsFor(this), new Function<SaneOption, String>() { @Override public String apply(SaneOption input) { return input.getName(); } }); } // Maps.uniqueIndex guarantees the order of optionTitleMap.values() return ImmutableList.copyOf(optionTitleMap.values()); }
[ "public", "List", "<", "SaneOption", ">", "listOptions", "(", ")", "throws", "IOException", "{", "if", "(", "optionTitleMap", "==", "null", ")", "{", "groups", ".", "clear", "(", ")", ";", "optionTitleMap", "=", "Maps", ".", "uniqueIndex", "(", "SaneOption...
Returns the list of options applicable to this device. @return a list of {@link SaneOption} instances @throws IOException if a problem occurred talking to the SANE backend
[ "Returns", "the", "list", "of", "options", "applicable", "to", "this", "device", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneDevice.java#L167-L183
36,739
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/OptionGroup.java
OptionGroup.addOption
void addOption(SaneOption option) { Preconditions.checkState(option.getGroup() == this); options.add(option); }
java
void addOption(SaneOption option) { Preconditions.checkState(option.getGroup() == this); options.add(option); }
[ "void", "addOption", "(", "SaneOption", "option", ")", "{", "Preconditions", ".", "checkState", "(", "option", ".", "getGroup", "(", ")", "==", "this", ")", ";", "options", ".", "add", "(", "option", ")", ";", "}" ]
Adds an option to the group.
[ "Adds", "an", "option", "to", "the", "group", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/OptionGroup.java#L42-L45
36,740
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.withRemoteSane
public static SaneSession withRemoteSane(InetAddress saneAddress, int port) throws IOException { return withRemoteSane(saneAddress, port, 0, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS); }
java
public static SaneSession withRemoteSane(InetAddress saneAddress, int port) throws IOException { return withRemoteSane(saneAddress, port, 0, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS); }
[ "public", "static", "SaneSession", "withRemoteSane", "(", "InetAddress", "saneAddress", ",", "int", "port", ")", "throws", "IOException", "{", "return", "withRemoteSane", "(", "saneAddress", ",", "port", ",", "0", ",", "TimeUnit", ".", "MILLISECONDS", ",", "0", ...
Establishes a connection to the SANE daemon running on the given host on the given port with no connection timeout.
[ "Establishes", "a", "connection", "to", "the", "SANE", "daemon", "running", "on", "the", "given", "host", "on", "the", "given", "port", "with", "no", "connection", "timeout", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L86-L88
36,741
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.listDevices
public List<SaneDevice> listDevices() throws IOException, SaneException { outputStream.write(SaneRpcCode.SANE_NET_GET_DEVICES); outputStream.flush(); return inputStream.readDeviceList(); }
java
public List<SaneDevice> listDevices() throws IOException, SaneException { outputStream.write(SaneRpcCode.SANE_NET_GET_DEVICES); outputStream.flush(); return inputStream.readDeviceList(); }
[ "public", "List", "<", "SaneDevice", ">", "listDevices", "(", ")", "throws", "IOException", ",", "SaneException", "{", "outputStream", ".", "write", "(", "SaneRpcCode", ".", "SANE_NET_GET_DEVICES", ")", ";", "outputStream", ".", "flush", "(", ")", ";", "return...
Lists the devices known to the SANE daemon. @return a list of devices that may be opened, see {@link SaneDevice#open} @throws IOException if an error occurs while communicating with the SANE daemon @throws SaneException if the SANE backend returns an error in response to this request
[ "Lists", "the", "devices", "known", "to", "the", "SANE", "daemon", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L160-L164
36,742
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.close
@Override public void close() throws IOException { try { outputStream.write(SaneRpcCode.SANE_NET_EXIT); outputStream.close(); } finally { socket.close(); } }
java
@Override public void close() throws IOException { try { outputStream.write(SaneRpcCode.SANE_NET_EXIT); outputStream.close(); } finally { socket.close(); } }
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "try", "{", "outputStream", ".", "write", "(", "SaneRpcCode", ".", "SANE_NET_EXIT", ")", ";", "outputStream", ".", "close", "(", ")", ";", "}", "finally", "{", "socket", ...
Closes the connection to the SANE server. This is done immediately by closing the socket. @throws IOException if an error occurred while closing the connection
[ "Closes", "the", "connection", "to", "the", "SANE", "server", ".", "This", "is", "done", "immediately", "by", "closing", "the", "socket", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L171-L179
36,743
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.authorize
boolean authorize(String resource) throws IOException { if (passwordProvider == null) { throw new IOException( "Authorization failed - no password provider present " + "(you must call setPasswordProvider)"); } if (passwordProvider.canAuthenticate(resource)) { // RPC code FOR SANE_NET_AUTHORIZE outputStream.write(SaneRpcCode.SANE_NET_AUTHORIZE); outputStream.write(resource); outputStream.write(passwordProvider.getUsername(resource)); writePassword(resource, passwordProvider.getPassword(resource)); outputStream.flush(); // Read dummy reply and discard (according to the spec, it is unused). inputStream.readWord(); return true; } return false; }
java
boolean authorize(String resource) throws IOException { if (passwordProvider == null) { throw new IOException( "Authorization failed - no password provider present " + "(you must call setPasswordProvider)"); } if (passwordProvider.canAuthenticate(resource)) { // RPC code FOR SANE_NET_AUTHORIZE outputStream.write(SaneRpcCode.SANE_NET_AUTHORIZE); outputStream.write(resource); outputStream.write(passwordProvider.getUsername(resource)); writePassword(resource, passwordProvider.getPassword(resource)); outputStream.flush(); // Read dummy reply and discard (according to the spec, it is unused). inputStream.readWord(); return true; } return false; }
[ "boolean", "authorize", "(", "String", "resource", ")", "throws", "IOException", "{", "if", "(", "passwordProvider", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Authorization failed - no password provider present \"", "+", "\"(you must call setPasswordP...
Authorize the resource for access. @throws IOException if an error occurs while communicating with the SANE daemon
[ "Authorize", "the", "resource", "for", "access", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L345-L366
36,744
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.writePassword
private void writePassword(String resource, String password) throws IOException { String[] resourceParts = resource.split("\\$MD5\\$"); if (resourceParts.length == 1) { // Write in clean outputStream.write(password); } else { outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password)); } }
java
private void writePassword(String resource, String password) throws IOException { String[] resourceParts = resource.split("\\$MD5\\$"); if (resourceParts.length == 1) { // Write in clean outputStream.write(password); } else { outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password)); } }
[ "private", "void", "writePassword", "(", "String", "resource", ",", "String", "password", ")", "throws", "IOException", "{", "String", "[", "]", "resourceParts", "=", "resource", ".", "split", "(", "\"\\\\$MD5\\\\$\"", ")", ";", "if", "(", "resourceParts", "."...
Write password to outputstream depending on resource provided by saned. @param resource as provided by sane in authorization request @param password @throws IOException
[ "Write", "password", "to", "outputstream", "depending", "on", "resource", "provided", "by", "saned", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L375-L383
36,745
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlay.java
FeatureOverlay.ignoreTileDao
public void ignoreTileDao(TileDao tileDao) { GeoPackageOverlay tileOverlay = new GeoPackageOverlay(tileDao); linkedOverlays.add(tileOverlay); }
java
public void ignoreTileDao(TileDao tileDao) { GeoPackageOverlay tileOverlay = new GeoPackageOverlay(tileDao); linkedOverlays.add(tileOverlay); }
[ "public", "void", "ignoreTileDao", "(", "TileDao", "tileDao", ")", "{", "GeoPackageOverlay", "tileOverlay", "=", "new", "GeoPackageOverlay", "(", "tileDao", ")", ";", "linkedOverlays", ".", "add", "(", "tileOverlay", ")", ";", "}" ]
Ignore drawing tiles if they exist in the tile table represented by the tile dao @param tileDao tile data access object @since 1.2.6
[ "Ignore", "drawing", "tiles", "if", "they", "exist", "in", "the", "tile", "table", "represented", "by", "the", "tile", "dao" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlay.java#L112-L116
36,746
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.simplifyPoints
private List<Point> simplifyPoints(List<Point> points) { List<Point> simplifiedPoints = null; if (simplifyTolerance != null) { // Reproject to web mercator if not in meters if (projection != null && !projection.isUnit(Units.METRES)) { points = toWebMercator.transform(points); } // Simplify the points simplifiedPoints = GeometryUtils.simplifyPoints(points, simplifyTolerance); // Reproject back to the original projection if (projection != null && !projection.isUnit(Units.METRES)) { simplifiedPoints = fromWebMercator.transform(simplifiedPoints); } } else { simplifiedPoints = points; } return simplifiedPoints; }
java
private List<Point> simplifyPoints(List<Point> points) { List<Point> simplifiedPoints = null; if (simplifyTolerance != null) { // Reproject to web mercator if not in meters if (projection != null && !projection.isUnit(Units.METRES)) { points = toWebMercator.transform(points); } // Simplify the points simplifiedPoints = GeometryUtils.simplifyPoints(points, simplifyTolerance); // Reproject back to the original projection if (projection != null && !projection.isUnit(Units.METRES)) { simplifiedPoints = fromWebMercator.transform(simplifiedPoints); } } else { simplifiedPoints = points; } return simplifiedPoints; }
[ "private", "List", "<", "Point", ">", "simplifyPoints", "(", "List", "<", "Point", ">", "points", ")", "{", "List", "<", "Point", ">", "simplifiedPoints", "=", "null", ";", "if", "(", "simplifyTolerance", "!=", "null", ")", "{", "// Reproject to web mercator...
When the simplify tolerance is set, simplify the points to a similar curve with fewer points. @param points ordered points @return simplified points
[ "When", "the", "simplify", "tolerance", "is", "set", "simplify", "the", "points", "to", "a", "similar", "curve", "with", "fewer", "points", "." ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L565-L588
36,747
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.getOrientation
public PolygonOrientation getOrientation(List<LatLng> points) { return SphericalUtil.computeSignedArea(points) >= 0 ? PolygonOrientation.COUNTERCLOCKWISE : PolygonOrientation.CLOCKWISE; }
java
public PolygonOrientation getOrientation(List<LatLng> points) { return SphericalUtil.computeSignedArea(points) >= 0 ? PolygonOrientation.COUNTERCLOCKWISE : PolygonOrientation.CLOCKWISE; }
[ "public", "PolygonOrientation", "getOrientation", "(", "List", "<", "LatLng", ">", "points", ")", "{", "return", "SphericalUtil", ".", "computeSignedArea", "(", "points", ")", ">=", "0", "?", "PolygonOrientation", ".", "COUNTERCLOCKWISE", ":", "PolygonOrientation", ...
Determine the closed points orientation @param points closed points @return orientation @since 1.3.2
[ "Determine", "the", "closed", "points", "orientation" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L728-L730
36,748
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addShapeToMap
public static GoogleMapShape addShapeToMap(GoogleMap map, GoogleMapShape shape) { GoogleMapShape addedShape = null; switch (shape.getShapeType()) { case LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addLatLngToMap(map, (LatLng) shape.getShape())); break; case MARKER_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addMarkerOptionsToMap(map, (MarkerOptions) shape.getShape())); break; case POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYLINE, addPolylineToMap(map, (PolylineOptions) shape.getShape())); break; case POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYGON, addPolygonToMap(map, (PolygonOptions) shape.getShape())); break; case MULTI_LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_MARKER, addLatLngsToMap(map, (MultiLatLng) shape.getShape())); break; case MULTI_POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYLINE, addPolylinesToMap(map, (MultiPolylineOptions) shape.getShape())); break; case MULTI_POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYGON, addPolygonsToMap(map, (MultiPolygonOptions) shape.getShape())); break; case COLLECTION: List<GoogleMapShape> addedShapeList = new ArrayList<GoogleMapShape>(); @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape .getShape(); for (GoogleMapShape shapeListItem : shapeList) { addedShapeList.add(addShapeToMap(map, shapeListItem)); } addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.COLLECTION, addedShapeList); break; default: throw new GeoPackageException("Unsupported Shape Type: " + shape.getShapeType()); } return addedShape; }
java
public static GoogleMapShape addShapeToMap(GoogleMap map, GoogleMapShape shape) { GoogleMapShape addedShape = null; switch (shape.getShapeType()) { case LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addLatLngToMap(map, (LatLng) shape.getShape())); break; case MARKER_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addMarkerOptionsToMap(map, (MarkerOptions) shape.getShape())); break; case POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYLINE, addPolylineToMap(map, (PolylineOptions) shape.getShape())); break; case POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYGON, addPolygonToMap(map, (PolygonOptions) shape.getShape())); break; case MULTI_LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_MARKER, addLatLngsToMap(map, (MultiLatLng) shape.getShape())); break; case MULTI_POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYLINE, addPolylinesToMap(map, (MultiPolylineOptions) shape.getShape())); break; case MULTI_POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYGON, addPolygonsToMap(map, (MultiPolygonOptions) shape.getShape())); break; case COLLECTION: List<GoogleMapShape> addedShapeList = new ArrayList<GoogleMapShape>(); @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape .getShape(); for (GoogleMapShape shapeListItem : shapeList) { addedShapeList.add(addShapeToMap(map, shapeListItem)); } addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.COLLECTION, addedShapeList); break; default: throw new GeoPackageException("Unsupported Shape Type: " + shape.getShapeType()); } return addedShape; }
[ "public", "static", "GoogleMapShape", "addShapeToMap", "(", "GoogleMap", "map", ",", "GoogleMapShape", "shape", ")", "{", "GoogleMapShape", "addedShape", "=", "null", ";", "switch", "(", "shape", ".", "getShapeType", "(", ")", ")", "{", "case", "LAT_LNG", ":",...
Add a shape to the map @param map google map @param shape google map shape @return google map shape
[ "Add", "a", "shape", "to", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1464-L1524
36,749
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPolygonsToMap
public static mil.nga.geopackage.map.geom.MultiPolygon addPolygonsToMap( GoogleMap map, MultiPolygonOptions polygons) { mil.nga.geopackage.map.geom.MultiPolygon multiPolygon = new mil.nga.geopackage.map.geom.MultiPolygon(); for (PolygonOptions polygonOption : polygons.getPolygonOptions()) { if (polygons.getOptions() != null) { polygonOption.fillColor(polygons.getOptions().getFillColor()); polygonOption.strokeColor(polygons.getOptions() .getStrokeColor()); polygonOption.geodesic(polygons.getOptions().isGeodesic()); polygonOption.visible(polygons.getOptions().isVisible()); polygonOption.zIndex(polygons.getOptions().getZIndex()); polygonOption.strokeWidth(polygons.getOptions().getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOption); multiPolygon.add(polygon); } return multiPolygon; }
java
public static mil.nga.geopackage.map.geom.MultiPolygon addPolygonsToMap( GoogleMap map, MultiPolygonOptions polygons) { mil.nga.geopackage.map.geom.MultiPolygon multiPolygon = new mil.nga.geopackage.map.geom.MultiPolygon(); for (PolygonOptions polygonOption : polygons.getPolygonOptions()) { if (polygons.getOptions() != null) { polygonOption.fillColor(polygons.getOptions().getFillColor()); polygonOption.strokeColor(polygons.getOptions() .getStrokeColor()); polygonOption.geodesic(polygons.getOptions().isGeodesic()); polygonOption.visible(polygons.getOptions().isVisible()); polygonOption.zIndex(polygons.getOptions().getZIndex()); polygonOption.strokeWidth(polygons.getOptions().getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOption); multiPolygon.add(polygon); } return multiPolygon; }
[ "public", "static", "mil", ".", "nga", ".", "geopackage", ".", "map", ".", "geom", ".", "MultiPolygon", "addPolygonsToMap", "(", "GoogleMap", "map", ",", "MultiPolygonOptions", "polygons", ")", "{", "mil", ".", "nga", ".", "geopackage", ".", "map", ".", "g...
Add a list of Polygons to the map @param map google map @param polygons multi polygon options @return multi polygon
[ "Add", "a", "list", "of", "Polygons", "to", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1643-L1661
36,750
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPointsToMapAsMarkers
public List<Marker> addPointsToMapAsMarkers(GoogleMap map, List<LatLng> points, MarkerOptions customMarkerOptions, boolean ignoreIdenticalEnds) { List<Marker> markers = new ArrayList<Marker>(); for (int i = 0; i < points.size(); i++) { LatLng latLng = points.get(i); if (points.size() > 1 && i + 1 == points.size() && ignoreIdenticalEnds) { LatLng firstLatLng = points.get(0); if (latLng.latitude == firstLatLng.latitude && latLng.longitude == firstLatLng.longitude) { break; } } MarkerOptions markerOptions = new MarkerOptions(); if (customMarkerOptions != null) { markerOptions.icon(customMarkerOptions.getIcon()); markerOptions.anchor(customMarkerOptions.getAnchorU(), customMarkerOptions.getAnchorV()); markerOptions.draggable(customMarkerOptions.isDraggable()); markerOptions.visible(customMarkerOptions.isVisible()); markerOptions.zIndex(customMarkerOptions.getZIndex()); } Marker marker = addLatLngToMap(map, latLng, markerOptions); markers.add(marker); } return markers; }
java
public List<Marker> addPointsToMapAsMarkers(GoogleMap map, List<LatLng> points, MarkerOptions customMarkerOptions, boolean ignoreIdenticalEnds) { List<Marker> markers = new ArrayList<Marker>(); for (int i = 0; i < points.size(); i++) { LatLng latLng = points.get(i); if (points.size() > 1 && i + 1 == points.size() && ignoreIdenticalEnds) { LatLng firstLatLng = points.get(0); if (latLng.latitude == firstLatLng.latitude && latLng.longitude == firstLatLng.longitude) { break; } } MarkerOptions markerOptions = new MarkerOptions(); if (customMarkerOptions != null) { markerOptions.icon(customMarkerOptions.getIcon()); markerOptions.anchor(customMarkerOptions.getAnchorU(), customMarkerOptions.getAnchorV()); markerOptions.draggable(customMarkerOptions.isDraggable()); markerOptions.visible(customMarkerOptions.isVisible()); markerOptions.zIndex(customMarkerOptions.getZIndex()); } Marker marker = addLatLngToMap(map, latLng, markerOptions); markers.add(marker); } return markers; }
[ "public", "List", "<", "Marker", ">", "addPointsToMapAsMarkers", "(", "GoogleMap", "map", ",", "List", "<", "LatLng", ">", "points", ",", "MarkerOptions", "customMarkerOptions", ",", "boolean", "ignoreIdenticalEnds", ")", "{", "List", "<", "Marker", ">", "marker...
Add the list of points as markers @param map google map @param points points @param customMarkerOptions custom marker options @param ignoreIdenticalEnds ignore identical ends flag @return list of markers
[ "Add", "the", "list", "of", "points", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1817-L1846
36,751
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPolylineToMapAsMarkers
public PolylineMarkers addPolylineToMapAsMarkers(GoogleMap map, PolylineOptions polylineOptions, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { PolylineMarkers polylineMarkers = new PolylineMarkers(this); if (globalPolylineOptions != null) { polylineOptions.color(globalPolylineOptions.getColor()); polylineOptions.geodesic(globalPolylineOptions.isGeodesic()); polylineOptions.visible(globalPolylineOptions.isVisible()); polylineOptions.zIndex(globalPolylineOptions.getZIndex()); polylineOptions.width(globalPolylineOptions.getWidth()); } Polyline polyline = addPolylineToMap(map, polylineOptions); polylineMarkers.setPolyline(polyline); List<Marker> markers = addPointsToMapAsMarkers(map, polylineOptions.getPoints(), polylineMarkerOptions, false); polylineMarkers.setMarkers(markers); return polylineMarkers; }
java
public PolylineMarkers addPolylineToMapAsMarkers(GoogleMap map, PolylineOptions polylineOptions, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { PolylineMarkers polylineMarkers = new PolylineMarkers(this); if (globalPolylineOptions != null) { polylineOptions.color(globalPolylineOptions.getColor()); polylineOptions.geodesic(globalPolylineOptions.isGeodesic()); polylineOptions.visible(globalPolylineOptions.isVisible()); polylineOptions.zIndex(globalPolylineOptions.getZIndex()); polylineOptions.width(globalPolylineOptions.getWidth()); } Polyline polyline = addPolylineToMap(map, polylineOptions); polylineMarkers.setPolyline(polyline); List<Marker> markers = addPointsToMapAsMarkers(map, polylineOptions.getPoints(), polylineMarkerOptions, false); polylineMarkers.setMarkers(markers); return polylineMarkers; }
[ "public", "PolylineMarkers", "addPolylineToMapAsMarkers", "(", "GoogleMap", "map", ",", "PolylineOptions", "polylineOptions", ",", "MarkerOptions", "polylineMarkerOptions", ",", "PolylineOptions", "globalPolylineOptions", ")", "{", "PolylineMarkers", "polylineMarkers", "=", "...
Add a Polyline to the map as markers @param map google map @param polylineOptions polyline options @param polylineMarkerOptions polyline marker options @param globalPolylineOptions global polyline options @return polyline markers
[ "Add", "a", "Polyline", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1857-L1880
36,752
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPolygonToMapAsMarkers
public PolygonMarkers addPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, PolygonOptions polygonOptions, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { PolygonMarkers polygonMarkers = new PolygonMarkers(this); if (globalPolygonOptions != null) { polygonOptions.fillColor(globalPolygonOptions.getFillColor()); polygonOptions.strokeColor(globalPolygonOptions.getStrokeColor()); polygonOptions.geodesic(globalPolygonOptions.isGeodesic()); polygonOptions.visible(globalPolygonOptions.isVisible()); polygonOptions.zIndex(globalPolygonOptions.getZIndex()); polygonOptions.strokeWidth(globalPolygonOptions.getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOptions); polygonMarkers.setPolygon(polygon); List<Marker> markers = addPointsToMapAsMarkers(map, polygon.getPoints(), polygonMarkerOptions, true); polygonMarkers.setMarkers(markers); for (List<LatLng> holes : polygon.getHoles()) { List<Marker> holeMarkers = addPointsToMapAsMarkers(map, holes, polygonMarkerHoleOptions, true); PolygonHoleMarkers polygonHoleMarkers = new PolygonHoleMarkers( polygonMarkers); polygonHoleMarkers.setMarkers(holeMarkers); shapeMarkers.add(polygonHoleMarkers); polygonMarkers.addHole(polygonHoleMarkers); } return polygonMarkers; }
java
public PolygonMarkers addPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, PolygonOptions polygonOptions, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { PolygonMarkers polygonMarkers = new PolygonMarkers(this); if (globalPolygonOptions != null) { polygonOptions.fillColor(globalPolygonOptions.getFillColor()); polygonOptions.strokeColor(globalPolygonOptions.getStrokeColor()); polygonOptions.geodesic(globalPolygonOptions.isGeodesic()); polygonOptions.visible(globalPolygonOptions.isVisible()); polygonOptions.zIndex(globalPolygonOptions.getZIndex()); polygonOptions.strokeWidth(globalPolygonOptions.getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOptions); polygonMarkers.setPolygon(polygon); List<Marker> markers = addPointsToMapAsMarkers(map, polygon.getPoints(), polygonMarkerOptions, true); polygonMarkers.setMarkers(markers); for (List<LatLng> holes : polygon.getHoles()) { List<Marker> holeMarkers = addPointsToMapAsMarkers(map, holes, polygonMarkerHoleOptions, true); PolygonHoleMarkers polygonHoleMarkers = new PolygonHoleMarkers( polygonMarkers); polygonHoleMarkers.setMarkers(holeMarkers); shapeMarkers.add(polygonHoleMarkers); polygonMarkers.addHole(polygonHoleMarkers); } return polygonMarkers; }
[ "public", "PolygonMarkers", "addPolygonToMapAsMarkers", "(", "GoogleMapShapeMarkers", "shapeMarkers", ",", "GoogleMap", "map", ",", "PolygonOptions", "polygonOptions", ",", "MarkerOptions", "polygonMarkerOptions", ",", "MarkerOptions", "polygonMarkerHoleOptions", ",", "PolygonO...
Add a Polygon to the map as markers @param shapeMarkers google map shape markers @param map google map @param polygonOptions polygon options @param polygonMarkerOptions polygon marker options @param polygonMarkerHoleOptions polygon marker hole options @param globalPolygonOptions global polygon options @return polygon markers
[ "Add", "a", "Polygon", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1893-L1929
36,753
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addMultiPolylineToMapAsMarkers
public MultiPolylineMarkers addMultiPolylineToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolylineOptions multiPolyline, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { MultiPolylineMarkers polylines = new MultiPolylineMarkers(); for (PolylineOptions polylineOptions : multiPolyline .getPolylineOptions()) { PolylineMarkers polylineMarker = addPolylineToMapAsMarkers(map, polylineOptions, polylineMarkerOptions, globalPolylineOptions); shapeMarkers.add(polylineMarker); polylines.add(polylineMarker); } return polylines; }
java
public MultiPolylineMarkers addMultiPolylineToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolylineOptions multiPolyline, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { MultiPolylineMarkers polylines = new MultiPolylineMarkers(); for (PolylineOptions polylineOptions : multiPolyline .getPolylineOptions()) { PolylineMarkers polylineMarker = addPolylineToMapAsMarkers(map, polylineOptions, polylineMarkerOptions, globalPolylineOptions); shapeMarkers.add(polylineMarker); polylines.add(polylineMarker); } return polylines; }
[ "public", "MultiPolylineMarkers", "addMultiPolylineToMapAsMarkers", "(", "GoogleMapShapeMarkers", "shapeMarkers", ",", "GoogleMap", "map", ",", "MultiPolylineOptions", "multiPolyline", ",", "MarkerOptions", "polylineMarkerOptions", ",", "PolylineOptions", "globalPolylineOptions", ...
Add a MultiPolylineOptions to the map as markers @param shapeMarkers google map shape markers @param map google map @param multiPolyline multi polyline options @param polylineMarkerOptions polyline marker options @param globalPolylineOptions global polyline options @return multi polyline markers
[ "Add", "a", "MultiPolylineOptions", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1941-L1956
36,754
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addMultiPolygonToMapAsMarkers
public MultiPolygonMarkers addMultiPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolygonOptions multiPolygon, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { MultiPolygonMarkers multiPolygonMarkers = new MultiPolygonMarkers(); for (PolygonOptions polygon : multiPolygon.getPolygonOptions()) { PolygonMarkers polygonMarker = addPolygonToMapAsMarkers( shapeMarkers, map, polygon, polygonMarkerOptions, polygonMarkerHoleOptions, globalPolygonOptions); shapeMarkers.add(polygonMarker); multiPolygonMarkers.add(polygonMarker); } return multiPolygonMarkers; }
java
public MultiPolygonMarkers addMultiPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolygonOptions multiPolygon, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { MultiPolygonMarkers multiPolygonMarkers = new MultiPolygonMarkers(); for (PolygonOptions polygon : multiPolygon.getPolygonOptions()) { PolygonMarkers polygonMarker = addPolygonToMapAsMarkers( shapeMarkers, map, polygon, polygonMarkerOptions, polygonMarkerHoleOptions, globalPolygonOptions); shapeMarkers.add(polygonMarker); multiPolygonMarkers.add(polygonMarker); } return multiPolygonMarkers; }
[ "public", "MultiPolygonMarkers", "addMultiPolygonToMapAsMarkers", "(", "GoogleMapShapeMarkers", "shapeMarkers", ",", "GoogleMap", "map", ",", "MultiPolygonOptions", "multiPolygon", ",", "MarkerOptions", "polygonMarkerOptions", ",", "MarkerOptions", "polygonMarkerHoleOptions", ","...
Add a MultiPolygonOptions to the map as markers @param shapeMarkers google map shape markers @param map google map @param multiPolygon multi polygon options @param polygonMarkerOptions polygon marker options @param polygonMarkerHoleOptions polygon marker hole options @param globalPolygonOptions global polygon options @return multi polygon markers
[ "Add", "a", "MultiPolygonOptions", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1969-L1984
36,755
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.getPointsFromMarkers
public List<LatLng> getPointsFromMarkers(List<Marker> markers) { List<LatLng> points = new ArrayList<LatLng>(); for (Marker marker : markers) { points.add(marker.getPosition()); } return points; }
java
public List<LatLng> getPointsFromMarkers(List<Marker> markers) { List<LatLng> points = new ArrayList<LatLng>(); for (Marker marker : markers) { points.add(marker.getPosition()); } return points; }
[ "public", "List", "<", "LatLng", ">", "getPointsFromMarkers", "(", "List", "<", "Marker", ">", "markers", ")", "{", "List", "<", "LatLng", ">", "points", "=", "new", "ArrayList", "<", "LatLng", ">", "(", ")", ";", "for", "(", "Marker", "marker", ":", ...
Get a list of points as LatLng from a list of Markers @param markers list of markers @return lat lngs
[ "Get", "a", "list", "of", "points", "as", "LatLng", "from", "a", "list", "of", "Markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1992-L1998
36,756
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxToWebMercator
public BoundingBox boundingBoxToWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWebMercator); }
java
public BoundingBox boundingBoxToWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWebMercator); }
[ "public", "BoundingBox", "boundingBoxToWebMercator", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundingB...
Transform the bounding box in the feature projection to web mercator @param boundingBox bounding box in feature projection @return bounding box in web mercator
[ "Transform", "the", "bounding", "box", "in", "the", "feature", "projection", "to", "web", "mercator" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2302-L2307
36,757
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxToWgs84
public BoundingBox boundingBoxToWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWgs84); }
java
public BoundingBox boundingBoxToWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWgs84); }
[ "public", "BoundingBox", "boundingBoxToWgs84", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundingBox", ...
Transform the bounding box in the feature projection to WGS84 @param boundingBox bounding box in feature projection @return bounding box in WGS84
[ "Transform", "the", "bounding", "box", "in", "the", "feature", "projection", "to", "WGS84" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2315-L2320
36,758
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxFromWebMercator
public BoundingBox boundingBoxFromWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWebMercator); }
java
public BoundingBox boundingBoxFromWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWebMercator); }
[ "public", "BoundingBox", "boundingBoxFromWebMercator", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundin...
Transform the bounding box in web mercator to the feature projection @param boundingBox bounding box in web mercator @return bounding box in the feature projection
[ "Transform", "the", "bounding", "box", "in", "web", "mercator", "to", "the", "feature", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2328-L2333
36,759
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxFromWgs84
public BoundingBox boundingBoxFromWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWgs84); }
java
public BoundingBox boundingBoxFromWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWgs84); }
[ "public", "BoundingBox", "boundingBoxFromWgs84", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundingBox",...
Transform the bounding box in WGS84 to the feature projection @param boundingBox bounding box in WGS84 @return bounding box in the feature projection
[ "Transform", "the", "bounding", "box", "in", "WGS84", "to", "the", "feature", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2341-L2346
36,760
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setDateFormat
public void setDateFormat(java.text.DateFormat dateFormat, java.text.DateFormat numbersDateFormat) { this.customDateFormat = dateFormat; this.secondaryDateFormat = numbersDateFormat; // update the spinner with the new date format: // the only spinner item that will be affected is the month item, so just toggle the flag twice // instead of rebuilding the whole adapter if(showMonthItem) { int monthPosition = getAdapterItemPosition(4); boolean reselectMonthItem = getSelectedItemPosition() == monthPosition; setShowMonthItem(false); setShowMonthItem(true); if(reselectMonthItem) setSelection(monthPosition); } // if we have a temporary date item selected, update that as well if(getSelectedItemPosition() == getAdapter().getCount()) setSelectedDate(getSelectedDate()); }
java
public void setDateFormat(java.text.DateFormat dateFormat, java.text.DateFormat numbersDateFormat) { this.customDateFormat = dateFormat; this.secondaryDateFormat = numbersDateFormat; // update the spinner with the new date format: // the only spinner item that will be affected is the month item, so just toggle the flag twice // instead of rebuilding the whole adapter if(showMonthItem) { int monthPosition = getAdapterItemPosition(4); boolean reselectMonthItem = getSelectedItemPosition() == monthPosition; setShowMonthItem(false); setShowMonthItem(true); if(reselectMonthItem) setSelection(monthPosition); } // if we have a temporary date item selected, update that as well if(getSelectedItemPosition() == getAdapter().getCount()) setSelectedDate(getSelectedDate()); }
[ "public", "void", "setDateFormat", "(", "java", ".", "text", ".", "DateFormat", "dateFormat", ",", "java", ".", "text", ".", "DateFormat", "numbersDateFormat", ")", "{", "this", ".", "customDateFormat", "=", "dateFormat", ";", "this", ".", "secondaryDateFormat",...
Sets the custom date format to use for formatting Calendar objects to displayable strings. @param dateFormat The new DateFormat, or null to use the default format. @param numbersDateFormat The DateFormat for formatting the secondary date when both FLAG_NUMBERS and FLAG_WEEKDAY_NAMES are set, or null to use the default format.
[ "Sets", "the", "custom", "date", "format", "to", "use", "for", "formatting", "Calendar", "objects", "to", "displayable", "strings", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L333-L351
36,761
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setShowPastItems
public void setShowPastItems(boolean enable) { if(enable && !showPastItems) { // first reset the minimum date if necessary: if(getMinDate() != null && compareCalendarDates(getMinDate(), Calendar.getInstance()) == 0) setMinDate(null); // create the yesterday and last Monday item: final Resources res = getResources(); final Calendar date = Calendar.getInstance(); // yesterday: date.add(Calendar.DAY_OF_YEAR, -1); insertAdapterItem(new DateItem(res.getString(R.string.date_yesterday), date, R.id.date_yesterday), 0); // last weekday item: date.add(Calendar.DAY_OF_YEAR, -6); int weekday = date.get(Calendar.DAY_OF_WEEK); insertAdapterItem(new DateItem(getWeekDay(weekday, R.string.date_last_weekday), date, R.id.date_last_week), 0); } else if(!enable && showPastItems) { // delete the yesterday and last weekday items: removeAdapterItemById(R.id.date_last_week); removeAdapterItemById(R.id.date_yesterday); // we set the minimum date to today as we don't allow past items setMinDate(Calendar.getInstance()); } showPastItems = enable; }
java
public void setShowPastItems(boolean enable) { if(enable && !showPastItems) { // first reset the minimum date if necessary: if(getMinDate() != null && compareCalendarDates(getMinDate(), Calendar.getInstance()) == 0) setMinDate(null); // create the yesterday and last Monday item: final Resources res = getResources(); final Calendar date = Calendar.getInstance(); // yesterday: date.add(Calendar.DAY_OF_YEAR, -1); insertAdapterItem(new DateItem(res.getString(R.string.date_yesterday), date, R.id.date_yesterday), 0); // last weekday item: date.add(Calendar.DAY_OF_YEAR, -6); int weekday = date.get(Calendar.DAY_OF_WEEK); insertAdapterItem(new DateItem(getWeekDay(weekday, R.string.date_last_weekday), date, R.id.date_last_week), 0); } else if(!enable && showPastItems) { // delete the yesterday and last weekday items: removeAdapterItemById(R.id.date_last_week); removeAdapterItemById(R.id.date_yesterday); // we set the minimum date to today as we don't allow past items setMinDate(Calendar.getInstance()); } showPastItems = enable; }
[ "public", "void", "setShowPastItems", "(", "boolean", "enable", ")", "{", "if", "(", "enable", "&&", "!", "showPastItems", ")", "{", "// first reset the minimum date if necessary:", "if", "(", "getMinDate", "(", ")", "!=", "null", "&&", "compareCalendarDates", "("...
Toggles showing the past items. Past mode shows the yesterday and last weekday item. @param enable True to enable, false to disable past mode.
[ "Toggles", "showing", "the", "past", "items", ".", "Past", "mode", "shows", "the", "yesterday", "and", "last", "weekday", "item", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L488-L515
36,762
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setShowMonthItem
public void setShowMonthItem(boolean enable) { if(enable && !showMonthItem) { // create the in 1 month item final Calendar date = Calendar.getInstance(); date.add(Calendar.MONTH, 1); addAdapterItem(new DateItem(formatDate(date), date, R.id.date_month)); } else if(!enable && showMonthItem) { removeAdapterItemById(R.id.date_month); } showMonthItem = enable; }
java
public void setShowMonthItem(boolean enable) { if(enable && !showMonthItem) { // create the in 1 month item final Calendar date = Calendar.getInstance(); date.add(Calendar.MONTH, 1); addAdapterItem(new DateItem(formatDate(date), date, R.id.date_month)); } else if(!enable && showMonthItem) { removeAdapterItemById(R.id.date_month); } showMonthItem = enable; }
[ "public", "void", "setShowMonthItem", "(", "boolean", "enable", ")", "{", "if", "(", "enable", "&&", "!", "showMonthItem", ")", "{", "// create the in 1 month item", "final", "Calendar", "date", "=", "Calendar", ".", "getInstance", "(", ")", ";", "date", ".", ...
Toggles showing the month item. Month mode an item in exactly one month from now. @param enable True to enable, false to disable month mode.
[ "Toggles", "showing", "the", "month", "item", ".", "Month", "mode", "an", "item", "in", "exactly", "one", "month", "from", "now", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L521-L532
36,763
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setFlags
public void setFlags(int modeOrFlags) { setShowPastItems((modeOrFlags & ReminderDatePicker.FLAG_PAST) != 0); setShowMonthItem((modeOrFlags & ReminderDatePicker.FLAG_MONTH) != 0); setShowWeekdayNames((modeOrFlags & ReminderDatePicker.FLAG_WEEKDAY_NAMES) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
java
public void setFlags(int modeOrFlags) { setShowPastItems((modeOrFlags & ReminderDatePicker.FLAG_PAST) != 0); setShowMonthItem((modeOrFlags & ReminderDatePicker.FLAG_MONTH) != 0); setShowWeekdayNames((modeOrFlags & ReminderDatePicker.FLAG_WEEKDAY_NAMES) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
[ "public", "void", "setFlags", "(", "int", "modeOrFlags", ")", "{", "setShowPastItems", "(", "(", "modeOrFlags", "&", "ReminderDatePicker", ".", "FLAG_PAST", ")", "!=", "0", ")", ";", "setShowMonthItem", "(", "(", "modeOrFlags", "&", "ReminderDatePicker", ".", ...
Set the flags to use for this date spinner. @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_... combined with the | operator.
[ "Set", "the", "flags", "to", "use", "for", "this", "date", "spinner", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L575-L580
36,764
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/PickerSpinnerAdapter.java
PickerSpinnerAdapter.brightness
private float brightness(int color) { int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; int V = Math.max(b, Math.max(r, g)); return (V / 255.f); }
java
private float brightness(int color) { int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; int V = Math.max(b, Math.max(r, g)); return (V / 255.f); }
[ "private", "float", "brightness", "(", "int", "color", ")", "{", "int", "r", "=", "(", "color", ">>", "16", ")", "&", "0xFF", ";", "int", "g", "=", "(", "color", ">>", "8", ")", "&", "0xFF", ";", "int", "b", "=", "color", "&", "0xFF", ";", "i...
Returns the brightness component of a color int. Taken from android.graphics.Color. @return A value between 0.0f and 1.0f
[ "Returns", "the", "brightness", "component", "of", "a", "color", "int", ".", "Taken", "from", "android", ".", "graphics", ".", "Color", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/PickerSpinnerAdapter.java#L313-L320
36,765
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.getNextItemDate
private @Nullable Calendar getNextItemDate(Calendar searchDate) { final int last = dateSpinner.getLastItemPosition(); for (int i=0; i<=last; i++) { final Calendar date = ((DateItem) dateSpinner.getItemAtPosition(i)).getDate(); // use the DateSpinner's compare method so hours and minutes are not considered if(DateSpinner.compareCalendarDates(date, searchDate) >= 0) return date; } // not found return null; }
java
private @Nullable Calendar getNextItemDate(Calendar searchDate) { final int last = dateSpinner.getLastItemPosition(); for (int i=0; i<=last; i++) { final Calendar date = ((DateItem) dateSpinner.getItemAtPosition(i)).getDate(); // use the DateSpinner's compare method so hours and minutes are not considered if(DateSpinner.compareCalendarDates(date, searchDate) >= 0) return date; } // not found return null; }
[ "private", "@", "Nullable", "Calendar", "getNextItemDate", "(", "Calendar", "searchDate", ")", "{", "final", "int", "last", "=", "dateSpinner", ".", "getLastItemPosition", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "last", ";", "i",...
Gets the next date item's date equal to or later than the given date in the DateSpinner. Requires that the items are in ascending order. @return A date from the next item in the DateSpinner, or no such date was found.
[ "Gets", "the", "next", "date", "item", "s", "date", "equal", "to", "or", "later", "than", "the", "given", "date", "in", "the", "DateSpinner", ".", "Requires", "that", "the", "items", "are", "in", "ascending", "order", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L216-L226
36,766
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setSelectedDate
public void setSelectedDate(Calendar date) { if(date!=null) { dateSpinner.setSelectedDate(date); timeSpinner.setSelectedTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; } }
java
public void setSelectedDate(Calendar date) { if(date!=null) { dateSpinner.setSelectedDate(date); timeSpinner.setSelectedTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; } }
[ "public", "void", "setSelectedDate", "(", "Calendar", "date", ")", "{", "if", "(", "date", "!=", "null", ")", "{", "dateSpinner", ".", "setSelectedDate", "(", "date", ")", ";", "timeSpinner", ".", "setSelectedTime", "(", "date", ".", "get", "(", "Calendar"...
Sets the Spinners' selection as date considering both time and day. @param date The date to be selected.
[ "Sets", "the", "Spinners", "selection", "as", "date", "considering", "both", "time", "and", "day", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L247-L254
36,767
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setSelectedDate
public void setSelectedDate(int year, int month, int day) { dateSpinner.setSelectedDate(new GregorianCalendar(year, month, day)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; }
java
public void setSelectedDate(int year, int month, int day) { dateSpinner.setSelectedDate(new GregorianCalendar(year, month, day)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; }
[ "public", "void", "setSelectedDate", "(", "int", "year", ",", "int", "month", ",", "int", "day", ")", "{", "dateSpinner", ".", "setSelectedDate", "(", "new", "GregorianCalendar", "(", "year", ",", "month", ",", "day", ")", ")", ";", "// a custom selection ha...
Sets the Spinners' date selection as integers considering only day.
[ "Sets", "the", "Spinners", "date", "selection", "as", "integers", "considering", "only", "day", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L259-L263
36,768
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setHideTime
public void setHideTime(boolean enable, final boolean useDarkTheme) { if(enable && !shouldHideTime) { // hide the time spinner and show a button to show it instead timeSpinner.setVisibility(GONE); ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null); timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light); timeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setHideTime(false, useDarkTheme); } }); this.addView(timeButton); } else if(!enable && shouldHideTime) { timeSpinner.setVisibility(VISIBLE); this.removeViewAt(2); } shouldHideTime = enable; }
java
public void setHideTime(boolean enable, final boolean useDarkTheme) { if(enable && !shouldHideTime) { // hide the time spinner and show a button to show it instead timeSpinner.setVisibility(GONE); ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null); timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light); timeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setHideTime(false, useDarkTheme); } }); this.addView(timeButton); } else if(!enable && shouldHideTime) { timeSpinner.setVisibility(VISIBLE); this.removeViewAt(2); } shouldHideTime = enable; }
[ "public", "void", "setHideTime", "(", "boolean", "enable", ",", "final", "boolean", "useDarkTheme", ")", "{", "if", "(", "enable", "&&", "!", "shouldHideTime", ")", "{", "// hide the time spinner and show a button to show it instead", "timeSpinner", ".", "setVisibility"...
Toggles hiding the Time Spinner and replaces it with a Button. @param enable True to hide the Spinner, false to show it. @param useDarkTheme True if a white icon shall be used, false for a dark one.
[ "Toggles", "hiding", "the", "Time", "Spinner", "and", "replaces", "it", "with", "a", "Button", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L330-L348
36,769
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setFlags
public void setFlags(int modeOrFlags) { // check each flag and pass it on if needed: setHideTime((modeOrFlags & FLAG_HIDE_TIME) != 0, isActivityUsingDarkTheme()); dateSpinner.setFlags(modeOrFlags); timeSpinner.setFlags(modeOrFlags); }
java
public void setFlags(int modeOrFlags) { // check each flag and pass it on if needed: setHideTime((modeOrFlags & FLAG_HIDE_TIME) != 0, isActivityUsingDarkTheme()); dateSpinner.setFlags(modeOrFlags); timeSpinner.setFlags(modeOrFlags); }
[ "public", "void", "setFlags", "(", "int", "modeOrFlags", ")", "{", "// check each flag and pass it on if needed:", "setHideTime", "(", "(", "modeOrFlags", "&", "FLAG_HIDE_TIME", ")", "!=", "0", ",", "isActivityUsingDarkTheme", "(", ")", ")", ";", "dateSpinner", ".",...
Set the flags to use for the picker. @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_... combined with the | operator.
[ "Set", "the", "flags", "to", "use", "for", "the", "picker", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L448-L453
36,770
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java
TimeSpinner.setTimeFormat
public void setTimeFormat(java.text.DateFormat timeFormat) { this.timeFormat = timeFormat; // update our pre-built timePickerDialog with the new timeFormat: initTimePickerDialog(getContext()); // save the flags and selection first: final PickerSpinnerAdapter adapter = ((PickerSpinnerAdapter)getAdapter()); final boolean moreTimeItems = isShowingMoreTimeItems(); final boolean numbersInView = adapter.isShowingSecondaryTextInView(); final Calendar selection = getSelectedTime(); // we need to restore differently if we have a temporary selection: final boolean temporarySelected = getSelectedItemPosition() == adapter.getCount(); // to rebuild the spinner items, we need to recreate our adapter: initAdapter(getContext()); // force restore flags and selection to the new Adapter: setShowNumbersInView(numbersInView); this.showMoreTimeItems = false; if(temporarySelected) { // for some reason these calls have to be exactly in this order! setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); setShowMoreTimeItems(moreTimeItems); } else { // this way it works when a date from the array is selected (like the default) setShowMoreTimeItems(moreTimeItems); setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); } }
java
public void setTimeFormat(java.text.DateFormat timeFormat) { this.timeFormat = timeFormat; // update our pre-built timePickerDialog with the new timeFormat: initTimePickerDialog(getContext()); // save the flags and selection first: final PickerSpinnerAdapter adapter = ((PickerSpinnerAdapter)getAdapter()); final boolean moreTimeItems = isShowingMoreTimeItems(); final boolean numbersInView = adapter.isShowingSecondaryTextInView(); final Calendar selection = getSelectedTime(); // we need to restore differently if we have a temporary selection: final boolean temporarySelected = getSelectedItemPosition() == adapter.getCount(); // to rebuild the spinner items, we need to recreate our adapter: initAdapter(getContext()); // force restore flags and selection to the new Adapter: setShowNumbersInView(numbersInView); this.showMoreTimeItems = false; if(temporarySelected) { // for some reason these calls have to be exactly in this order! setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); setShowMoreTimeItems(moreTimeItems); } else { // this way it works when a date from the array is selected (like the default) setShowMoreTimeItems(moreTimeItems); setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); } }
[ "public", "void", "setTimeFormat", "(", "java", ".", "text", ".", "DateFormat", "timeFormat", ")", "{", "this", ".", "timeFormat", "=", "timeFormat", ";", "// update our pre-built timePickerDialog with the new timeFormat:", "initTimePickerDialog", "(", "getContext", "(", ...
Sets the time format to use for formatting Calendar objects to displayable strings. @param timeFormat The new time format (as java.text.DateFormat), or null to use the default format.
[ "Sets", "the", "time", "format", "to", "use", "for", "formatting", "Calendar", "objects", "to", "displayable", "strings", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java#L264-L292
36,771
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java
TimeSpinner.setShowMoreTimeItems
public void setShowMoreTimeItems(boolean enable) { if(enable && !showMoreTimeItems) { // create the noon and late night item: final Resources res = getResources(); // switch the afternoon item to 2pm: insertAdapterItem(new TimeItem(res.getString(R.string.time_afternoon_2), formatTime(14, 0), 14, 0, R.id.time_afternoon_2), 2); removeAdapterItemById(R.id.time_afternoon); // noon item: insertAdapterItem(new TimeItem(res.getString(R.string.time_noon), formatTime(12, 0), 12, 0, R.id.time_noon), 1); // late night item: addAdapterItem(new TimeItem(res.getString(R.string.time_late_night), formatTime(23, 0), 23, 0, R.id.time_late_night)); } else if(!enable && showMoreTimeItems) { // switch back the afternoon item: insertAdapterItem(new TimeItem(getResources().getString(R.string.time_afternoon), formatTime(13, 0), 13, 0, R.id.time_afternoon), 3); removeAdapterItemById(R.id.time_afternoon_2); removeAdapterItemById(R.id.time_noon); removeAdapterItemById(R.id.time_late_night); } showMoreTimeItems = enable; }
java
public void setShowMoreTimeItems(boolean enable) { if(enable && !showMoreTimeItems) { // create the noon and late night item: final Resources res = getResources(); // switch the afternoon item to 2pm: insertAdapterItem(new TimeItem(res.getString(R.string.time_afternoon_2), formatTime(14, 0), 14, 0, R.id.time_afternoon_2), 2); removeAdapterItemById(R.id.time_afternoon); // noon item: insertAdapterItem(new TimeItem(res.getString(R.string.time_noon), formatTime(12, 0), 12, 0, R.id.time_noon), 1); // late night item: addAdapterItem(new TimeItem(res.getString(R.string.time_late_night), formatTime(23, 0), 23, 0, R.id.time_late_night)); } else if(!enable && showMoreTimeItems) { // switch back the afternoon item: insertAdapterItem(new TimeItem(getResources().getString(R.string.time_afternoon), formatTime(13, 0), 13, 0, R.id.time_afternoon), 3); removeAdapterItemById(R.id.time_afternoon_2); removeAdapterItemById(R.id.time_noon); removeAdapterItemById(R.id.time_late_night); } showMoreTimeItems = enable; }
[ "public", "void", "setShowMoreTimeItems", "(", "boolean", "enable", ")", "{", "if", "(", "enable", "&&", "!", "showMoreTimeItems", ")", "{", "// create the noon and late night item:", "final", "Resources", "res", "=", "getResources", "(", ")", ";", "// switch the af...
Toggles showing more time items. If enabled, a noon and a late night time item are shown. @param enable True to enable, false to disable more time items.
[ "Toggles", "showing", "more", "time", "items", ".", "If", "enabled", "a", "noon", "and", "a", "late", "night", "time", "item", "are", "shown", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java#L333-L353
36,772
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java
TimeSpinner.setFlags
public void setFlags(int modeOrFlags) { setShowMoreTimeItems((modeOrFlags & ReminderDatePicker.FLAG_MORE_TIME) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
java
public void setFlags(int modeOrFlags) { setShowMoreTimeItems((modeOrFlags & ReminderDatePicker.FLAG_MORE_TIME) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
[ "public", "void", "setFlags", "(", "int", "modeOrFlags", ")", "{", "setShowMoreTimeItems", "(", "(", "modeOrFlags", "&", "ReminderDatePicker", ".", "FLAG_MORE_TIME", ")", "!=", "0", ")", ";", "setShowNumbersInView", "(", "(", "modeOrFlags", "&", "ReminderDatePicke...
Set the flags to use for this time spinner. @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_... combined with the | operator.
[ "Set", "the", "flags", "to", "use", "for", "this", "time", "spinner", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java#L372-L375
36,773
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getTables
public Map<String, Map<Long, FeatureShape>> getTables(String database) { Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables == null) { tables = new HashMap<>(); databases.put(database, tables); } return tables; }
java
public Map<String, Map<Long, FeatureShape>> getTables(String database) { Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables == null) { tables = new HashMap<>(); databases.put(database, tables); } return tables; }
[ "public", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "getTables", "(", "String", "database", ")", "{", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "databases", ".", "...
Get the mapping between tables and feature ids for the database @param database GeoPackage database @return tables to features ids mapping @since 3.2.0
[ "Get", "the", "mapping", "between", "tables", "and", "feature", "ids", "for", "the", "database" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L65-L73
36,774
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureIds
public Map<Long, FeatureShape> getFeatureIds(String database, String table) { Map<String, Map<Long, FeatureShape>> tables = getTables(database); Map<Long, FeatureShape> featureIds = getFeatureIds(tables, table); return featureIds; }
java
public Map<Long, FeatureShape> getFeatureIds(String database, String table) { Map<String, Map<Long, FeatureShape>> tables = getTables(database); Map<Long, FeatureShape> featureIds = getFeatureIds(tables, table); return featureIds; }
[ "public", "Map", "<", "Long", ",", "FeatureShape", ">", "getFeatureIds", "(", "String", "database", ",", "String", "table", ")", "{", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "getTables", "(", "database...
Get the mapping between feature ids and map shapes for the database and table @param database GeoPackage database @param table table name @return feature ids to map shapes mapping @since 3.2.0
[ "Get", "the", "mapping", "between", "feature", "ids", "and", "map", "shapes", "for", "the", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L93-L97
36,775
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureIds
private Map<Long, FeatureShape> getFeatureIds(Map<String, Map<Long, FeatureShape>> tables, String table) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds == null) { featureIds = new HashMap<>(); tables.put(table, featureIds); } return featureIds; }
java
private Map<Long, FeatureShape> getFeatureIds(Map<String, Map<Long, FeatureShape>> tables, String table) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds == null) { featureIds = new HashMap<>(); tables.put(table, featureIds); } return featureIds; }
[ "private", "Map", "<", "Long", ",", "FeatureShape", ">", "getFeatureIds", "(", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", ",", "String", "table", ")", "{", "Map", "<", "Long", ",", "FeatureShape", ">", "feat...
Get the feature ids and map shapes for the tables and table @param tables tables @param table table name @return feature ids to map shapes mapping
[ "Get", "the", "feature", "ids", "and", "map", "shapes", "for", "the", "tables", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L117-L125
36,776
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShape
public FeatureShape getFeatureShape(String database, String table, long featureId) { Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); FeatureShape featureShape = getFeatureShape(featureIds, featureId); return featureShape; }
java
public FeatureShape getFeatureShape(String database, String table, long featureId) { Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); FeatureShape featureShape = getFeatureShape(featureIds, featureId); return featureShape; }
[ "public", "FeatureShape", "getFeatureShape", "(", "String", "database", ",", "String", "table", ",", "long", "featureId", ")", "{", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", "=", "getFeatureIds", "(", "database", ",", "table", ")", ";", "Fe...
Get the feature shape for the database, table, and feature id @param database GeoPackage database @param table table name @param featureId feature id @return feature shape @since 3.2.0
[ "Get", "the", "feature", "shape", "for", "the", "database", "table", "and", "feature", "id" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L136-L140
36,777
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShapeCount
public int getFeatureShapeCount(String database, String table, long featureId) { return getFeatureShape(database, table, featureId).count(); }
java
public int getFeatureShapeCount(String database, String table, long featureId) { return getFeatureShape(database, table, featureId).count(); }
[ "public", "int", "getFeatureShapeCount", "(", "String", "database", ",", "String", "table", ",", "long", "featureId", ")", "{", "return", "getFeatureShape", "(", "database", ",", "table", ",", "featureId", ")", ".", "count", "(", ")", ";", "}" ]
Get the feature shape count for the database, table, and feature id @param database GeoPackage database @param table table name @param featureId feature id @return map shapes count @since 3.2.0
[ "Get", "the", "feature", "shape", "count", "for", "the", "database", "table", "and", "feature", "id" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L151-L153
36,778
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShape
private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); featureIds.put(featureId, featureShape); } return featureShape; }
java
private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); featureIds.put(featureId, featureShape); } return featureShape; }
[ "private", "FeatureShape", "getFeatureShape", "(", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", ",", "long", "featureId", ")", "{", "FeatureShape", "featureShape", "=", "featureIds", ".", "get", "(", "featureId", ")", ";", "if", "(", "featureSha...
Get the map shapes for the feature ids and feature id @param featureIds feature ids @param featureId feature id @return feature shape
[ "Get", "the", "map", "shapes", "for", "the", "feature", "ids", "and", "feature", "id" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L162-L170
36,779
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.addMapShape
public void addMapShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addShape(mapShape); }
java
public void addMapShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addShape(mapShape); }
[ "public", "void", "addMapShape", "(", "GoogleMapShape", "mapShape", ",", "long", "featureId", ",", "String", "database", ",", "String", "table", ")", "{", "FeatureShape", "featureShape", "=", "getFeatureShape", "(", "database", ",", "table", ",", "featureId", ")...
Add a map shape with the feature id, database, and table @param mapShape map shape @param featureId feature id @param database GeoPackage database @param table table name
[ "Add", "a", "map", "shape", "with", "the", "feature", "id", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L180-L183
36,780
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.addMapMetadataShape
public void addMapMetadataShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addMetadataShape(mapShape); }
java
public void addMapMetadataShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addMetadataShape(mapShape); }
[ "public", "void", "addMapMetadataShape", "(", "GoogleMapShape", "mapShape", ",", "long", "featureId", ",", "String", "database", ",", "String", "table", ")", "{", "FeatureShape", "featureShape", "=", "getFeatureShape", "(", "database", ",", "table", ",", "featureI...
Add a map metadata shape with the feature id, database, and table @param mapShape map metadata shape @param featureId feature id @param database GeoPackage database @param table table name @since 3.2.0
[ "Add", "a", "map", "metadata", "shape", "with", "the", "feature", "id", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L194-L197
36,781
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.exists
public boolean exists(long featureId, String database, String table) { boolean exists = false; Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables != null) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds != null) { FeatureShape shapes = featureIds.get(featureId); exists = shapes != null && shapes.hasShapes(); } } return exists; }
java
public boolean exists(long featureId, String database, String table) { boolean exists = false; Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables != null) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds != null) { FeatureShape shapes = featureIds.get(featureId); exists = shapes != null && shapes.hasShapes(); } } return exists; }
[ "public", "boolean", "exists", "(", "long", "featureId", ",", "String", "database", ",", "String", "table", ")", "{", "boolean", "exists", "=", "false", ";", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "...
Check if map shapes exist for the feature id, database, and table @param featureId feature id @param database GeoPackage database @param table table name @return true if exists
[ "Check", "if", "map", "shapes", "exist", "for", "the", "feature", "id", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L207-L219
36,782
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesWithExclusions
public int removeShapesWithExclusions(String database, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { Iterator<String> iterator = tables.keySet().iterator(); while (iterator.hasNext()) { String table = iterator.next(); count += removeShapesWithExclusions(database, table, excludedTypes); if (getFeatureIdsCount(database, table) <= 0) { iterator.remove(); } } } return count; }
java
public int removeShapesWithExclusions(String database, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { Iterator<String> iterator = tables.keySet().iterator(); while (iterator.hasNext()) { String table = iterator.next(); count += removeShapesWithExclusions(database, table, excludedTypes); if (getFeatureIdsCount(database, table) <= 0) { iterator.remove(); } } } return count; }
[ "public", "int", "removeShapesWithExclusions", "(", "String", "database", ",", "Set", "<", "GoogleMapShapeType", ">", "excludedTypes", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "t...
Remove all map shapes in the database from the map, excluding shapes with the excluded types @param database GeoPackage database @param excludedTypes Google Map Shape Types to exclude from map removal @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "from", "the", "map", "excluding", "shapes", "with", "the", "excluded", "types" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L329-L351
36,783
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesWithExclusion
public int removeShapesWithExclusion(String database, String table, GoogleMapShapeType excludedType) { Set<GoogleMapShapeType> excludedTypes = new HashSet<>(); excludedTypes.add(excludedType); return removeShapesWithExclusions(database, table, excludedTypes); }
java
public int removeShapesWithExclusion(String database, String table, GoogleMapShapeType excludedType) { Set<GoogleMapShapeType> excludedTypes = new HashSet<>(); excludedTypes.add(excludedType); return removeShapesWithExclusions(database, table, excludedTypes); }
[ "public", "int", "removeShapesWithExclusion", "(", "String", "database", ",", "String", "table", ",", "GoogleMapShapeType", "excludedType", ")", "{", "Set", "<", "GoogleMapShapeType", ">", "excludedTypes", "=", "new", "HashSet", "<>", "(", ")", ";", "excludedTypes...
Remove all map shapes in the database and table from the map, excluding shapes with the excluded type @param database GeoPackage database @param table table name @param excludedType Google Map Shape Type to exclude from map removal @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "and", "table", "from", "the", "map", "excluding", "shapes", "with", "the", "excluded", "type" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L373-L377
36,784
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesWithExclusions
public int removeShapesWithExclusions(String database, String table, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { Iterator<Long> iterator = featureIds.keySet().iterator(); while (iterator.hasNext()) { long featureId = iterator.next(); FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { Iterator<GoogleMapShape> shapeIterator = featureShape.getShapes().iterator(); while (shapeIterator.hasNext()) { GoogleMapShape mapShape = shapeIterator.next(); if (excludedTypes == null || !excludedTypes.contains(mapShape.getShapeType())) { mapShape.remove(); shapeIterator.remove(); } } } if (featureShape == null || !featureShape.hasShapes()) { if(featureShape != null) { featureShape.removeMetadataShapes(); } iterator.remove(); count++; } } } return count; }
java
public int removeShapesWithExclusions(String database, String table, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { Iterator<Long> iterator = featureIds.keySet().iterator(); while (iterator.hasNext()) { long featureId = iterator.next(); FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { Iterator<GoogleMapShape> shapeIterator = featureShape.getShapes().iterator(); while (shapeIterator.hasNext()) { GoogleMapShape mapShape = shapeIterator.next(); if (excludedTypes == null || !excludedTypes.contains(mapShape.getShapeType())) { mapShape.remove(); shapeIterator.remove(); } } } if (featureShape == null || !featureShape.hasShapes()) { if(featureShape != null) { featureShape.removeMetadataShapes(); } iterator.remove(); count++; } } } return count; }
[ "public", "int", "removeShapesWithExclusions", "(", "String", "database", ",", "String", "table", ",", "Set", "<", "GoogleMapShapeType", ">", "excludedTypes", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", ...
Remove all map shapes in the database and table from the map, excluding shapes with the excluded types @param database GeoPackage database @param table table name @param excludedTypes Google Map Shape Types to exclude from map removal @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "and", "table", "from", "the", "map", "excluding", "shapes", "with", "the", "excluded", "types" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L405-L445
36,785
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesNotWithinMap
public int removeShapesNotWithinMap(GoogleMap map) { int count = 0; BoundingBox boundingBox = MapUtils.getBoundingBox(map); for (String database : databases.keySet()) { count += removeShapesNotWithinMap(boundingBox, database); } return count; }
java
public int removeShapesNotWithinMap(GoogleMap map) { int count = 0; BoundingBox boundingBox = MapUtils.getBoundingBox(map); for (String database : databases.keySet()) { count += removeShapesNotWithinMap(boundingBox, database); } return count; }
[ "public", "int", "removeShapesNotWithinMap", "(", "GoogleMap", "map", ")", "{", "int", "count", "=", "0", ";", "BoundingBox", "boundingBox", "=", "MapUtils", ".", "getBoundingBox", "(", "map", ")", ";", "for", "(", "String", "database", ":", "databases", "."...
Remove all map shapes that are not visible in the map @param map map @return count of removed features
[ "Remove", "all", "map", "shapes", "that", "are", "not", "visible", "in", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L453-L464
36,786
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesNotWithinMap
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { for (String table : tables.keySet()) { count += removeShapesNotWithinMap(boundingBox, database, table); } } return count; }
java
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { for (String table : tables.keySet()) { count += removeShapesNotWithinMap(boundingBox, database, table); } } return count; }
[ "public", "int", "removeShapesNotWithinMap", "(", "BoundingBox", "boundingBox", ",", "String", "database", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "getTables", "(...
Remove all map shapes in the database that are not visible in the bounding box @param boundingBox bounding box @param database GeoPackage database @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "that", "are", "not", "visible", "in", "the", "bounding", "box" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L490-L504
36,787
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesNotWithinMap
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database, String table) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { List<Long> deleteFeatureIds = new ArrayList<>(); for (long featureId : featureIds.keySet()) { FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { boolean delete = true; for (GoogleMapShape mapShape : featureShape.getShapes()) { BoundingBox mapShapeBoundingBox = mapShape.boundingBox(); boolean allowEmpty = mapShape.getGeometryType() == GeometryType.POINT; if (TileBoundingBoxUtils.overlap(mapShapeBoundingBox, boundingBox, ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH, allowEmpty) != null) { delete = false; break; } } if (delete) { deleteFeatureIds.add(featureId); } } } for (long deleteFeatureId : deleteFeatureIds) { FeatureShape featureShape = getFeatureShape(featureIds, deleteFeatureId); if (featureShape != null) { featureShape.remove(); featureIds.remove(deleteFeatureId); } count++; } } return count; }
java
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database, String table) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { List<Long> deleteFeatureIds = new ArrayList<>(); for (long featureId : featureIds.keySet()) { FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { boolean delete = true; for (GoogleMapShape mapShape : featureShape.getShapes()) { BoundingBox mapShapeBoundingBox = mapShape.boundingBox(); boolean allowEmpty = mapShape.getGeometryType() == GeometryType.POINT; if (TileBoundingBoxUtils.overlap(mapShapeBoundingBox, boundingBox, ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH, allowEmpty) != null) { delete = false; break; } } if (delete) { deleteFeatureIds.add(featureId); } } } for (long deleteFeatureId : deleteFeatureIds) { FeatureShape featureShape = getFeatureShape(featureIds, deleteFeatureId); if (featureShape != null) { featureShape.remove(); featureIds.remove(deleteFeatureId); } count++; } } return count; }
[ "public", "int", "removeShapesNotWithinMap", "(", "BoundingBox", "boundingBox", ",", "String", "database", ",", "String", "table", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", "=", "getFeatureIds", "(", ...
Remove all map shapes in the database and table that are not visible in the bounding box @param boundingBox bounding box @param database GeoPackage database @return count of removed features
[ "Remove", "all", "map", "shapes", "in", "the", "database", "and", "table", "that", "are", "not", "visible", "in", "the", "bounding", "box" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L530-L574
36,788
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeFeatureShape
public boolean removeFeatureShape(String database, String table, long featureId) { boolean removed = false; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { FeatureShape featureShape = featureIds.remove(featureId); if (featureShape != null) { featureShape.remove(); removed = true; } } return removed; }
java
public boolean removeFeatureShape(String database, String table, long featureId) { boolean removed = false; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { FeatureShape featureShape = featureIds.remove(featureId); if (featureShape != null) { featureShape.remove(); removed = true; } } return removed; }
[ "public", "boolean", "removeFeatureShape", "(", "String", "database", ",", "String", "table", ",", "long", "featureId", ")", "{", "boolean", "removed", "=", "false", ";", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", "=", "getFeatureIds", "(", ...
Remove the feature shape from the database and table @param database GeoPackage database @param table table name @param featureId feature id @return true if removed @since 3.2.0
[ "Remove", "the", "feature", "shape", "from", "the", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L585-L599
36,789
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.remove
public void remove() { switch (shapeType) { case MARKER: ((Marker) shape).remove(); break; case POLYGON: ((Polygon) shape).remove(); break; case POLYLINE: ((Polyline) shape).remove(); break; case MULTI_MARKER: ((MultiMarker) shape).remove(); break; case MULTI_POLYLINE: ((MultiPolyline) shape).remove(); break; case MULTI_POLYGON: ((MultiPolygon) shape).remove(); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).remove(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).remove(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).remove(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).remove(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.remove(); } break; default: } }
java
public void remove() { switch (shapeType) { case MARKER: ((Marker) shape).remove(); break; case POLYGON: ((Polygon) shape).remove(); break; case POLYLINE: ((Polyline) shape).remove(); break; case MULTI_MARKER: ((MultiMarker) shape).remove(); break; case MULTI_POLYLINE: ((MultiPolyline) shape).remove(); break; case MULTI_POLYGON: ((MultiPolygon) shape).remove(); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).remove(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).remove(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).remove(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).remove(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.remove(); } break; default: } }
[ "public", "void", "remove", "(", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "MARKER", ":", "(", "(", "Marker", ")", "shape", ")", ".", "remove", "(", ")", ";", "break", ";", "case", "POLYGON", ":", "(", "(", "Polygon", ")", "shape", ...
Removes all objects added to the map
[ "Removes", "all", "objects", "added", "to", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L110-L154
36,790
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.setVisible
public void setVisible(boolean visible) { switch (shapeType) { case MARKER_OPTIONS: ((MarkerOptions) shape).visible(visible); break; case POLYLINE_OPTIONS: ((PolylineOptions) shape).visible(visible); break; case POLYGON_OPTIONS: ((PolygonOptions) shape).visible(visible); break; case MULTI_POLYLINE_OPTIONS: ((MultiPolylineOptions) shape).visible(visible); break; case MULTI_POLYGON_OPTIONS: ((MultiPolygonOptions) shape).visible(visible); break; case MARKER: ((Marker) shape).setVisible(visible); break; case POLYGON: ((Polygon) shape).setVisible(visible); break; case POLYLINE: ((Polyline) shape).setVisible(visible); break; case MULTI_MARKER: ((MultiMarker) shape).setVisible(visible); break; case MULTI_POLYLINE: ((MultiPolyline) shape).setVisible(visible); break; case MULTI_POLYGON: ((MultiPolygon) shape).setVisible(visible); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).setVisible(visible); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).setVisible(visible); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).setVisible(visible); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).setVisible(visible); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.setVisible(visible); } break; default: } }
java
public void setVisible(boolean visible) { switch (shapeType) { case MARKER_OPTIONS: ((MarkerOptions) shape).visible(visible); break; case POLYLINE_OPTIONS: ((PolylineOptions) shape).visible(visible); break; case POLYGON_OPTIONS: ((PolygonOptions) shape).visible(visible); break; case MULTI_POLYLINE_OPTIONS: ((MultiPolylineOptions) shape).visible(visible); break; case MULTI_POLYGON_OPTIONS: ((MultiPolygonOptions) shape).visible(visible); break; case MARKER: ((Marker) shape).setVisible(visible); break; case POLYGON: ((Polygon) shape).setVisible(visible); break; case POLYLINE: ((Polyline) shape).setVisible(visible); break; case MULTI_MARKER: ((MultiMarker) shape).setVisible(visible); break; case MULTI_POLYLINE: ((MultiPolyline) shape).setVisible(visible); break; case MULTI_POLYGON: ((MultiPolygon) shape).setVisible(visible); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).setVisible(visible); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).setVisible(visible); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).setVisible(visible); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).setVisible(visible); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.setVisible(visible); } break; default: } }
[ "public", "void", "setVisible", "(", "boolean", "visible", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "MARKER_OPTIONS", ":", "(", "(", "MarkerOptions", ")", "shape", ")", ".", "visible", "(", "visible", ")", ";", "break", ";", "case", "POLYL...
Updates visibility of all objects @param visible visible flag @since 1.3.2
[ "Updates", "visibility", "of", "all", "objects" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L162-L221
36,791
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.update
public void update() { switch (shapeType) { case POLYLINE_MARKERS: ((PolylineMarkers) shape).update(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).update(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).update(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).update(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.update(); } break; default: } }
java
public void update() { switch (shapeType) { case POLYLINE_MARKERS: ((PolylineMarkers) shape).update(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).update(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).update(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).update(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.update(); } break; default: } }
[ "public", "void", "update", "(", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "POLYLINE_MARKERS", ":", "(", "(", "PolylineMarkers", ")", "shape", ")", ".", "update", "(", ")", ";", "break", ";", "case", "POLYGON_MARKERS", ":", "(", "(", "Pol...
Updates all objects that could have changed from moved markers
[ "Updates", "all", "objects", "that", "could", "have", "changed", "from", "moved", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L293-L319
36,792
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.isValid
public boolean isValid() { boolean valid = true; switch (shapeType) { case POLYLINE_MARKERS: valid = ((PolylineMarkers) shape).isValid(); break; case POLYGON_MARKERS: valid = ((PolygonMarkers) shape).isValid(); break; case MULTI_POLYLINE_MARKERS: valid = ((MultiPolylineMarkers) shape).isValid(); break; case MULTI_POLYGON_MARKERS: valid = ((MultiPolygonMarkers) shape).isValid(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { valid = shapeListItem.isValid(); if (!valid) { break; } } break; default: } return valid; }
java
public boolean isValid() { boolean valid = true; switch (shapeType) { case POLYLINE_MARKERS: valid = ((PolylineMarkers) shape).isValid(); break; case POLYGON_MARKERS: valid = ((PolygonMarkers) shape).isValid(); break; case MULTI_POLYLINE_MARKERS: valid = ((MultiPolylineMarkers) shape).isValid(); break; case MULTI_POLYGON_MARKERS: valid = ((MultiPolygonMarkers) shape).isValid(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { valid = shapeListItem.isValid(); if (!valid) { break; } } break; default: } return valid; }
[ "public", "boolean", "isValid", "(", ")", "{", "boolean", "valid", "=", "true", ";", "switch", "(", "shapeType", ")", "{", "case", "POLYLINE_MARKERS", ":", "valid", "=", "(", "(", "PolylineMarkers", ")", "shape", ")", ".", "isValid", "(", ")", ";", "br...
Determines if the shape is in a valid state
[ "Determines", "if", "the", "shape", "is", "in", "a", "valid", "state" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L324-L356
36,793
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.boundingBox
public BoundingBox boundingBox() { BoundingBox boundingBox = new BoundingBox(Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); expandBoundingBox(boundingBox); return boundingBox; }
java
public BoundingBox boundingBox() { BoundingBox boundingBox = new BoundingBox(Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); expandBoundingBox(boundingBox); return boundingBox; }
[ "public", "BoundingBox", "boundingBox", "(", ")", "{", "BoundingBox", "boundingBox", "=", "new", "BoundingBox", "(", "Double", ".", "MAX_VALUE", ",", "Double", ".", "MAX_VALUE", ",", "-", "Double", ".", "MAX_VALUE", ",", "-", "Double", ".", "MAX_VALUE", ")",...
Get a bounding box that includes the shape @return bounding box
[ "Get", "a", "bounding", "box", "that", "includes", "the", "shape" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L363-L367
36,794
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBox
public void expandBoundingBox(BoundingBox boundingBox) { switch (shapeType) { case LAT_LNG: expandBoundingBox(boundingBox, (LatLng) shape); break; case MARKER_OPTIONS: expandBoundingBox(boundingBox, ((MarkerOptions) shape).getPosition()); break; case POLYLINE_OPTIONS: expandBoundingBox(boundingBox, ((PolylineOptions) shape).getPoints()); break; case POLYGON_OPTIONS: expandBoundingBox(boundingBox, ((PolygonOptions) shape).getPoints()); break; case MULTI_LAT_LNG: expandBoundingBox(boundingBox, ((MultiLatLng) shape).getLatLngs()); break; case MULTI_POLYLINE_OPTIONS: MultiPolylineOptions multiPolylineOptions = (MultiPolylineOptions) shape; for (PolylineOptions polylineOptions : multiPolylineOptions .getPolylineOptions()) { expandBoundingBox(boundingBox, polylineOptions.getPoints()); } break; case MULTI_POLYGON_OPTIONS: MultiPolygonOptions multiPolygonOptions = (MultiPolygonOptions) shape; for (PolygonOptions polygonOptions : multiPolygonOptions .getPolygonOptions()) { expandBoundingBox(boundingBox, polygonOptions.getPoints()); } break; case MARKER: expandBoundingBox(boundingBox, ((Marker) shape).getPosition()); break; case POLYLINE: expandBoundingBox(boundingBox, ((Polyline) shape).getPoints()); break; case POLYGON: expandBoundingBox(boundingBox, ((Polygon) shape).getPoints()); break; case MULTI_MARKER: expandBoundingBoxMarkers(boundingBox, ((MultiMarker) shape).getMarkers()); break; case MULTI_POLYLINE: MultiPolyline multiPolyline = (MultiPolyline) shape; for (Polyline polyline : multiPolyline.getPolylines()) { expandBoundingBox(boundingBox, polyline.getPoints()); } break; case MULTI_POLYGON: MultiPolygon multiPolygon = (MultiPolygon) shape; for (Polygon polygon : multiPolygon.getPolygons()) { expandBoundingBox(boundingBox, polygon.getPoints()); } break; case POLYLINE_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolylineMarkers) shape).getMarkers()); break; case POLYGON_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolygonMarkers) shape).getMarkers()); break; case MULTI_POLYLINE_MARKERS: MultiPolylineMarkers multiPolylineMarkers = (MultiPolylineMarkers) shape; for (PolylineMarkers polylineMarkers : multiPolylineMarkers .getPolylineMarkers()) { expandBoundingBoxMarkers(boundingBox, polylineMarkers.getMarkers()); } break; case MULTI_POLYGON_MARKERS: MultiPolygonMarkers multiPolygonMarkers = (MultiPolygonMarkers) shape; for (PolygonMarkers polygonMarkers : multiPolygonMarkers .getPolygonMarkers()) { expandBoundingBoxMarkers(boundingBox, polygonMarkers.getMarkers()); } break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.expandBoundingBox(boundingBox); } break; } }
java
public void expandBoundingBox(BoundingBox boundingBox) { switch (shapeType) { case LAT_LNG: expandBoundingBox(boundingBox, (LatLng) shape); break; case MARKER_OPTIONS: expandBoundingBox(boundingBox, ((MarkerOptions) shape).getPosition()); break; case POLYLINE_OPTIONS: expandBoundingBox(boundingBox, ((PolylineOptions) shape).getPoints()); break; case POLYGON_OPTIONS: expandBoundingBox(boundingBox, ((PolygonOptions) shape).getPoints()); break; case MULTI_LAT_LNG: expandBoundingBox(boundingBox, ((MultiLatLng) shape).getLatLngs()); break; case MULTI_POLYLINE_OPTIONS: MultiPolylineOptions multiPolylineOptions = (MultiPolylineOptions) shape; for (PolylineOptions polylineOptions : multiPolylineOptions .getPolylineOptions()) { expandBoundingBox(boundingBox, polylineOptions.getPoints()); } break; case MULTI_POLYGON_OPTIONS: MultiPolygonOptions multiPolygonOptions = (MultiPolygonOptions) shape; for (PolygonOptions polygonOptions : multiPolygonOptions .getPolygonOptions()) { expandBoundingBox(boundingBox, polygonOptions.getPoints()); } break; case MARKER: expandBoundingBox(boundingBox, ((Marker) shape).getPosition()); break; case POLYLINE: expandBoundingBox(boundingBox, ((Polyline) shape).getPoints()); break; case POLYGON: expandBoundingBox(boundingBox, ((Polygon) shape).getPoints()); break; case MULTI_MARKER: expandBoundingBoxMarkers(boundingBox, ((MultiMarker) shape).getMarkers()); break; case MULTI_POLYLINE: MultiPolyline multiPolyline = (MultiPolyline) shape; for (Polyline polyline : multiPolyline.getPolylines()) { expandBoundingBox(boundingBox, polyline.getPoints()); } break; case MULTI_POLYGON: MultiPolygon multiPolygon = (MultiPolygon) shape; for (Polygon polygon : multiPolygon.getPolygons()) { expandBoundingBox(boundingBox, polygon.getPoints()); } break; case POLYLINE_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolylineMarkers) shape).getMarkers()); break; case POLYGON_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolygonMarkers) shape).getMarkers()); break; case MULTI_POLYLINE_MARKERS: MultiPolylineMarkers multiPolylineMarkers = (MultiPolylineMarkers) shape; for (PolylineMarkers polylineMarkers : multiPolylineMarkers .getPolylineMarkers()) { expandBoundingBoxMarkers(boundingBox, polylineMarkers.getMarkers()); } break; case MULTI_POLYGON_MARKERS: MultiPolygonMarkers multiPolygonMarkers = (MultiPolygonMarkers) shape; for (PolygonMarkers polygonMarkers : multiPolygonMarkers .getPolygonMarkers()) { expandBoundingBoxMarkers(boundingBox, polygonMarkers.getMarkers()); } break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.expandBoundingBox(boundingBox); } break; } }
[ "public", "void", "expandBoundingBox", "(", "BoundingBox", "boundingBox", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "LAT_LNG", ":", "expandBoundingBox", "(", "boundingBox", ",", "(", "LatLng", ")", "shape", ")", ";", "break", ";", "case", "MARK...
Expand the bounding box to include the shape @param boundingBox bounding box
[ "Expand", "the", "bounding", "box", "to", "include", "the", "shape" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L374-L467
36,795
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBox
private void expandBoundingBox(BoundingBox boundingBox, LatLng latLng) { double latitude = latLng.latitude; double longitude = latLng.longitude; if (boundingBox.getMinLongitude() <= 3 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH && boundingBox.getMaxLongitude() >= 3 * -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) { if (longitude < boundingBox.getMinLongitude()) { if (boundingBox.getMinLongitude() - longitude > (longitude + (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)) - boundingBox.getMaxLongitude()) { longitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } else if (longitude > boundingBox.getMaxLongitude()) { if (longitude - boundingBox.getMaxLongitude() > boundingBox.getMinLongitude() - (longitude - (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH))) { longitude -= (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } } if (latitude < boundingBox.getMinLatitude()) { boundingBox.setMinLatitude(latitude); } if (latitude > boundingBox.getMaxLatitude()) { boundingBox.setMaxLatitude(latitude); } if (longitude < boundingBox.getMinLongitude()) { boundingBox.setMinLongitude(longitude); } if (longitude > boundingBox.getMaxLongitude()) { boundingBox.setMaxLongitude(longitude); } }
java
private void expandBoundingBox(BoundingBox boundingBox, LatLng latLng) { double latitude = latLng.latitude; double longitude = latLng.longitude; if (boundingBox.getMinLongitude() <= 3 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH && boundingBox.getMaxLongitude() >= 3 * -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) { if (longitude < boundingBox.getMinLongitude()) { if (boundingBox.getMinLongitude() - longitude > (longitude + (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)) - boundingBox.getMaxLongitude()) { longitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } else if (longitude > boundingBox.getMaxLongitude()) { if (longitude - boundingBox.getMaxLongitude() > boundingBox.getMinLongitude() - (longitude - (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH))) { longitude -= (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } } if (latitude < boundingBox.getMinLatitude()) { boundingBox.setMinLatitude(latitude); } if (latitude > boundingBox.getMaxLatitude()) { boundingBox.setMaxLatitude(latitude); } if (longitude < boundingBox.getMinLongitude()) { boundingBox.setMinLongitude(longitude); } if (longitude > boundingBox.getMaxLongitude()) { boundingBox.setMaxLongitude(longitude); } }
[ "private", "void", "expandBoundingBox", "(", "BoundingBox", "boundingBox", ",", "LatLng", "latLng", ")", "{", "double", "latitude", "=", "latLng", ".", "latitude", ";", "double", "longitude", "=", "latLng", ".", "longitude", ";", "if", "(", "boundingBox", ".",...
Expand the bounding box by the LatLng @param boundingBox bounding box @param latLng lat lng
[ "Expand", "the", "bounding", "box", "by", "the", "LatLng" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L475-L507
36,796
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBox
private void expandBoundingBox(BoundingBox boundingBox, List<LatLng> latLngs) { for (LatLng latLng : latLngs) { expandBoundingBox(boundingBox, latLng); } }
java
private void expandBoundingBox(BoundingBox boundingBox, List<LatLng> latLngs) { for (LatLng latLng : latLngs) { expandBoundingBox(boundingBox, latLng); } }
[ "private", "void", "expandBoundingBox", "(", "BoundingBox", "boundingBox", ",", "List", "<", "LatLng", ">", "latLngs", ")", "{", "for", "(", "LatLng", "latLng", ":", "latLngs", ")", "{", "expandBoundingBox", "(", "boundingBox", ",", "latLng", ")", ";", "}", ...
Expand the bounding box by the LatLngs @param boundingBox bounding box @param latLngs lat lngs
[ "Expand", "the", "bounding", "box", "by", "the", "LatLngs" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L515-L519
36,797
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBoxMarkers
private void expandBoundingBoxMarkers(BoundingBox boundingBox, List<Marker> markers) { for (Marker marker : markers) { expandBoundingBox(boundingBox, marker.getPosition()); } }
java
private void expandBoundingBoxMarkers(BoundingBox boundingBox, List<Marker> markers) { for (Marker marker : markers) { expandBoundingBox(boundingBox, marker.getPosition()); } }
[ "private", "void", "expandBoundingBoxMarkers", "(", "BoundingBox", "boundingBox", ",", "List", "<", "Marker", ">", "markers", ")", "{", "for", "(", "Marker", "marker", ":", "markers", ")", "{", "expandBoundingBox", "(", "boundingBox", ",", "marker", ".", "getP...
Expand the bounding box by the markers @param boundingBox bounding box @param markers list of markers
[ "Expand", "the", "bounding", "box", "by", "the", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L527-L532
36,798
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.setBoundingBox
public void setBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionToWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); webMercatorBoundingBox = boundingBox .transform(projectionToWebMercator); }
java
public void setBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionToWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); webMercatorBoundingBox = boundingBox .transform(projectionToWebMercator); }
[ "public", "void", "setBoundingBox", "(", "BoundingBox", "boundingBox", ",", "Projection", "projection", ")", "{", "ProjectionTransform", "projectionToWebMercator", "=", "projection", ".", "getTransformation", "(", "ProjectionConstants", ".", "EPSG_WEB_MERCATOR", ")", ";",...
Set the bounding box, provided as the indicated projection @param boundingBox bounding box @param projection projection
[ "Set", "the", "bounding", "box", "provided", "as", "the", "indicated", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L85-L90
36,799
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.getBoundingBox
public BoundingBox getBoundingBox(Projection projection) { ProjectionTransform webMercatorToProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR) .getTransformation(projection); return webMercatorBoundingBox .transform(webMercatorToProjection); }
java
public BoundingBox getBoundingBox(Projection projection) { ProjectionTransform webMercatorToProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR) .getTransformation(projection); return webMercatorBoundingBox .transform(webMercatorToProjection); }
[ "public", "BoundingBox", "getBoundingBox", "(", "Projection", "projection", ")", "{", "ProjectionTransform", "webMercatorToProjection", "=", "ProjectionFactory", ".", "getProjection", "(", "ProjectionConstants", ".", "EPSG_WEB_MERCATOR", ")", ".", "getTransformation", "(", ...
Get the bounding box as the provided projection @param projection projection
[ "Get", "the", "bounding", "box", "as", "the", "provided", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L106-L112