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
partition
stringclasses
1 value
jboss/jboss-jsp-api_spec
src/main/java/javax/servlet/jsp/tagext/TagLibraryInfo.java
TagLibraryInfo.getFunction
public FunctionInfo getFunction(String name) { if (functions == null || functions.length == 0) { System.err.println("No functions"); return null; } for (int i=0; i < functions.length; i++) { if (functions[i].getName().equals(name)) { return f...
java
public FunctionInfo getFunction(String name) { if (functions == null || functions.length == 0) { System.err.println("No functions"); return null; } for (int i=0; i < functions.length; i++) { if (functions[i].getName().equals(name)) { return f...
[ "public", "FunctionInfo", "getFunction", "(", "String", "name", ")", "{", "if", "(", "functions", "==", "null", "||", "functions", ".", "length", "==", "0", ")", "{", "System", ".", "err", ".", "println", "(", "\"No functions\"", ")", ";", "return", "nul...
Get the FunctionInfo for a given function name, looking through all the functions in this tag library. @param name The name (no prefix) of the function @return the FunctionInfo for the function with the given name, or null if no such function exists @since JSP 2.0
[ "Get", "the", "FunctionInfo", "for", "a", "given", "function", "name", "looking", "through", "all", "the", "functions", "in", "this", "tag", "library", "." ]
da53166619f33a5134dc3315a3264990cc1f541f
https://github.com/jboss/jboss-jsp-api_spec/blob/da53166619f33a5134dc3315a3264990cc1f541f/src/main/java/javax/servlet/jsp/tagext/TagLibraryInfo.java#L245-L258
train
threerings/nenya
core/src/main/java/com/threerings/openal/OggStreamDecoder.java
OggStreamDecoder.readSamples
protected int readSamples () throws IOException { int samples; while ((samples = _dsp.synthesis_pcmout(_pcm, _offsets)) <= 0) { if (samples == 0 && !readPacket()) { return 0; } if (_block.synthesis(_packet) == 0) { _dsp.synt...
java
protected int readSamples () throws IOException { int samples; while ((samples = _dsp.synthesis_pcmout(_pcm, _offsets)) <= 0) { if (samples == 0 && !readPacket()) { return 0; } if (_block.synthesis(_packet) == 0) { _dsp.synt...
[ "protected", "int", "readSamples", "(", ")", "throws", "IOException", "{", "int", "samples", ";", "while", "(", "(", "samples", "=", "_dsp", ".", "synthesis_pcmout", "(", "_pcm", ",", "_offsets", ")", ")", "<=", "0", ")", "{", "if", "(", "samples", "==...
Reads a buffer's worth of samples. @return the number of samples read, or zero if we've reached the end of the stream.
[ "Reads", "a", "buffer", "s", "worth", "of", "samples", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/OggStreamDecoder.java#L137-L150
train
threerings/nenya
core/src/main/java/com/threerings/openal/OggStreamDecoder.java
OggStreamDecoder.readPacket
protected boolean readPacket () throws IOException { int result; while ((result = _stream.packetout(_packet)) != 1) { if (result == 0 && !readPage()) { return false; } } return true; }
java
protected boolean readPacket () throws IOException { int result; while ((result = _stream.packetout(_packet)) != 1) { if (result == 0 && !readPage()) { return false; } } return true; }
[ "protected", "boolean", "readPacket", "(", ")", "throws", "IOException", "{", "int", "result", ";", "while", "(", "(", "result", "=", "_stream", ".", "packetout", "(", "_packet", ")", ")", "!=", "1", ")", "{", "if", "(", "result", "==", "0", "&&", "!...
Reads a packet. @return true if a packet was read, false if we've reached the end of the stream.
[ "Reads", "a", "packet", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/OggStreamDecoder.java#L157-L167
train
threerings/nenya
core/src/main/java/com/threerings/openal/OggStreamDecoder.java
OggStreamDecoder.readPage
protected boolean readPage () throws IOException { int result; while ((result = _sync.pageout(_page)) != 1) { if (result == 0 && !readChunk()) { return false; } } _stream.pagein(_page); return true; }
java
protected boolean readPage () throws IOException { int result; while ((result = _sync.pageout(_page)) != 1) { if (result == 0 && !readChunk()) { return false; } } _stream.pagein(_page); return true; }
[ "protected", "boolean", "readPage", "(", ")", "throws", "IOException", "{", "int", "result", ";", "while", "(", "(", "result", "=", "_sync", ".", "pageout", "(", "_page", ")", ")", "!=", "1", ")", "{", "if", "(", "result", "==", "0", "&&", "!", "re...
Reads in a page. @return true if a page was read, false if we've reached the end of the stream.
[ "Reads", "in", "a", "page", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/OggStreamDecoder.java#L174-L185
train
threerings/nenya
core/src/main/java/com/threerings/openal/OggStreamDecoder.java
OggStreamDecoder.readChunk
protected boolean readChunk () throws IOException { int offset = _sync.buffer(BUFFER_SIZE); int bytes = _in.read(_sync.data, offset, BUFFER_SIZE); if (bytes > 0) { _sync.wrote(bytes); return true; } return false; }
java
protected boolean readChunk () throws IOException { int offset = _sync.buffer(BUFFER_SIZE); int bytes = _in.read(_sync.data, offset, BUFFER_SIZE); if (bytes > 0) { _sync.wrote(bytes); return true; } return false; }
[ "protected", "boolean", "readChunk", "(", ")", "throws", "IOException", "{", "int", "offset", "=", "_sync", ".", "buffer", "(", "BUFFER_SIZE", ")", ";", "int", "bytes", "=", "_in", ".", "read", "(", "_sync", ".", "data", ",", "offset", ",", "BUFFER_SIZE"...
Reads in a chunk of data from the underlying input stream. @return true if a chunk was read, false if we've reached the end of the stream.
[ "Reads", "in", "a", "chunk", "of", "data", "from", "the", "underlying", "input", "stream", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/OggStreamDecoder.java#L192-L202
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/TrimmedTileSet.java
TrimmedTileSet.trimTileSet
public static TrimmedTileSet trimTileSet (TileSet source, OutputStream destImage) throws IOException { return trimTileSet(source, destImage, FastImageIO.FILE_SUFFIX); }
java
public static TrimmedTileSet trimTileSet (TileSet source, OutputStream destImage) throws IOException { return trimTileSet(source, destImage, FastImageIO.FILE_SUFFIX); }
[ "public", "static", "TrimmedTileSet", "trimTileSet", "(", "TileSet", "source", ",", "OutputStream", "destImage", ")", "throws", "IOException", "{", "return", "trimTileSet", "(", "source", ",", "destImage", ",", "FastImageIO", ".", "FILE_SUFFIX", ")", ";", "}" ]
Convenience function to trim the tile set and save it using FastImageIO.
[ "Convenience", "function", "to", "trim", "the", "tile", "set", "and", "save", "it", "using", "FastImageIO", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TrimmedTileSet.java#L67-L71
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.sourceIsReady
public boolean sourceIsReady () { // make a note of our source's last modification time _sourceLastMod = _source.lastModified(); // if we are unpacking files, the time to do so is now if (_unpacked != null && _unpacked.lastModified() != _sourceLastMod) { try { ...
java
public boolean sourceIsReady () { // make a note of our source's last modification time _sourceLastMod = _source.lastModified(); // if we are unpacking files, the time to do so is now if (_unpacked != null && _unpacked.lastModified() != _sourceLastMod) { try { ...
[ "public", "boolean", "sourceIsReady", "(", ")", "{", "// make a note of our source's last modification time", "_sourceLastMod", "=", "_source", ".", "lastModified", "(", ")", ";", "// if we are unpacking files, the time to do so is now", "if", "(", "_unpacked", "!=", "null", ...
Called by the resource manager once it has ensured that our resource jar file is up to date and ready for reading. @return true if we successfully unpacked our resources, false if we encountered errors in doing so.
[ "Called", "by", "the", "resource", "manager", "once", "it", "has", "ensured", "that", "our", "resource", "jar", "file", "is", "up", "to", "date", "and", "ready", "for", "reading", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L124-L172
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.wipeBundle
public void wipeBundle (boolean deleteJar) { // clear out our cache directory if (_cache != null) { FileUtil.recursiveClean(_cache); } // delete our unpack stamp file if (_unpacked != null) { _unpacked.delete(); } // clear out any .ja...
java
public void wipeBundle (boolean deleteJar) { // clear out our cache directory if (_cache != null) { FileUtil.recursiveClean(_cache); } // delete our unpack stamp file if (_unpacked != null) { _unpacked.delete(); } // clear out any .ja...
[ "public", "void", "wipeBundle", "(", "boolean", "deleteJar", ")", "{", "// clear out our cache directory", "if", "(", "_cache", "!=", "null", ")", "{", "FileUtil", ".", "recursiveClean", "(", "_cache", ")", ";", "}", "// delete our unpack stamp file", "if", "(", ...
Clears out everything associated with this resource bundle in the hopes that we can download it afresh and everything will work the next time around.
[ "Clears", "out", "everything", "associated", "with", "this", "resource", "bundle", "in", "the", "hopes", "that", "we", "can", "download", "it", "afresh", "and", "everything", "will", "work", "the", "next", "time", "around", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L178-L205
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.getResourceFile
public File getResourceFile (String path) throws IOException { if (resolveJarFile()) { return null; } // if we have been unpacked, return our unpacked file if (_cache != null) { File cfile = new File(_cache, path); if (cfile.exists()) { ...
java
public File getResourceFile (String path) throws IOException { if (resolveJarFile()) { return null; } // if we have been unpacked, return our unpacked file if (_cache != null) { File cfile = new File(_cache, path); if (cfile.exists()) { ...
[ "public", "File", "getResourceFile", "(", "String", "path", ")", "throws", "IOException", "{", "if", "(", "resolveJarFile", "(", ")", ")", "{", "return", "null", ";", "}", "// if we have been unpacked, return our unpacked file", "if", "(", "_cache", "!=", "null", ...
Returns a file from which the specified resource can be loaded. This method will unpack the resource into a temporary directory and return a reference to that file. @param path the path to the resource in this jar file. @return a file from which the resource can be loaded or null if no such resource exists.
[ "Returns", "a", "file", "from", "which", "the", "specified", "resource", "can", "be", "loaded", ".", "This", "method", "will", "unpack", "the", "resource", "into", "a", "temporary", "directory", "and", "return", "a", "reference", "to", "that", "file", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L215-L253
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.containsResource
public boolean containsResource (String path) { try { if (resolveJarFile()) { return false; } return (_jarSource.getJarEntry(path) != null); } catch (IOException ioe) { return false; } }
java
public boolean containsResource (String path) { try { if (resolveJarFile()) { return false; } return (_jarSource.getJarEntry(path) != null); } catch (IOException ioe) { return false; } }
[ "public", "boolean", "containsResource", "(", "String", "path", ")", "{", "try", "{", "if", "(", "resolveJarFile", "(", ")", ")", "{", "return", "false", ";", "}", "return", "(", "_jarSource", ".", "getJarEntry", "(", "path", ")", "!=", "null", ")", ";...
Returns true if this resource bundle contains the resource with the specified path. This avoids actually loading the resource, in the event that the caller only cares to know that the resource exists.
[ "Returns", "true", "if", "this", "resource", "bundle", "contains", "the", "resource", "with", "the", "specified", "path", ".", "This", "avoids", "actually", "loading", "the", "resource", "in", "the", "event", "that", "the", "caller", "only", "cares", "to", "...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L260-L270
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.resolveJarFile
protected boolean resolveJarFile () throws IOException { // if we don't yet have our resource bundle's last mod time, we // have not yet been notified that it is ready if (_sourceLastMod == -1) { return true; } if (!_source.exists()) { throw n...
java
protected boolean resolveJarFile () throws IOException { // if we don't yet have our resource bundle's last mod time, we // have not yet been notified that it is ready if (_sourceLastMod == -1) { return true; } if (!_source.exists()) { throw n...
[ "protected", "boolean", "resolveJarFile", "(", ")", "throws", "IOException", "{", "// if we don't yet have our resource bundle's last mod time, we", "// have not yet been notified that it is ready", "if", "(", "_sourceLastMod", "==", "-", "1", ")", "{", "return", "true", ";",...
Creates the internal jar file reference if we've not already got it; we do this lazily so as to avoid any jar- or zip-file-related antics until and unless doing so is required, and because the resource manager would like to be able to create bundles before the associated files have been fully downloaded. @return true ...
[ "Creates", "the", "internal", "jar", "file", "reference", "if", "we", "ve", "not", "already", "got", "it", ";", "we", "do", "this", "lazily", "so", "as", "to", "avoid", "any", "jar", "-", "or", "zip", "-", "file", "-", "related", "antics", "until", "...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L294-L318
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.getCacheDir
public static File getCacheDir () { if (_tmpdir == null) { String tmpdir = System.getProperty("java.io.tmpdir"); if (tmpdir == null) { log.info("No system defined temp directory. Faking it."); tmpdir = System.getProperty("user.home"); } ...
java
public static File getCacheDir () { if (_tmpdir == null) { String tmpdir = System.getProperty("java.io.tmpdir"); if (tmpdir == null) { log.info("No system defined temp directory. Faking it."); tmpdir = System.getProperty("user.home"); } ...
[ "public", "static", "File", "getCacheDir", "(", ")", "{", "if", "(", "_tmpdir", "==", "null", ")", "{", "String", "tmpdir", "=", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ")", ";", "if", "(", "tmpdir", "==", "null", ")", "{", "log", ".",...
Returns the cache directory used for unpacked resources.
[ "Returns", "the", "cache", "directory", "used", "for", "unpacked", "resources", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L337-L348
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.setCacheDir
public static void setCacheDir (File tmpdir) { String rando = Long.toHexString((long)(Math.random() * Long.MAX_VALUE)); _tmpdir = new File(tmpdir, "narcache_" + rando); if (!_tmpdir.exists()) { if (_tmpdir.mkdirs()) { log.debug("Created narya temp cache directory ...
java
public static void setCacheDir (File tmpdir) { String rando = Long.toHexString((long)(Math.random() * Long.MAX_VALUE)); _tmpdir = new File(tmpdir, "narcache_" + rando); if (!_tmpdir.exists()) { if (_tmpdir.mkdirs()) { log.debug("Created narya temp cache directory ...
[ "public", "static", "void", "setCacheDir", "(", "File", "tmpdir", ")", "{", "String", "rando", "=", "Long", ".", "toHexString", "(", "(", "long", ")", "(", "Math", ".", "random", "(", ")", "*", "Long", ".", "MAX_VALUE", ")", ")", ";", "_tmpdir", "=",...
Specifies the directory in which our temporary resource files should be stored.
[ "Specifies", "the", "directory", "in", "which", "our", "temporary", "resource", "files", "should", "be", "stored", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L353-L373
train
threerings/nenya
core/src/main/java/com/threerings/resource/FileResourceBundle.java
FileResourceBundle.stripSuffix
protected static String stripSuffix (String path) { if (path.endsWith(".jar")) { return path.substring(0, path.length()-4); } else { // we have to change the path somehow return path + "-cache"; } }
java
protected static String stripSuffix (String path) { if (path.endsWith(".jar")) { return path.substring(0, path.length()-4); } else { // we have to change the path somehow return path + "-cache"; } }
[ "protected", "static", "String", "stripSuffix", "(", "String", "path", ")", "{", "if", "(", "path", ".", "endsWith", "(", "\".jar\"", ")", ")", "{", "return", "path", ".", "substring", "(", "0", ",", "path", ".", "length", "(", ")", "-", "4", ")", ...
Strips the .jar off of jar file paths.
[ "Strips", "the", ".", "jar", "off", "of", "jar", "file", "paths", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L376-L384
train
calrissian/mango
mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterators.java
CloseableIterators.distinct
public static <T> CloseableIterator<T> distinct(final CloseableIterator<T> iterator) { return wrap(Iterators2.distinct(iterator), iterator); }
java
public static <T> CloseableIterator<T> distinct(final CloseableIterator<T> iterator) { return wrap(Iterators2.distinct(iterator), iterator); }
[ "public", "static", "<", "T", ">", "CloseableIterator", "<", "T", ">", "distinct", "(", "final", "CloseableIterator", "<", "T", ">", "iterator", ")", "{", "return", "wrap", "(", "Iterators2", ".", "distinct", "(", "iterator", ")", ",", "iterator", ")", "...
If we can assume the closeable iterator is sorted, return the distinct elements. This only works if the data provided is sorted.
[ "If", "we", "can", "assume", "the", "closeable", "iterator", "is", "sorted", "return", "the", "distinct", "elements", ".", "This", "only", "works", "if", "the", "data", "provided", "is", "sorted", "." ]
a95aa5e77af9aa0e629787228d80806560023452
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterators.java#L91-L93
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.stream
public Stream<RangeWithCount> stream() { return buckets_.stream() .map(bucket -> new RangeWithCount(bucket.getRange(), bucket.getEvents())); }
java
public Stream<RangeWithCount> stream() { return buckets_.stream() .map(bucket -> new RangeWithCount(bucket.getRange(), bucket.getEvents())); }
[ "public", "Stream", "<", "RangeWithCount", ">", "stream", "(", ")", "{", "return", "buckets_", ".", "stream", "(", ")", ".", "map", "(", "bucket", "->", "new", "RangeWithCount", "(", "bucket", ".", "getRange", "(", ")", ",", "bucket", ".", "getEvents", ...
Returns a map of range -&gt; event count. The elements of the stream are a mutable copy of the internal data.
[ "Returns", "a", "map", "of", "range", "-", "&gt", ";", "event", "count", ".", "The", "elements", "of", "the", "stream", "are", "a", "mutable", "copy", "of", "the", "internal", "data", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L79-L82
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.avg
public Optional<Double> avg() { if (isEmpty()) return Optional.empty(); return Optional.of(sum() / getEventCount()); }
java
public Optional<Double> avg() { if (isEmpty()) return Optional.empty(); return Optional.of(sum() / getEventCount()); }
[ "public", "Optional", "<", "Double", ">", "avg", "(", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "return", "Optional", ".", "empty", "(", ")", ";", "return", "Optional", ".", "of", "(", "sum", "(", ")", "/", "getEventCount", "(", ")", ")", ";...
Return the average of the histogram.
[ "Return", "the", "average", "of", "the", "histogram", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L125-L128
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.sum
public double sum() { return buckets_.stream() .mapToDouble(b -> b.getRange().getMidPoint() * b.getEvents()) .sum(); }
java
public double sum() { return buckets_.stream() .mapToDouble(b -> b.getRange().getMidPoint() * b.getEvents()) .sum(); }
[ "public", "double", "sum", "(", ")", "{", "return", "buckets_", ".", "stream", "(", ")", ".", "mapToDouble", "(", "b", "->", "b", ".", "getRange", "(", ")", ".", "getMidPoint", "(", ")", "*", "b", ".", "getEvents", "(", ")", ")", ".", "sum", "(",...
Return the sum of the histogram.
[ "Return", "the", "sum", "of", "the", "histogram", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L133-L137
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.get
public double get(double index) { ListIterator<Bucket> b = buckets_.listIterator(0); ListIterator<Bucket> e = buckets_.listIterator(buckets_.size()); while (b.nextIndex() < e.previousIndex()) { final ListIterator<Bucket> mid = buckets_.listIterator(b.nextIndex() / 2 + e.nextIndex() ...
java
public double get(double index) { ListIterator<Bucket> b = buckets_.listIterator(0); ListIterator<Bucket> e = buckets_.listIterator(buckets_.size()); while (b.nextIndex() < e.previousIndex()) { final ListIterator<Bucket> mid = buckets_.listIterator(b.nextIndex() / 2 + e.nextIndex() ...
[ "public", "double", "get", "(", "double", "index", ")", "{", "ListIterator", "<", "Bucket", ">", "b", "=", "buckets_", ".", "listIterator", "(", "0", ")", ";", "ListIterator", "<", "Bucket", ">", "e", "=", "buckets_", ".", "listIterator", "(", "buckets_"...
Get the value at a given position.
[ "Get", "the", "value", "at", "a", "given", "position", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L142-L171
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.modifyEventCounters
public Histogram modifyEventCounters(BiFunction<Range, Double, Double> fn) { return new Histogram(stream() .map(entry -> { entry.setCount(fn.apply(entry.getRange(), entry.getCount())); return entry; })); }
java
public Histogram modifyEventCounters(BiFunction<Range, Double, Double> fn) { return new Histogram(stream() .map(entry -> { entry.setCount(fn.apply(entry.getRange(), entry.getCount())); return entry; })); }
[ "public", "Histogram", "modifyEventCounters", "(", "BiFunction", "<", "Range", ",", "Double", ",", "Double", ">", "fn", ")", "{", "return", "new", "Histogram", "(", "stream", "(", ")", ".", "map", "(", "entry", "->", "{", "entry", ".", "setCount", "(", ...
Create a new histogram, after applying the function on each of the event counters.
[ "Create", "a", "new", "histogram", "after", "applying", "the", "function", "on", "each", "of", "the", "event", "counters", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L184-L190
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.add
public static Histogram add(Histogram x, Histogram y) { return new Histogram(Stream.concat(x.stream(), y.stream())); }
java
public static Histogram add(Histogram x, Histogram y) { return new Histogram(Stream.concat(x.stream(), y.stream())); }
[ "public", "static", "Histogram", "add", "(", "Histogram", "x", ",", "Histogram", "y", ")", "{", "return", "new", "Histogram", "(", "Stream", ".", "concat", "(", "x", ".", "stream", "(", ")", ",", "y", ".", "stream", "(", ")", ")", ")", ";", "}" ]
Add two histograms together.
[ "Add", "two", "histograms", "together", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L195-L197
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.subtract
public static Histogram subtract(Histogram x, Histogram y) { return new Histogram(Stream.concat( x.stream(), y.stream().map(rwc -> { rwc.setCount(-rwc.getCount()); return rwc; }))); }
java
public static Histogram subtract(Histogram x, Histogram y) { return new Histogram(Stream.concat( x.stream(), y.stream().map(rwc -> { rwc.setCount(-rwc.getCount()); return rwc; }))); }
[ "public", "static", "Histogram", "subtract", "(", "Histogram", "x", ",", "Histogram", "y", ")", "{", "return", "new", "Histogram", "(", "Stream", ".", "concat", "(", "x", ".", "stream", "(", ")", ",", "y", ".", "stream", "(", ")", ".", "map", "(", ...
Subtracts two histograms. @throws IllegalArgumentException If the result contains mixed signs.
[ "Subtracts", "two", "histograms", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L211-L218
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.multiply
public static Histogram multiply(Histogram x, double y) { return x.modifyEventCounters((r, d) -> d * y); }
java
public static Histogram multiply(Histogram x, double y) { return x.modifyEventCounters((r, d) -> d * y); }
[ "public", "static", "Histogram", "multiply", "(", "Histogram", "x", ",", "double", "y", ")", "{", "return", "x", ".", "modifyEventCounters", "(", "(", "r", ",", "d", ")", "->", "d", "*", "y", ")", ";", "}" ]
Multiply histogram by scalar.
[ "Multiply", "histogram", "by", "scalar", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L223-L225
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.divide
public static Histogram divide(Histogram x, double y) { return x.modifyEventCounters((r, d) -> d / y); }
java
public static Histogram divide(Histogram x, double y) { return x.modifyEventCounters((r, d) -> d / y); }
[ "public", "static", "Histogram", "divide", "(", "Histogram", "x", ",", "double", "y", ")", "{", "return", "x", ".", "modifyEventCounters", "(", "(", "r", ",", "d", ")", "->", "d", "/", "y", ")", ";", "}" ]
Divide histogram by scalar.
[ "Divide", "histogram", "by", "scalar", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L230-L232
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/Histogram.java
Histogram.compareTo
@Override public int compareTo(Histogram o) { int cmp = 0; final Iterator<Bucket> iter = buckets_.iterator(), o_iter = o.buckets_.iterator(); while (cmp == 0 && iter.hasNext() && o_iter.hasNext()) { final Bucket next = iter.next(), o_next = o_iter.next(); cmp = Double...
java
@Override public int compareTo(Histogram o) { int cmp = 0; final Iterator<Bucket> iter = buckets_.iterator(), o_iter = o.buckets_.iterator(); while (cmp == 0 && iter.hasNext() && o_iter.hasNext()) { final Bucket next = iter.next(), o_next = o_iter.next(); cmp = Double...
[ "@", "Override", "public", "int", "compareTo", "(", "Histogram", "o", ")", "{", "int", "cmp", "=", "0", ";", "final", "Iterator", "<", "Bucket", ">", "iter", "=", "buckets_", ".", "iterator", "(", ")", ",", "o_iter", "=", "o", ".", "buckets_", ".", ...
Compare two histograms.
[ "Compare", "two", "histograms", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L259-L275
train
jdillon/gshell
gshell-util/src/main/java/com/planet57/gshell/util/converter/collections/MapConverterSupport.java
MapConverterSupport.convertToObject
@Override protected final Object convertToObject(final String text) throws Exception { Map map = CollectionUtil.toMap(text, keyEditor, valueEditor); if (map == null) { return null; } return createMap(map); }
java
@Override protected final Object convertToObject(final String text) throws Exception { Map map = CollectionUtil.toMap(text, keyEditor, valueEditor); if (map == null) { return null; } return createMap(map); }
[ "@", "Override", "protected", "final", "Object", "convertToObject", "(", "final", "String", "text", ")", "throws", "Exception", "{", "Map", "map", "=", "CollectionUtil", ".", "toMap", "(", "text", ",", "keyEditor", ",", "valueEditor", ")", ";", "if", "(", ...
Treats the text value of this property as an input stream that is converted into a Property bundle. @return a Properties object @throws ConversionException An error occurred creating the Properties object.
[ "Treats", "the", "text", "value", "of", "this", "property", "as", "an", "input", "stream", "that", "is", "converted", "into", "a", "Property", "bundle", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-util/src/main/java/com/planet57/gshell/util/converter/collections/MapConverterSupport.java#L56-L63
train
Systemdir/GML-Writer-for-yED
Example/src/com/github/systemdir/gml/examples/example1/ExampleGraphicsProvider.java
ExampleGraphicsProvider.getGroupGraphics
@Nullable @Override public NodeGraphicDefinition getGroupGraphics(Object group, Set<String> groupElements) { return null; }
java
@Nullable @Override public NodeGraphicDefinition getGroupGraphics(Object group, Set<String> groupElements) { return null; }
[ "@", "Nullable", "@", "Override", "public", "NodeGraphicDefinition", "getGroupGraphics", "(", "Object", "group", ",", "Set", "<", "String", ">", "groupElements", ")", "{", "return", "null", ";", "}" ]
we have no groups in this example
[ "we", "have", "no", "groups", "in", "this", "example" ]
353ecf132929889cb15968865283ee511f7c8d87
https://github.com/Systemdir/GML-Writer-for-yED/blob/353ecf132929889cb15968865283ee511f7c8d87/Example/src/com/github/systemdir/gml/examples/example1/ExampleGraphicsProvider.java#L36-L40
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.name
public static final String name(SimpleGroupPath group, MetricName metric) { return name(Stream.concat(group.getPath().stream(), metric.getPath().stream()) .collect(Collectors.joining("."))); }
java
public static final String name(SimpleGroupPath group, MetricName metric) { return name(Stream.concat(group.getPath().stream(), metric.getPath().stream()) .collect(Collectors.joining("."))); }
[ "public", "static", "final", "String", "name", "(", "SimpleGroupPath", "group", ",", "MetricName", "metric", ")", "{", "return", "name", "(", "Stream", ".", "concat", "(", "group", ".", "getPath", "(", ")", ".", "stream", "(", ")", ",", "metric", ".", ...
Convert a group+metric to a wavefront name. Concatenates the paths of a Group and a Metric, separating each path element with a dot ('.'). Example: - group path: [ 'example', 'group', 'path' ] - and metric: [ 'metric', 'name' ] are concatenated into "example.group.path.metric.name". The concatenated name is cleaned ...
[ "Convert", "a", "group", "+", "metric", "to", "a", "wavefront", "name", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L80-L83
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.createTagEntry
private static Optional<Map.Entry<String, String>> createTagEntry(Map.Entry<String, MetricValue> tag_entry) { final Optional<String> opt_tag_value = tag_entry.getValue().asString(); return opt_tag_value .map(tag_value -> SimpleMapEntry.create(name(tag_entry.getKey()), escapeTagValue(tag_...
java
private static Optional<Map.Entry<String, String>> createTagEntry(Map.Entry<String, MetricValue> tag_entry) { final Optional<String> opt_tag_value = tag_entry.getValue().asString(); return opt_tag_value .map(tag_value -> SimpleMapEntry.create(name(tag_entry.getKey()), escapeTagValue(tag_...
[ "private", "static", "Optional", "<", "Map", ".", "Entry", "<", "String", ",", "String", ">", ">", "createTagEntry", "(", "Map", ".", "Entry", "<", "String", ",", "MetricValue", ">", "tag_entry", ")", "{", "final", "Optional", "<", "String", ">", "opt_ta...
Transform a tag entry into a wavefront tag. Double quotes in the tag value will be escaped.
[ "Transform", "a", "tag", "entry", "into", "a", "wavefront", "tag", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L100-L104
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.maybeTruncateTagEntry
private static Map.Entry<String, String> maybeTruncateTagEntry(Map.Entry<String, String> tag_entry) { String k = tag_entry.getKey(); String v = tag_entry.getValue(); if (k.length() + v.length() <= MAX_TAG_KEY_VAL_CHARS - 2) // 2 chars for the quotes around the value return tag_entry;...
java
private static Map.Entry<String, String> maybeTruncateTagEntry(Map.Entry<String, String> tag_entry) { String k = tag_entry.getKey(); String v = tag_entry.getValue(); if (k.length() + v.length() <= MAX_TAG_KEY_VAL_CHARS - 2) // 2 chars for the quotes around the value return tag_entry;...
[ "private", "static", "Map", ".", "Entry", "<", "String", ",", "String", ">", "maybeTruncateTagEntry", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "tag_entry", ")", "{", "String", "k", "=", "tag_entry", ".", "getKey", "(", ")", ";", "St...
Truncate tag keys and values, to prevent them from exceeding the max length of a tag entry.
[ "Truncate", "tag", "keys", "and", "values", "to", "prevent", "them", "from", "exceeding", "the", "max", "length", "of", "a", "tag", "entry", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L110-L121
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.tags
public static Map<String, String> tags(Tags tags) { return tags.stream() .map(WavefrontStrings::createTagEntry) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty)) .map(WavefrontStrings::maybeTruncateTagEntry) .collect(Collectors.toMap(Ma...
java
public static Map<String, String> tags(Tags tags) { return tags.stream() .map(WavefrontStrings::createTagEntry) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty)) .map(WavefrontStrings::maybeTruncateTagEntry) .collect(Collectors.toMap(Ma...
[ "public", "static", "Map", "<", "String", ",", "String", ">", "tags", "(", "Tags", "tags", ")", "{", "return", "tags", ".", "stream", "(", ")", ".", "map", "(", "WavefrontStrings", "::", "createTagEntry", ")", ".", "flatMap", "(", "opt", "->", "opt", ...
Create a map of tags for wavefront. The tag values are escaped and should be surrounded by double quotes. This function does not put the surrounding quotes around the tag values.
[ "Create", "a", "map", "of", "tags", "for", "wavefront", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L129-L135
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.wavefrontValue
public static Optional<String> wavefrontValue(MetricValue mv) { // Omit NaN and Inf. if (mv.isInfiniteOrNaN()) return Optional.empty(); return mv.value().map(Number::toString); }
java
public static Optional<String> wavefrontValue(MetricValue mv) { // Omit NaN and Inf. if (mv.isInfiniteOrNaN()) return Optional.empty(); return mv.value().map(Number::toString); }
[ "public", "static", "Optional", "<", "String", ">", "wavefrontValue", "(", "MetricValue", "mv", ")", "{", "// Omit NaN and Inf.", "if", "(", "mv", ".", "isInfiniteOrNaN", "(", ")", ")", "return", "Optional", ".", "empty", "(", ")", ";", "return", "mv", "."...
Create a wavefront compatible string representation of the metric value. If the metric value is empty or not representable in wavefront, an empty optional will be returned.
[ "Create", "a", "wavefront", "compatible", "string", "representation", "of", "the", "metric", "value", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L143-L147
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.extractTagSource
private static String extractTagSource(Map<String, String> tag_map) { return Optional.ofNullable(tag_map.remove("source")) .orElseGet(() -> { return Optional.ofNullable(tag_map.get("cluster")) .map(WavefrontStrings::escapeTagValue) ...
java
private static String extractTagSource(Map<String, String> tag_map) { return Optional.ofNullable(tag_map.remove("source")) .orElseGet(() -> { return Optional.ofNullable(tag_map.get("cluster")) .map(WavefrontStrings::escapeTagValue) ...
[ "private", "static", "String", "extractTagSource", "(", "Map", "<", "String", ",", "String", ">", "tag_map", ")", "{", "return", "Optional", ".", "ofNullable", "(", "tag_map", ".", "remove", "(", "\"source\"", ")", ")", ".", "orElseGet", "(", "(", ")", "...
Extract the 'source' tag from the tag_map. Wavefront requires the 'source' tag to be the first tag on the line, hence the special handling. It also *must* be present, so we can never return null.
[ "Extract", "the", "source", "tag", "from", "the", "tag_map", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L164-L171
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.wavefrontLine
private static String wavefrontLine(DateTime ts, SimpleGroupPath group, MetricName metric, String value, String source, Map<String, String> tag_map) { return new StringBuilder() .append(name(group, metric)) .append(' ') .append(value) .append(' ') ...
java
private static String wavefrontLine(DateTime ts, SimpleGroupPath group, MetricName metric, String value, String source, Map<String, String> tag_map) { return new StringBuilder() .append(name(group, metric)) .append(' ') .append(value) .append(' ') ...
[ "private", "static", "String", "wavefrontLine", "(", "DateTime", "ts", ",", "SimpleGroupPath", "group", ",", "MetricName", "metric", ",", "String", "value", ",", "String", "source", ",", "Map", "<", "String", ",", "String", ">", "tag_map", ")", "{", "return"...
Build the wavefront line from its parts.
[ "Build", "the", "wavefront", "line", "from", "its", "parts", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L176-L191
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.wavefrontLine
public static Optional<String> wavefrontLine(DateTime ts, GroupName group, MetricName metric, MetricValue metric_value) { return wavefrontValue(metric_value) .map(value -> { final Map<String, String> tag_map = tags(group.getTags()); final String source = e...
java
public static Optional<String> wavefrontLine(DateTime ts, GroupName group, MetricName metric, MetricValue metric_value) { return wavefrontValue(metric_value) .map(value -> { final Map<String, String> tag_map = tags(group.getTags()); final String source = e...
[ "public", "static", "Optional", "<", "String", ">", "wavefrontLine", "(", "DateTime", "ts", ",", "GroupName", "group", ",", "MetricName", "metric", ",", "MetricValue", "metric_value", ")", "{", "return", "wavefrontValue", "(", "metric_value", ")", ".", "map", ...
Convert a metric to a wavefront string. Empty metrics and histograms do not emit a value. Note: the line is not terminated with a newline.
[ "Convert", "a", "metric", "to", "a", "wavefront", "string", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L200-L207
train
groupon/monsoon
processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java
WavefrontStrings.wavefrontLine
public static Stream<String> wavefrontLine(DateTime ts, TimeSeriesValue tsv) { final GroupName group = tsv.getGroup(); return tsv.getMetrics().entrySet().stream() .flatMap(metricEntry -> wavefrontLineForMetric(ts, group, metricEntry)); }
java
public static Stream<String> wavefrontLine(DateTime ts, TimeSeriesValue tsv) { final GroupName group = tsv.getGroup(); return tsv.getMetrics().entrySet().stream() .flatMap(metricEntry -> wavefrontLineForMetric(ts, group, metricEntry)); }
[ "public", "static", "Stream", "<", "String", ">", "wavefrontLine", "(", "DateTime", "ts", ",", "TimeSeriesValue", "tsv", ")", "{", "final", "GroupName", "group", "=", "tsv", ".", "getGroup", "(", ")", ";", "return", "tsv", ".", "getMetrics", "(", ")", "....
Convert a time series value into the string entries for wavefront. Note: the line is not terminated with a newline.
[ "Convert", "a", "time", "series", "value", "into", "the", "string", "entries", "for", "wavefront", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/processors/wavefront/src/main/java/com/groupon/lex/metrics/processors/wavefront/WavefrontStrings.java#L220-L225
train
threerings/nenya
core/src/main/java/com/threerings/media/util/ArcPath.java
ArcPath.getEndPos
public Point getEndPos () { return new Point( (int)(_center.x + Math.round(Math.cos(_sangle + _delta) * _xradius)), (int)(_center.y + Math.round(Math.sin(_sangle + _delta) * _yradius))); }
java
public Point getEndPos () { return new Point( (int)(_center.x + Math.round(Math.cos(_sangle + _delta) * _xradius)), (int)(_center.y + Math.round(Math.sin(_sangle + _delta) * _yradius))); }
[ "public", "Point", "getEndPos", "(", ")", "{", "return", "new", "Point", "(", "(", "int", ")", "(", "_center", ".", "x", "+", "Math", ".", "round", "(", "Math", ".", "cos", "(", "_sangle", "+", "_delta", ")", "*", "_xradius", ")", ")", ",", "(", ...
Returns the position of the end of the path.
[ "Returns", "the", "position", "of", "the", "end", "of", "the", "path", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/ArcPath.java#L114-L119
train
threerings/nenya
core/src/main/java/com/threerings/util/CompiledConfig.java
CompiledConfig.loadConfig
public static Serializable loadConfig (InputStream source) throws IOException { try { ObjectInputStream oin = new ObjectInputStream(source); return (Serializable)oin.readObject(); } catch (ClassNotFoundException cnfe) { String errmsg = "Unknown config clas...
java
public static Serializable loadConfig (InputStream source) throws IOException { try { ObjectInputStream oin = new ObjectInputStream(source); return (Serializable)oin.readObject(); } catch (ClassNotFoundException cnfe) { String errmsg = "Unknown config clas...
[ "public", "static", "Serializable", "loadConfig", "(", "InputStream", "source", ")", "throws", "IOException", "{", "try", "{", "ObjectInputStream", "oin", "=", "new", "ObjectInputStream", "(", "source", ")", ";", "return", "(", "Serializable", ")", "oin", ".", ...
Unserializes a configuration object from the supplied input stream.
[ "Unserializes", "a", "configuration", "object", "from", "the", "supplied", "input", "stream", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/CompiledConfig.java#L39-L49
train
threerings/nenya
core/src/main/java/com/threerings/util/CompiledConfig.java
CompiledConfig.saveConfig
public static void saveConfig (File target, Serializable config) throws IOException { FileOutputStream fout = new FileOutputStream(target); ObjectOutputStream oout = new ObjectOutputStream(fout); oout.writeObject(config); oout.close(); }
java
public static void saveConfig (File target, Serializable config) throws IOException { FileOutputStream fout = new FileOutputStream(target); ObjectOutputStream oout = new ObjectOutputStream(fout); oout.writeObject(config); oout.close(); }
[ "public", "static", "void", "saveConfig", "(", "File", "target", ",", "Serializable", "config", ")", "throws", "IOException", "{", "FileOutputStream", "fout", "=", "new", "FileOutputStream", "(", "target", ")", ";", "ObjectOutputStream", "oout", "=", "new", "Obj...
Serializes the supplied configuration object to the specified file path.
[ "Serializes", "the", "supplied", "configuration", "object", "to", "the", "specified", "file", "path", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/CompiledConfig.java#L54-L61
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.historyUpdated
public void historyUpdated (int adjustment) { if (adjustment != 0) { for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) { ChatGlyph cg = _showingHistory.get(ii); cg.histIndex -= adjustment; } // some history entries were deleted, ...
java
public void historyUpdated (int adjustment) { if (adjustment != 0) { for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) { ChatGlyph cg = _showingHistory.get(ii); cg.histIndex -= adjustment; } // some history entries were deleted, ...
[ "public", "void", "historyUpdated", "(", "int", "adjustment", ")", "{", "if", "(", "adjustment", "!=", "0", ")", "{", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "_showingHistory", ".", "size", "(", ")", ";", "ii", "<", "nn", ";", "ii", "+...
from interface HistoryList.Observer
[ "from", "interface", "HistoryList", ".", "Observer" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L92-L112
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.displayMessage
public boolean displayMessage (ChatMessage message, boolean alreadyDisplayed) { // nothing doing if we've not been laid out if (!isLaidOut()) { return false; } // possibly display it now Graphics2D gfx = getTargetGraphics(); if (gfx != null) { ...
java
public boolean displayMessage (ChatMessage message, boolean alreadyDisplayed) { // nothing doing if we've not been laid out if (!isLaidOut()) { return false; } // possibly display it now Graphics2D gfx = getTargetGraphics(); if (gfx != null) { ...
[ "public", "boolean", "displayMessage", "(", "ChatMessage", "message", ",", "boolean", "alreadyDisplayed", ")", "{", "// nothing doing if we've not been laid out", "if", "(", "!", "isLaidOut", "(", ")", ")", "{", "return", "false", ";", "}", "// possibly display it now...
documentation inherited from superinterface ChatDisplay
[ "documentation", "inherited", "from", "superinterface", "ChatDisplay" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L130-L145
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.updateDimmed
protected void updateDimmed (List<? extends ChatGlyph> glyphs) { for (ChatGlyph glyph : glyphs) { glyph.setDim(_dimmed); } }
java
protected void updateDimmed (List<? extends ChatGlyph> glyphs) { for (ChatGlyph glyph : glyphs) { glyph.setDim(_dimmed); } }
[ "protected", "void", "updateDimmed", "(", "List", "<", "?", "extends", "ChatGlyph", ">", "glyphs", ")", "{", "for", "(", "ChatGlyph", "glyph", ":", "glyphs", ")", "{", "glyph", ".", "setDim", "(", "_dimmed", ")", ";", "}", "}" ]
Update the chat glyphs in the specified list to be set to the current dimmed setting.
[ "Update", "the", "chat", "glyphs", "in", "the", "specified", "list", "to", "be", "set", "to", "the", "current", "dimmed", "setting", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L284-L289
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.setHistoryEnabled
protected void setHistoryEnabled (boolean historyEnabled) { if (historyEnabled && _historyModel == null) { _historyModel = _scrollbar.getModel(); _historyModel.addChangeListener(this); resetHistoryOffset(); // out with the subtitles, we'll be displaying histo...
java
protected void setHistoryEnabled (boolean historyEnabled) { if (historyEnabled && _historyModel == null) { _historyModel = _scrollbar.getModel(); _historyModel.addChangeListener(this); resetHistoryOffset(); // out with the subtitles, we'll be displaying histo...
[ "protected", "void", "setHistoryEnabled", "(", "boolean", "historyEnabled", ")", "{", "if", "(", "historyEnabled", "&&", "_historyModel", "==", "null", ")", "{", "_historyModel", "=", "_scrollbar", ".", "getModel", "(", ")", ";", "_historyModel", ".", "addChange...
Configures us for display of chat history or not.
[ "Configures", "us", "for", "display", "of", "chat", "history", "or", "not", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L311-L334
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.viewDidScroll
protected void viewDidScroll (List<? extends ChatGlyph> glyphs, int dx, int dy) { for (ChatGlyph glyph : glyphs) { glyph.viewDidScroll(dx, dy); } }
java
protected void viewDidScroll (List<? extends ChatGlyph> glyphs, int dx, int dy) { for (ChatGlyph glyph : glyphs) { glyph.viewDidScroll(dx, dy); } }
[ "protected", "void", "viewDidScroll", "(", "List", "<", "?", "extends", "ChatGlyph", ">", "glyphs", ",", "int", "dx", ",", "int", "dy", ")", "{", "for", "(", "ChatGlyph", "glyph", ":", "glyphs", ")", "{", "glyph", ".", "viewDidScroll", "(", "dx", ",", ...
Helper function for informing glyphs of the scrolled view.
[ "Helper", "function", "for", "informing", "glyphs", "of", "the", "scrolled", "view", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L339-L344
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.updateHistBar
protected void updateHistBar (int val) { // we may need to figure out the new history offset amount.. if (!_histOffsetFinal && _history.size() > _histOffset) { Graphics2D gfx = getTargetGraphics(); if (gfx != null) { figureHistoryOffset(gfx); g...
java
protected void updateHistBar (int val) { // we may need to figure out the new history offset amount.. if (!_histOffsetFinal && _history.size() > _histOffset) { Graphics2D gfx = getTargetGraphics(); if (gfx != null) { figureHistoryOffset(gfx); g...
[ "protected", "void", "updateHistBar", "(", "int", "val", ")", "{", "// we may need to figure out the new history offset amount..", "if", "(", "!", "_histOffsetFinal", "&&", "_history", ".", "size", "(", ")", ">", "_histOffset", ")", "{", "Graphics2D", "gfx", "=", ...
Update the history scrollbar with the specified value.
[ "Update", "the", "history", "scrollbar", "with", "the", "specified", "value", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L349-L372
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.figureHistoryOffset
protected void figureHistoryOffset (Graphics2D gfx) { if (!isLaidOut()) { return; } int hei = _subtitleYSpacing; int hsize = _history.size(); for (int ii = 0; ii < hsize; ii++) { ChatGlyph rec = getHistorySubtitle(ii, gfx); Rectangle r = r...
java
protected void figureHistoryOffset (Graphics2D gfx) { if (!isLaidOut()) { return; } int hei = _subtitleYSpacing; int hsize = _history.size(); for (int ii = 0; ii < hsize; ii++) { ChatGlyph rec = getHistorySubtitle(ii, gfx); Rectangle r = r...
[ "protected", "void", "figureHistoryOffset", "(", "Graphics2D", "gfx", ")", "{", "if", "(", "!", "isLaidOut", "(", ")", ")", "{", "return", ";", "}", "int", "hei", "=", "_subtitleYSpacing", ";", "int", "hsize", "=", "_history", ".", "size", "(", ")", ";...
Figure out how many of the first history elements fit in our bounds such that we can set the bounds on the scrollbar correctly such that the scrolling to the smallest value just barely puts the first element onscreen.
[ "Figure", "out", "how", "many", "of", "the", "first", "history", "elements", "fit", "in", "our", "bounds", "such", "that", "we", "can", "set", "the", "bounds", "on", "the", "scrollbar", "correctly", "such", "that", "the", "scrolling", "to", "the", "smalles...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L388-L415
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.figureCurrentHistory
protected void figureCurrentHistory () { int first = _historyModel.getValue(); int count = 0; Graphics2D gfx = null; if (isLaidOut() && !_history.isEmpty()) { gfx = getTargetGraphics(); if (gfx == null) { log.warning("Can't figure current hist...
java
protected void figureCurrentHistory () { int first = _historyModel.getValue(); int count = 0; Graphics2D gfx = null; if (isLaidOut() && !_history.isEmpty()) { gfx = getTargetGraphics(); if (gfx == null) { log.warning("Can't figure current hist...
[ "protected", "void", "figureCurrentHistory", "(", ")", "{", "int", "first", "=", "_historyModel", ".", "getValue", "(", ")", ";", "int", "count", "=", "0", ";", "Graphics2D", "gfx", "=", "null", ";", "if", "(", "isLaidOut", "(", ")", "&&", "!", "_histo...
Figure out which ChatMessages in the history should currently appear in the showing history.
[ "Figure", "out", "which", "ChatMessages", "in", "the", "history", "should", "currently", "appear", "in", "the", "showing", "history", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L420-L479
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.getHistorySubtitle
protected ChatGlyph getHistorySubtitle (int index, Graphics2D layoutGfx) { // do a brute search (over a small set) for an already-created subtitle for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) { ChatGlyph cg = _showingHistory.get(ii); if (cg.histIndex == index)...
java
protected ChatGlyph getHistorySubtitle (int index, Graphics2D layoutGfx) { // do a brute search (over a small set) for an already-created subtitle for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) { ChatGlyph cg = _showingHistory.get(ii); if (cg.histIndex == index)...
[ "protected", "ChatGlyph", "getHistorySubtitle", "(", "int", "index", ",", "Graphics2D", "layoutGfx", ")", "{", "// do a brute search (over a small set) for an already-created subtitle", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "_showingHistory", ".", "size", ...
Get the glyph for the specified history index, creating if necessary.
[ "Get", "the", "glyph", "for", "the", "specified", "history", "index", "creating", "if", "necessary", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L484-L500
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.createHistorySubtitle
protected ChatGlyph createHistorySubtitle (int index, Graphics2D layoutGfx) { ChatMessage message = _history.get(index); int type = getType(message, true); return createSubtitle(message, type, layoutGfx, false); }
java
protected ChatGlyph createHistorySubtitle (int index, Graphics2D layoutGfx) { ChatMessage message = _history.get(index); int type = getType(message, true); return createSubtitle(message, type, layoutGfx, false); }
[ "protected", "ChatGlyph", "createHistorySubtitle", "(", "int", "index", ",", "Graphics2D", "layoutGfx", ")", "{", "ChatMessage", "message", "=", "_history", ".", "get", "(", "index", ")", ";", "int", "type", "=", "getType", "(", "message", ",", "true", ")", ...
Creates a subtitle for display in the history panel. @param index the index of the message in the history list
[ "Creates", "a", "subtitle", "for", "display", "in", "the", "history", "panel", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L507-L512
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.getHistorySubtitleSpacing
protected int getHistorySubtitleSpacing (int index) { ChatMessage message = _history.get(index); return _logic.getSubtitleSpacing(getType(message, true)); }
java
protected int getHistorySubtitleSpacing (int index) { ChatMessage message = _history.get(index); return _logic.getSubtitleSpacing(getType(message, true)); }
[ "protected", "int", "getHistorySubtitleSpacing", "(", "int", "index", ")", "{", "ChatMessage", "message", "=", "_history", ".", "get", "(", "index", ")", ";", "return", "_logic", ".", "getSubtitleSpacing", "(", "getType", "(", "message", ",", "true", ")", ")...
Determines the amount of spacing to put after a history subtitle. @param index the index of the message in the history list
[ "Determines", "the", "amount", "of", "spacing", "to", "put", "after", "a", "history", "subtitle", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L519-L523
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.clearGlyphs
protected void clearGlyphs (List<ChatGlyph> glyphs) { if (_target != null) { for (int ii = 0, nn = glyphs.size(); ii < nn; ii++) { ChatGlyph rec = glyphs.get(ii); _target.abortAnimation(rec); } } else if (!glyphs.isEmpty()) { log.w...
java
protected void clearGlyphs (List<ChatGlyph> glyphs) { if (_target != null) { for (int ii = 0, nn = glyphs.size(); ii < nn; ii++) { ChatGlyph rec = glyphs.get(ii); _target.abortAnimation(rec); } } else if (!glyphs.isEmpty()) { log.w...
[ "protected", "void", "clearGlyphs", "(", "List", "<", "ChatGlyph", ">", "glyphs", ")", "{", "if", "(", "_target", "!=", "null", ")", "{", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "glyphs", ".", "size", "(", ")", ";", "ii", "<", "nn", ...
Clears out the supplied list of chat glyphs.
[ "Clears", "out", "the", "supplied", "list", "of", "chat", "glyphs", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L542-L554
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.displayMessage
protected void displayMessage (ChatMessage message, Graphics2D gfx) { // get the non-history message type... int type = getType(message, false); if (type != ChatLogic.IGNORECHAT) { // display it now displayMessage(message, type, gfx); } }
java
protected void displayMessage (ChatMessage message, Graphics2D gfx) { // get the non-history message type... int type = getType(message, false); if (type != ChatLogic.IGNORECHAT) { // display it now displayMessage(message, type, gfx); } }
[ "protected", "void", "displayMessage", "(", "ChatMessage", "message", ",", "Graphics2D", "gfx", ")", "{", "// get the non-history message type...", "int", "type", "=", "getType", "(", "message", ",", "false", ")", ";", "if", "(", "type", "!=", "ChatLogic", ".", ...
Display the specified message now, unless we are to ignore it.
[ "Display", "the", "specified", "message", "now", "unless", "we", "are", "to", "ignore", "it", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L559-L567
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.displayMessage
protected void displayMessage (ChatMessage message, int type, Graphics2D layoutGfx) { // if we're in history mode, this will show up in the history and we'll rebuild our // subtitle list if and when history goes away if (isHistoryMode()) { return; } addSubtitle(cr...
java
protected void displayMessage (ChatMessage message, int type, Graphics2D layoutGfx) { // if we're in history mode, this will show up in the history and we'll rebuild our // subtitle list if and when history goes away if (isHistoryMode()) { return; } addSubtitle(cr...
[ "protected", "void", "displayMessage", "(", "ChatMessage", "message", ",", "int", "type", ",", "Graphics2D", "layoutGfx", ")", "{", "// if we're in history mode, this will show up in the history and we'll rebuild our", "// subtitle list if and when history goes away", "if", "(", ...
Display the message after we've decided which type it is.
[ "Display", "the", "message", "after", "we", "ve", "decided", "which", "type", "it", "is", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L572-L580
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.addSubtitle
protected void addSubtitle (ChatGlyph rec) { // scroll up the old subtitles Rectangle r = rec.getBounds(); scrollUpSubtitles(-r.height - _logic.getSubtitleSpacing(rec.getType())); // put this one in place Rectangle vbounds = _target.getViewBounds(); rec.setLocation(v...
java
protected void addSubtitle (ChatGlyph rec) { // scroll up the old subtitles Rectangle r = rec.getBounds(); scrollUpSubtitles(-r.height - _logic.getSubtitleSpacing(rec.getType())); // put this one in place Rectangle vbounds = _target.getViewBounds(); rec.setLocation(v...
[ "protected", "void", "addSubtitle", "(", "ChatGlyph", "rec", ")", "{", "// scroll up the old subtitles", "Rectangle", "r", "=", "rec", ".", "getBounds", "(", ")", ";", "scrollUpSubtitles", "(", "-", "r", ".", "height", "-", "_logic", ".", "getSubtitleSpacing", ...
Add a subtitle for display now.
[ "Add", "a", "subtitle", "for", "display", "now", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L585-L600
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.createSubtitle
protected ChatGlyph createSubtitle (ChatMessage message, int type, Graphics2D layoutGfx, boolean expires) { // we might need to modify the textual part with translations, but we can't do that to the // message object, since other chatdisplays also get it. ...
java
protected ChatGlyph createSubtitle (ChatMessage message, int type, Graphics2D layoutGfx, boolean expires) { // we might need to modify the textual part with translations, but we can't do that to the // message object, since other chatdisplays also get it. ...
[ "protected", "ChatGlyph", "createSubtitle", "(", "ChatMessage", "message", ",", "int", "type", ",", "Graphics2D", "layoutGfx", ",", "boolean", "expires", ")", "{", "// we might need to modify the textual part with translations, but we can't do that to the", "// message object, si...
Create a subtitle, but don't do anything funny with it.
[ "Create", "a", "subtitle", "but", "don", "t", "do", "anything", "funny", "with", "it", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L605-L626
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.createSubtitle
protected ChatGlyph createSubtitle (Graphics2D gfx, int type, long timestamp, Icon icon, int indent, String text, boolean expires) { Dimension is = new Dimension(); if (icon != null) { is.setSize(icon.getIconWidth(), icon.getIconHeight()); ...
java
protected ChatGlyph createSubtitle (Graphics2D gfx, int type, long timestamp, Icon icon, int indent, String text, boolean expires) { Dimension is = new Dimension(); if (icon != null) { is.setSize(icon.getIconWidth(), icon.getIconHeight()); ...
[ "protected", "ChatGlyph", "createSubtitle", "(", "Graphics2D", "gfx", ",", "int", "type", ",", "long", "timestamp", ",", "Icon", "icon", ",", "int", "indent", ",", "String", "text", ",", "boolean", "expires", ")", "{", "Dimension", "is", "=", "new", "Dimen...
Create a subtitle- a line of text that goes on the bottom.
[ "Create", "a", "subtitle", "-", "a", "line", "of", "text", "that", "goes", "on", "the", "bottom", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L631-L668
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.getChatExpire
protected long getChatExpire (long timestamp, String text) { long[] durations = _logic.getDisplayDurations(getDisplayDurationOffset()); // start the computation from the maximum of the timestamp or our last expire time long start = Math.max(timestamp, _lastExpire); // set the next ex...
java
protected long getChatExpire (long timestamp, String text) { long[] durations = _logic.getDisplayDurations(getDisplayDurationOffset()); // start the computation from the maximum of the timestamp or our last expire time long start = Math.max(timestamp, _lastExpire); // set the next ex...
[ "protected", "long", "getChatExpire", "(", "long", "timestamp", ",", "String", "text", ")", "{", "long", "[", "]", "durations", "=", "_logic", ".", "getDisplayDurations", "(", "getDisplayDurationOffset", "(", ")", ")", ";", "// start the computation from the maximum...
Get the expire time for the specified chat.
[ "Get", "the", "expire", "time", "for", "the", "specified", "chat", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L673-L684
train
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.scrollUpSubtitles
protected void scrollUpSubtitles (int dy) { // dirty and move all the old glyphs Rectangle vbounds = _target.getViewBounds(); int miny = vbounds.y + vbounds.height - _subtitleHeight; for (Iterator<ChatGlyph> iter = _subtitles.iterator(); iter.hasNext();) { ChatGlyph sub =...
java
protected void scrollUpSubtitles (int dy) { // dirty and move all the old glyphs Rectangle vbounds = _target.getViewBounds(); int miny = vbounds.y + vbounds.height - _subtitleHeight; for (Iterator<ChatGlyph> iter = _subtitles.iterator(); iter.hasNext();) { ChatGlyph sub =...
[ "protected", "void", "scrollUpSubtitles", "(", "int", "dy", ")", "{", "// dirty and move all the old glyphs", "Rectangle", "vbounds", "=", "_target", ".", "getViewBounds", "(", ")", ";", "int", "miny", "=", "vbounds", ".", "y", "+", "vbounds", ".", "height", "...
Scroll all the subtitles up by the specified amount.
[ "Scroll", "all", "the", "subtitles", "up", "by", "the", "specified", "amount", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L762-L775
train
jdillon/gshell
gshell-core/src/main/java/com/planet57/gshell/internal/completer/ShellCompleter.java
ShellCompleter.extractCommandArguments
private static ParsedLine extractCommandArguments(final ParsedLine line) { // copy the list, so we can mutate and pop the first item off LinkedList<String> words = Lists.newLinkedList(line.words()); String remove = words.pop(); String rawLine = line.line(); // rebuild that list sans the first argum...
java
private static ParsedLine extractCommandArguments(final ParsedLine line) { // copy the list, so we can mutate and pop the first item off LinkedList<String> words = Lists.newLinkedList(line.words()); String remove = words.pop(); String rawLine = line.line(); // rebuild that list sans the first argum...
[ "private", "static", "ParsedLine", "extractCommandArguments", "(", "final", "ParsedLine", "line", ")", "{", "// copy the list, so we can mutate and pop the first item off", "LinkedList", "<", "String", ">", "words", "=", "Lists", ".", "newLinkedList", "(", "line", ".", ...
Extract the command specific portions of the given line. This is everything past the first word.
[ "Extract", "the", "command", "specific", "portions", "of", "the", "given", "line", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-core/src/main/java/com/planet57/gshell/internal/completer/ShellCompleter.java#L120-L139
train
threerings/nenya
tools/src/main/java/com/threerings/media/tools/RecolorImage.java
RecolorImage.convert
protected void convert () { if (_image == null) { return; } // obtain the target color and offset try { BufferedImage image; if (_tabs.getSelectedIndex() == 0) { // All recolorings from file. image = getAllRecolors(...
java
protected void convert () { if (_image == null) { return; } // obtain the target color and offset try { BufferedImage image; if (_tabs.getSelectedIndex() == 0) { // All recolorings from file. image = getAllRecolors(...
[ "protected", "void", "convert", "(", ")", "{", "if", "(", "_image", "==", "null", ")", "{", "return", ";", "}", "// obtain the target color and offset", "try", "{", "BufferedImage", "image", ";", "if", "(", "_tabs", ".", "getSelectedIndex", "(", ")", "==", ...
Performs colorizations.
[ "Performs", "colorizations", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tools/RecolorImage.java#L227-L286
train
threerings/nenya
tools/src/main/java/com/threerings/media/tools/RecolorImage.java
RecolorImage.getAllRecolors
public BufferedImage getAllRecolors (boolean label) { if (_colRepo == null) { return null; } ColorPository.ClassRecord colClass = _colRepo.getClassRecord((String)_classList.getSelectedItem()); int classId = colClass.classId; BufferedImage img = new B...
java
public BufferedImage getAllRecolors (boolean label) { if (_colRepo == null) { return null; } ColorPository.ClassRecord colClass = _colRepo.getClassRecord((String)_classList.getSelectedItem()); int classId = colClass.classId; BufferedImage img = new B...
[ "public", "BufferedImage", "getAllRecolors", "(", "boolean", "label", ")", "{", "if", "(", "_colRepo", "==", "null", ")", "{", "return", "null", ";", "}", "ColorPository", ".", "ClassRecord", "colClass", "=", "_colRepo", ".", "getClassRecord", "(", "(", "Str...
Gets an image with all recolorings of the selection colorization class.
[ "Gets", "an", "image", "with", "all", "recolorings", "of", "the", "selection", "colorization", "class", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tools/RecolorImage.java#L291-L329
train
threerings/nenya
tools/src/main/java/com/threerings/media/tools/RecolorImage.java
RecolorImage.setColorizeFile
public void setColorizeFile (File path) { try { if (path.getName().endsWith("xml")) { ColorPositoryParser parser = new ColorPositoryParser(); _colRepo = (ColorPository)(parser.parseConfig(path)); } else { _colRepo = ColorPository.loadCo...
java
public void setColorizeFile (File path) { try { if (path.getName().endsWith("xml")) { ColorPositoryParser parser = new ColorPositoryParser(); _colRepo = (ColorPository)(parser.parseConfig(path)); } else { _colRepo = ColorPository.loadCo...
[ "public", "void", "setColorizeFile", "(", "File", "path", ")", "{", "try", "{", "if", "(", "path", ".", "getName", "(", ")", ".", "endsWith", "(", "\"xml\"", ")", ")", "{", "ColorPositoryParser", "parser", "=", "new", "ColorPositoryParser", "(", ")", ";"...
Loads up the colorization classes from the specified file.
[ "Loads", "up", "the", "colorization", "classes", "from", "the", "specified", "file", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tools/RecolorImage.java#L426-L493
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/StringUtils.java
StringUtils.stripControlCharacters
public static String stripControlCharacters(String rawValue) { if (rawValue == null) { return null; } String value = replaceEntities(rawValue); boolean hasControlChars = false; for (int i = value.length() - 1; i >= 0; i--) { if (Character.isISOControl(va...
java
public static String stripControlCharacters(String rawValue) { if (rawValue == null) { return null; } String value = replaceEntities(rawValue); boolean hasControlChars = false; for (int i = value.length() - 1; i >= 0; i--) { if (Character.isISOControl(va...
[ "public", "static", "String", "stripControlCharacters", "(", "String", "rawValue", ")", "{", "if", "(", "rawValue", "==", "null", ")", "{", "return", "null", ";", "}", "String", "value", "=", "replaceEntities", "(", "rawValue", ")", ";", "boolean", "hasContr...
Strip a String of it's ISO control characters. @param value The String that should be stripped. @return {@code String} A new String instance with its hexadecimal control characters replaced by a space. Or the unmodified String if it does not contain any ISO control characters.
[ "Strip", "a", "String", "of", "it", "s", "ISO", "control", "characters", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/StringUtils.java#L49-L95
train
threerings/nenya
core/src/main/java/com/threerings/resource/FastImageIO.java
FastImageIO.write
public static void write (BufferedImage image, OutputStream out) throws IOException { DataOutputStream dout = new DataOutputStream(out); // write the image dimensions int width = image.getWidth(), height = image.getHeight(); dout.writeInt(width); dout.writeInt(height...
java
public static void write (BufferedImage image, OutputStream out) throws IOException { DataOutputStream dout = new DataOutputStream(out); // write the image dimensions int width = image.getWidth(), height = image.getHeight(); dout.writeInt(width); dout.writeInt(height...
[ "public", "static", "void", "write", "(", "BufferedImage", "image", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "DataOutputStream", "dout", "=", "new", "DataOutputStream", "(", "out", ")", ";", "// write the image dimensions", "int", "width", "=...
Writes the supplied image to the supplied output stream. @exception IOException thrown if an error occurs writing to the output stream.
[ "Writes", "the", "supplied", "image", "to", "the", "supplied", "output", "stream", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FastImageIO.java#L71-L103
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpArguments.java
AmqpArguments.getEntries
public List<AmqpTableEntry> getEntries(String key) { if ((key == null) || (tableEntryArray == null)) { return null; } List<AmqpTableEntry> entries = new ArrayList<AmqpTableEntry>(); for (AmqpTableEntry entry : tableEntryArray) { if (entry.key.equals(key))...
java
public List<AmqpTableEntry> getEntries(String key) { if ((key == null) || (tableEntryArray == null)) { return null; } List<AmqpTableEntry> entries = new ArrayList<AmqpTableEntry>(); for (AmqpTableEntry entry : tableEntryArray) { if (entry.key.equals(key))...
[ "public", "List", "<", "AmqpTableEntry", ">", "getEntries", "(", "String", "key", ")", "{", "if", "(", "(", "key", "==", "null", ")", "||", "(", "tableEntryArray", "==", "null", ")", ")", "{", "return", "null", ";", "}", "List", "<", "AmqpTableEntry", ...
Returns a list of AmqpTableEntry objects that matches the specified key. If a null key is passed in, then a null is returned. Also, if the internal structure is null, then a null is returned. @param key name of the entry @return List<AmqpTableEntry> object with matching key
[ "Returns", "a", "list", "of", "AmqpTableEntry", "objects", "that", "matches", "the", "specified", "key", ".", "If", "a", "null", "key", "is", "passed", "in", "then", "a", "null", "is", "returned", ".", "Also", "if", "the", "internal", "structure", "is", ...
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpArguments.java#L158-L170
train
vdurmont/etaprinter
src/main/java/com/vdurmont/etaprinter/ETAPrinter.java
ETAPrinter.update
public void update(long numProcessedDuringStep) { if (this.closed) { throw new ETAPrinterException("You cannot update a closed ETAPrinter!"); } DateTime now = DateTime.now(); ItemsDuration itemsDuration = null; if (numProcessedDuringStep > 0) { long stepDu...
java
public void update(long numProcessedDuringStep) { if (this.closed) { throw new ETAPrinterException("You cannot update a closed ETAPrinter!"); } DateTime now = DateTime.now(); ItemsDuration itemsDuration = null; if (numProcessedDuringStep > 0) { long stepDu...
[ "public", "void", "update", "(", "long", "numProcessedDuringStep", ")", "{", "if", "(", "this", ".", "closed", ")", "{", "throw", "new", "ETAPrinterException", "(", "\"You cannot update a closed ETAPrinter!\"", ")", ";", "}", "DateTime", "now", "=", "DateTime", ...
Updates and prints the progress bar with the new values. @param numProcessedDuringStep the number of items processed during the elapsed step
[ "Updates", "and", "prints", "the", "progress", "bar", "with", "the", "new", "values", "." ]
19039bdbbece8b05ceab2a23757f4e1e8b6872cb
https://github.com/vdurmont/etaprinter/blob/19039bdbbece8b05ceab2a23757f4e1e8b6872cb/src/main/java/com/vdurmont/etaprinter/ETAPrinter.java#L109-L131
train
jboss/jboss-jsp-api_spec
src/main/java/javax/servlet/jsp/tagext/TagAttributeInfo.java
TagAttributeInfo.getIdAttribute
public static TagAttributeInfo getIdAttribute(TagAttributeInfo a[]) { for (int i=0; i<a.length; i++) { if (a[i].getName().equals(ID)) { return a[i]; } } return null; // no such attribute }
java
public static TagAttributeInfo getIdAttribute(TagAttributeInfo a[]) { for (int i=0; i<a.length; i++) { if (a[i].getName().equals(ID)) { return a[i]; } } return null; // no such attribute }
[ "public", "static", "TagAttributeInfo", "getIdAttribute", "(", "TagAttributeInfo", "a", "[", "]", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "if", "(", "a", "[", "i", "]", ".", "getNam...
Convenience static method that goes through an array of TagAttributeInfo objects and looks for "id". @param a An array of TagAttributeInfo @return The TagAttributeInfo reference with name "id"
[ "Convenience", "static", "method", "that", "goes", "through", "an", "array", "of", "TagAttributeInfo", "objects", "and", "looks", "for", "id", "." ]
da53166619f33a5134dc3315a3264990cc1f541f
https://github.com/jboss/jboss-jsp-api_spec/blob/da53166619f33a5134dc3315a3264990cc1f541f/src/main/java/javax/servlet/jsp/tagext/TagAttributeInfo.java#L221-L228
train
calrissian/mango
mango-criteria/src/main/java/org/calrissian/mango/criteria/domain/TypedTermLeaf.java
TypedTermLeaf.firstKnownType
protected static <T> Class<T> firstKnownType(T... objects) { for (T obj : objects) if (obj != null) return (Class<T>) obj.getClass(); return null; }
java
protected static <T> Class<T> firstKnownType(T... objects) { for (T obj : objects) if (obj != null) return (Class<T>) obj.getClass(); return null; }
[ "protected", "static", "<", "T", ">", "Class", "<", "T", ">", "firstKnownType", "(", "T", "...", "objects", ")", "{", "for", "(", "T", "obj", ":", "objects", ")", "if", "(", "obj", "!=", "null", ")", "return", "(", "Class", "<", "T", ">", ")", ...
Utility method to allow subclasses to extract type from known variables.
[ "Utility", "method", "to", "allow", "subclasses", "to", "extract", "type", "from", "known", "variables", "." ]
a95aa5e77af9aa0e629787228d80806560023452
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-criteria/src/main/java/org/calrissian/mango/criteria/domain/TypedTermLeaf.java#L24-L29
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.enumerateColors
public ColorRecord[] enumerateColors (String className) { // make sure the class exists ClassRecord record = getClassRecord(className); if (record == null) { return null; } // create the array ColorRecord[] crecs = new ColorRecord[record.colors.size()]; ...
java
public ColorRecord[] enumerateColors (String className) { // make sure the class exists ClassRecord record = getClassRecord(className); if (record == null) { return null; } // create the array ColorRecord[] crecs = new ColorRecord[record.colors.size()]; ...
[ "public", "ColorRecord", "[", "]", "enumerateColors", "(", "String", "className", ")", "{", "// make sure the class exists", "ClassRecord", "record", "=", "getClassRecord", "(", "className", ")", ";", "if", "(", "record", "==", "null", ")", "{", "return", "null"...
Returns an array containing the records for the colors in the specified class.
[ "Returns", "an", "array", "containing", "the", "records", "for", "the", "colors", "in", "the", "specified", "class", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L288-L303
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.enumerateColorIds
public int[] enumerateColorIds (String className) { // make sure the class exists ClassRecord record = getClassRecord(className); if (record == null) { return null; } int[] cids = new int[record.colors.size()]; Iterator<ColorRecord> crecs = record.colors....
java
public int[] enumerateColorIds (String className) { // make sure the class exists ClassRecord record = getClassRecord(className); if (record == null) { return null; } int[] cids = new int[record.colors.size()]; Iterator<ColorRecord> crecs = record.colors....
[ "public", "int", "[", "]", "enumerateColorIds", "(", "String", "className", ")", "{", "// make sure the class exists", "ClassRecord", "record", "=", "getClassRecord", "(", "className", ")", ";", "if", "(", "record", "==", "null", ")", "{", "return", "null", ";...
Returns an array containing the ids of the colors in the specified class.
[ "Returns", "an", "array", "containing", "the", "ids", "of", "the", "colors", "in", "the", "specified", "class", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L308-L322
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getRandomStartingColor
public ColorRecord getRandomStartingColor (String className, Random rand) { // make sure the class exists ClassRecord record = getClassRecord(className); return (record == null) ? null : record.randomStartingColor(rand); }
java
public ColorRecord getRandomStartingColor (String className, Random rand) { // make sure the class exists ClassRecord record = getClassRecord(className); return (record == null) ? null : record.randomStartingColor(rand); }
[ "public", "ColorRecord", "getRandomStartingColor", "(", "String", "className", ",", "Random", "rand", ")", "{", "// make sure the class exists", "ClassRecord", "record", "=", "getClassRecord", "(", "className", ")", ";", "return", "(", "record", "==", "null", ")", ...
Returns a random starting color from the specified color class.
[ "Returns", "a", "random", "starting", "color", "from", "the", "specified", "color", "class", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L354-L359
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getColorization
public Colorization getColorization (int classId, int colorId) { ColorRecord color = getColorRecord(classId, colorId); return (color == null) ? null : color.getColorization(); }
java
public Colorization getColorization (int classId, int colorId) { ColorRecord color = getColorRecord(classId, colorId); return (color == null) ? null : color.getColorization(); }
[ "public", "Colorization", "getColorization", "(", "int", "classId", ",", "int", "colorId", ")", "{", "ColorRecord", "color", "=", "getColorRecord", "(", "classId", ",", "colorId", ")", ";", "return", "(", "color", "==", "null", ")", "?", "null", ":", "colo...
Looks up a colorization by id.
[ "Looks", "up", "a", "colorization", "by", "id", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L364-L368
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getColorization
public Colorization getColorization (String className, int colorId) { ClassRecord crec = getClassRecord(className); if (crec != null) { ColorRecord color = crec.colors.get(colorId); if (color != null) { return color.getColorization(); } } ...
java
public Colorization getColorization (String className, int colorId) { ClassRecord crec = getClassRecord(className); if (crec != null) { ColorRecord color = crec.colors.get(colorId); if (color != null) { return color.getColorization(); } } ...
[ "public", "Colorization", "getColorization", "(", "String", "className", ",", "int", "colorId", ")", "{", "ClassRecord", "crec", "=", "getClassRecord", "(", "className", ")", ";", "if", "(", "crec", "!=", "null", ")", "{", "ColorRecord", "color", "=", "crec"...
Looks up a colorization by name.
[ "Looks", "up", "a", "colorization", "by", "name", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L381-L391
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getColorization
public Colorization getColorization (String className, String colorName) { ClassRecord crec = getClassRecord(className); if (crec != null) { int colorId = 0; try { colorId = crec.getColorId(colorName); } catch (ParseException pe) { ...
java
public Colorization getColorization (String className, String colorName) { ClassRecord crec = getClassRecord(className); if (crec != null) { int colorId = 0; try { colorId = crec.getColorId(colorName); } catch (ParseException pe) { ...
[ "public", "Colorization", "getColorization", "(", "String", "className", ",", "String", "colorName", ")", "{", "ClassRecord", "crec", "=", "getClassRecord", "(", "className", ")", ";", "if", "(", "crec", "!=", "null", ")", "{", "int", "colorId", "=", "0", ...
Looks up a colorization by class and color names.
[ "Looks", "up", "a", "colorization", "by", "class", "and", "color", "names", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L396-L414
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getClassRecord
public ClassRecord getClassRecord (String className) { Iterator<ClassRecord> iter = _classes.values().iterator(); while (iter.hasNext()) { ClassRecord crec = iter.next(); if (crec.name.equals(className)) { return crec; } } log.warni...
java
public ClassRecord getClassRecord (String className) { Iterator<ClassRecord> iter = _classes.values().iterator(); while (iter.hasNext()) { ClassRecord crec = iter.next(); if (crec.name.equals(className)) { return crec; } } log.warni...
[ "public", "ClassRecord", "getClassRecord", "(", "String", "className", ")", "{", "Iterator", "<", "ClassRecord", ">", "iter", "=", "_classes", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", ...
Loads up a colorization class by name and logs a warning if it doesn't exist.
[ "Loads", "up", "a", "colorization", "class", "by", "name", "and", "logs", "a", "warning", "if", "it", "doesn", "t", "exist", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L419-L430
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getColorRecord
public ColorRecord getColorRecord (int classId, int colorId) { ClassRecord record = getClassRecord(classId); if (record == null) { // if they request color class zero, we assume they're just // decoding a blank colorprint, otherwise we complain if (classId != 0) {...
java
public ColorRecord getColorRecord (int classId, int colorId) { ClassRecord record = getClassRecord(classId); if (record == null) { // if they request color class zero, we assume they're just // decoding a blank colorprint, otherwise we complain if (classId != 0) {...
[ "public", "ColorRecord", "getColorRecord", "(", "int", "classId", ",", "int", "colorId", ")", "{", "ClassRecord", "record", "=", "getClassRecord", "(", "classId", ")", ";", "if", "(", "record", "==", "null", ")", "{", "// if they request color class zero, we assum...
Looks up the requested color record.
[ "Looks", "up", "the", "requested", "color", "record", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L435-L448
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getColorRecord
public ColorRecord getColorRecord (String className, String colorName) { ClassRecord record = getClassRecord(className); if (record == null) { log.warning("Requested unknown color class", "className", className, "colorName", colorName, new Exception()); return...
java
public ColorRecord getColorRecord (String className, String colorName) { ClassRecord record = getClassRecord(className); if (record == null) { log.warning("Requested unknown color class", "className", className, "colorName", colorName, new Exception()); return...
[ "public", "ColorRecord", "getColorRecord", "(", "String", "className", ",", "String", "colorName", ")", "{", "ClassRecord", "record", "=", "getClassRecord", "(", "className", ")", ";", "if", "(", "record", "==", "null", ")", "{", "log", ".", "warning", "(", ...
Looks up the requested color record by class and color names.
[ "Looks", "up", "the", "requested", "color", "record", "by", "class", "and", "color", "names", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L453-L471
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.addClass
public void addClass (ClassRecord record) { // validate the class id if (record.classId > 255) { log.warning("Refusing to add class; classId > 255 " + record + "."); } else { _classes.put(record.classId, record); } }
java
public void addClass (ClassRecord record) { // validate the class id if (record.classId > 255) { log.warning("Refusing to add class; classId > 255 " + record + "."); } else { _classes.put(record.classId, record); } }
[ "public", "void", "addClass", "(", "ClassRecord", "record", ")", "{", "// validate the class id", "if", "(", "record", ".", "classId", ">", "255", ")", "{", "log", ".", "warning", "(", "\"Refusing to add class; classId > 255 \"", "+", "record", "+", "\".\"", ")"...
Adds a fully configured color class record to the pository. This is only called by the XML parsing code, so pay it no mind.
[ "Adds", "a", "fully", "configured", "color", "class", "record", "to", "the", "pository", ".", "This", "is", "only", "called", "by", "the", "XML", "parsing", "code", "so", "pay", "it", "no", "mind", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L485-L493
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.saveColorPository
public static void saveColorPository (ColorPository posit, File root) { File path = new File(root, CONFIG_PATH); try { CompiledConfig.saveConfig(path, posit); } catch (IOException ioe) { log.warning("Failure saving color pository", "path", path, "error", ioe); ...
java
public static void saveColorPository (ColorPository posit, File root) { File path = new File(root, CONFIG_PATH); try { CompiledConfig.saveConfig(path, posit); } catch (IOException ioe) { log.warning("Failure saving color pository", "path", path, "error", ioe); ...
[ "public", "static", "void", "saveColorPository", "(", "ColorPository", "posit", ",", "File", "root", ")", "{", "File", "path", "=", "new", "File", "(", "root", ",", "CONFIG_PATH", ")", ";", "try", "{", "CompiledConfig", ".", "saveConfig", "(", "path", ",",...
Serializes and saves color pository to the supplied file.
[ "Serializes", "and", "saves", "color", "pository", "to", "the", "supplied", "file", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L524-L532
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterSprite.java
CharacterSprite.init
public void init (CharacterDescriptor descrip, CharacterManager charmgr) { // keep track of this stuff _descrip = descrip; _charmgr = charmgr; // sanity check our values sanityCheckDescrip(); // assign an arbitrary starting orientation _orient = SOUTHWEST; ...
java
public void init (CharacterDescriptor descrip, CharacterManager charmgr) { // keep track of this stuff _descrip = descrip; _charmgr = charmgr; // sanity check our values sanityCheckDescrip(); // assign an arbitrary starting orientation _orient = SOUTHWEST; ...
[ "public", "void", "init", "(", "CharacterDescriptor", "descrip", ",", "CharacterManager", "charmgr", ")", "{", "// keep track of this stuff", "_descrip", "=", "descrip", ";", "_charmgr", "=", "charmgr", ";", "// sanity check our values", "sanityCheckDescrip", "(", ")", ...
Initializes this character sprite with the specified character descriptor and character manager. It will obtain animation data from the supplied character manager.
[ "Initializes", "this", "character", "sprite", "with", "the", "specified", "character", "descriptor", "and", "character", "manager", ".", "It", "will", "obtain", "animation", "data", "from", "the", "supplied", "character", "manager", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterSprite.java#L42-L56
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterSprite.java
CharacterSprite.setActionSequence
public void setActionSequence (String action) { // sanity check if (action == null) { log.warning("Refusing to set null action sequence " + this + ".", new Exception()); return; } // no need to noop if (action.equals(_action)) { return; ...
java
public void setActionSequence (String action) { // sanity check if (action == null) { log.warning("Refusing to set null action sequence " + this + ".", new Exception()); return; } // no need to noop if (action.equals(_action)) { return; ...
[ "public", "void", "setActionSequence", "(", "String", "action", ")", "{", "// sanity check", "if", "(", "action", "==", "null", ")", "{", "log", ".", "warning", "(", "\"Refusing to set null action sequence \"", "+", "this", "+", "\".\"", ",", "new", "Exception",...
Sets the action sequence used when rendering the character, from the set of available sequences.
[ "Sets", "the", "action", "sequence", "used", "when", "rendering", "the", "character", "from", "the", "set", "of", "available", "sequences", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterSprite.java#L121-L135
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterSprite.java
CharacterSprite.updateActionFrames
protected void updateActionFrames () { // get a reference to the action sequence so that we can obtain // our animation frames and configure our frames per second ActionSequence actseq = _charmgr.getActionSequence(_action); if (actseq == null) { String errmsg = "No such a...
java
protected void updateActionFrames () { // get a reference to the action sequence so that we can obtain // our animation frames and configure our frames per second ActionSequence actseq = _charmgr.getActionSequence(_action); if (actseq == null) { String errmsg = "No such a...
[ "protected", "void", "updateActionFrames", "(", ")", "{", "// get a reference to the action sequence so that we can obtain", "// our animation frames and configure our frames per second", "ActionSequence", "actseq", "=", "_charmgr", ".", "getActionSequence", "(", "_action", ")", ";...
Rebuilds our action frames given our current character descriptor and action sequence. This is called when either of those two things changes.
[ "Rebuilds", "our", "action", "frames", "given", "our", "current", "character", "descriptor", "and", "action", "sequence", ".", "This", "is", "called", "when", "either", "of", "those", "two", "things", "changes", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterSprite.java#L229-L257
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterSprite.java
CharacterSprite.sanityCheckDescrip
protected void sanityCheckDescrip () { if (_descrip.getComponentIds() == null || _descrip.getComponentIds().length == 0) { log.warning("Invalid character descriptor [sprite=" + this + ", descrip=" + _descrip + "].", new Exception()); } }
java
protected void sanityCheckDescrip () { if (_descrip.getComponentIds() == null || _descrip.getComponentIds().length == 0) { log.warning("Invalid character descriptor [sprite=" + this + ", descrip=" + _descrip + "].", new Exception()); } }
[ "protected", "void", "sanityCheckDescrip", "(", ")", "{", "if", "(", "_descrip", ".", "getComponentIds", "(", ")", "==", "null", "||", "_descrip", ".", "getComponentIds", "(", ")", ".", "length", "==", "0", ")", "{", "log", ".", "warning", "(", "\"Invali...
Makes it easier to track down problems with bogus character descriptors.
[ "Makes", "it", "easier", "to", "track", "down", "problems", "with", "bogus", "character", "descriptors", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterSprite.java#L270-L277
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterSprite.java
CharacterSprite.halt
protected void halt () { // only do something if we're actually animating if (_animMode != NO_ANIMATION) { // disable animation setAnimationMode(NO_ANIMATION); // come to a halt looking settled and at peace String rest = getRestingAction(); ...
java
protected void halt () { // only do something if we're actually animating if (_animMode != NO_ANIMATION) { // disable animation setAnimationMode(NO_ANIMATION); // come to a halt looking settled and at peace String rest = getRestingAction(); ...
[ "protected", "void", "halt", "(", ")", "{", "// only do something if we're actually animating", "if", "(", "_animMode", "!=", "NO_ANIMATION", ")", "{", "// disable animation", "setAnimationMode", "(", "NO_ANIMATION", ")", ";", "// come to a halt looking settled and at peace",...
Updates the sprite animation frame to reflect the cessation of movement and disables any further animation.
[ "Updates", "the", "sprite", "animation", "frame", "to", "reflect", "the", "cessation", "of", "movement", "and", "disables", "any", "further", "animation", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterSprite.java#L348-L360
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/impl/wsn/WebSocketNativeEncoderImpl.java
WebSocketNativeEncoderImpl.unmask
public static void unmask(WrappedByteBuffer buf, int mask) { byte b; int remainder = buf.remaining() % 4; int remaining = buf.remaining() - remainder; int end = remaining + buf.position(); // xor a 32bit word at a time as long as possible while (buf.position() < end) { ...
java
public static void unmask(WrappedByteBuffer buf, int mask) { byte b; int remainder = buf.remaining() % 4; int remaining = buf.remaining() - remainder; int end = remaining + buf.position(); // xor a 32bit word at a time as long as possible while (buf.position() < end) { ...
[ "public", "static", "void", "unmask", "(", "WrappedByteBuffer", "buf", ",", "int", "mask", ")", "{", "byte", "b", ";", "int", "remainder", "=", "buf", ".", "remaining", "(", ")", "%", "4", ";", "int", "remaining", "=", "buf", ".", "remaining", "(", "...
Performs an in-situ unmasking of the readable buf bytes. Preserves the position of the buffer whilst unmasking all the readable bytes, such that the unmasked bytes will be readable after this invocation. @param buf the buffer containing readable bytes to be unmasked. @param mask the mask to apply against the readab...
[ "Performs", "an", "in", "-", "situ", "unmasking", "of", "the", "readable", "buf", "bytes", ".", "Preserves", "the", "position", "of", "the", "buffer", "whilst", "unmasking", "all", "the", "readable", "bytes", "such", "that", "the", "unmasked", "bytes", "will...
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/impl/wsn/WebSocketNativeEncoderImpl.java#L156-L193
train
groupon/monsoon
remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java
AbstractServer.newTscStream
private static stream_response newTscStream(Stream<TimeSeriesCollection> tsc, int fetch) { final BufferedIterator<TimeSeriesCollection> iter = new BufferedIterator(tsc.iterator(), TSC_QUEUE_SIZE); final long idx = TSC_ITERS_ALLOC.getAndIncrement(); final IteratorAndCookie<TimeSeriesCollection> i...
java
private static stream_response newTscStream(Stream<TimeSeriesCollection> tsc, int fetch) { final BufferedIterator<TimeSeriesCollection> iter = new BufferedIterator(tsc.iterator(), TSC_QUEUE_SIZE); final long idx = TSC_ITERS_ALLOC.getAndIncrement(); final IteratorAndCookie<TimeSeriesCollection> i...
[ "private", "static", "stream_response", "newTscStream", "(", "Stream", "<", "TimeSeriesCollection", ">", "tsc", ",", "int", "fetch", ")", "{", "final", "BufferedIterator", "<", "TimeSeriesCollection", ">", "iter", "=", "new", "BufferedIterator", "(", "tsc", ".", ...
Create a new TimeSeriesCollection iterator from the given stream.
[ "Create", "a", "new", "TimeSeriesCollection", "iterator", "from", "the", "given", "stream", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java#L167-L178
train
groupon/monsoon
remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java
AbstractServer.newEvalStream
private static evaluate_response newEvalStream(Stream<Collection<CollectHistory.NamedEvaluation>> tsc, int fetch) { final BufferedIterator<Collection<CollectHistory.NamedEvaluation>> iter = new BufferedIterator(tsc.iterator(), EVAL_QUEUE_SIZE); final long idx = EVAL_ITERS_ALLOC.getAndIncrement(); ...
java
private static evaluate_response newEvalStream(Stream<Collection<CollectHistory.NamedEvaluation>> tsc, int fetch) { final BufferedIterator<Collection<CollectHistory.NamedEvaluation>> iter = new BufferedIterator(tsc.iterator(), EVAL_QUEUE_SIZE); final long idx = EVAL_ITERS_ALLOC.getAndIncrement(); ...
[ "private", "static", "evaluate_response", "newEvalStream", "(", "Stream", "<", "Collection", "<", "CollectHistory", ".", "NamedEvaluation", ">", ">", "tsc", ",", "int", "fetch", ")", "{", "final", "BufferedIterator", "<", "Collection", "<", "CollectHistory", ".", ...
Create a new evaluation iterator from the given stream.
[ "Create", "a", "new", "evaluation", "iterator", "from", "the", "given", "stream", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java#L183-L194
train
groupon/monsoon
remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java
AbstractServer.newGroupStream
private static group_stream_response newGroupStream(Stream<Map.Entry<DateTime, TimeSeriesValue>> tsc, int fetch) { final BufferedIterator<Map.Entry<DateTime, TimeSeriesValue>> iter = new BufferedIterator<>(tsc.iterator(), GROUP_STREAM_QUEUE_SIZE); final long idx = GROUP_STREAM_ITERS_ALLOC.getAndIncremen...
java
private static group_stream_response newGroupStream(Stream<Map.Entry<DateTime, TimeSeriesValue>> tsc, int fetch) { final BufferedIterator<Map.Entry<DateTime, TimeSeriesValue>> iter = new BufferedIterator<>(tsc.iterator(), GROUP_STREAM_QUEUE_SIZE); final long idx = GROUP_STREAM_ITERS_ALLOC.getAndIncremen...
[ "private", "static", "group_stream_response", "newGroupStream", "(", "Stream", "<", "Map", ".", "Entry", "<", "DateTime", ",", "TimeSeriesValue", ">", ">", "tsc", ",", "int", "fetch", ")", "{", "final", "BufferedIterator", "<", "Map", ".", "Entry", "<", "Dat...
Create a new group iterator from the given stream.
[ "Create", "a", "new", "group", "iterator", "from", "the", "given", "stream", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java#L199-L210
train
groupon/monsoon
remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java
AbstractServer.fetchFromIter
private static <T> List<T> fetchFromIter(BufferedIterator<T> iter, int fetch, int max_fetch) { final long t0 = System.currentTimeMillis(); assert (max_fetch >= 1); if (fetch < 0 || fetch > max_fetch) fetch = max_fetch; final List<T> result = new ArrayList<>(fetch); for (int i = ...
java
private static <T> List<T> fetchFromIter(BufferedIterator<T> iter, int fetch, int max_fetch) { final long t0 = System.currentTimeMillis(); assert (max_fetch >= 1); if (fetch < 0 || fetch > max_fetch) fetch = max_fetch; final List<T> result = new ArrayList<>(fetch); for (int i = ...
[ "private", "static", "<", "T", ">", "List", "<", "T", ">", "fetchFromIter", "(", "BufferedIterator", "<", "T", ">", "iter", ",", "int", "fetch", ",", "int", "max_fetch", ")", "{", "final", "long", "t0", "=", "System", ".", "currentTimeMillis", "(", ")"...
Fetch up to a given amount of items from the iterator. @param <T> The type of elements in the iterator. @param iter The iterator supplying items. @param fetch The requested number of items to fetch (user supplied parameter). @param max_fetch The hard limit on how many items to fetch. @return A list with items fetched ...
[ "Fetch", "up", "to", "a", "given", "amount", "of", "items", "from", "the", "iterator", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/AbstractServer.java#L222-L248
train
threerings/nenya
core/src/main/java/com/threerings/cast/bundle/BundleUtil.java
BundleUtil.loadObject
public static Object loadObject (ResourceBundle bundle, String path, boolean wipeOnFailure) throws IOException, ClassNotFoundException { InputStream bin = null; try { bin = bundle.getResource(path); if (bin == null) { return null; } ...
java
public static Object loadObject (ResourceBundle bundle, String path, boolean wipeOnFailure) throws IOException, ClassNotFoundException { InputStream bin = null; try { bin = bundle.getResource(path); if (bin == null) { return null; } ...
[ "public", "static", "Object", "loadObject", "(", "ResourceBundle", "bundle", ",", "String", "path", ",", "boolean", "wipeOnFailure", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "InputStream", "bin", "=", "null", ";", "try", "{", "bin", "=",...
Attempts to load an object from the supplied resource bundle with the specified path. @param wipeOnFailure if there is an error reading the object from the bundle and this parameter is true, we will instruct the bundle to delete its underlying jar file before propagating the exception with the expectation that it will...
[ "Attempts", "to", "load", "an", "object", "from", "the", "supplied", "resource", "bundle", "with", "the", "specified", "path", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/bundle/BundleUtil.java#L70-L101
train
threerings/nenya
tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundlerTask.java
TileSetBundlerTask.getTargetPath
protected String getTargetPath (File fromDir, String path) { return path.substring(0, path.length()-4) + ".jar"; }
java
protected String getTargetPath (File fromDir, String path) { return path.substring(0, path.length()-4) + ".jar"; }
[ "protected", "String", "getTargetPath", "(", "File", "fromDir", ",", "String", "path", ")", "{", "return", "path", ".", "substring", "(", "0", ",", "path", ".", "length", "(", ")", "-", "4", ")", "+", "\".jar\"", ";", "}" ]
Returns the target path in which our bundler will write the tile set.
[ "Returns", "the", "target", "path", "in", "which", "our", "bundler", "will", "write", "the", "tile", "set", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundlerTask.java#L162-L165
train
threerings/nenya
core/src/main/java/com/threerings/media/sprite/ButtonSprite.java
ButtonSprite.updateBounds
public void updateBounds () { // invalidate the old... invalidate(); // size the bounds to fit our label Dimension size = _label.getSize(); _bounds.width = size.width + PADDING*2 + (_style == ROUNDED ? _arcWidth : 0); _bounds.height = size.height + PADDIN...
java
public void updateBounds () { // invalidate the old... invalidate(); // size the bounds to fit our label Dimension size = _label.getSize(); _bounds.width = size.width + PADDING*2 + (_style == ROUNDED ? _arcWidth : 0); _bounds.height = size.height + PADDIN...
[ "public", "void", "updateBounds", "(", ")", "{", "// invalidate the old...", "invalidate", "(", ")", ";", "// size the bounds to fit our label", "Dimension", "size", "=", "_label", ".", "getSize", "(", ")", ";", "_bounds", ".", "width", "=", "size", ".", "width"...
Updates this sprite's bounds after a change to the label.
[ "Updates", "this", "sprite", "s", "bounds", "after", "a", "change", "to", "the", "label", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/ButtonSprite.java#L103-L116
train
threerings/nenya
core/src/main/java/com/threerings/util/DirectionUtil.java
DirectionUtil.getClosest
public static int getClosest (int direction, int[] possible, boolean preferCW) { // rotate a tick at a time, looking for matches int first = direction; int second = direction; for (int ii = 0; ii <= FINE_DIRECTION_COUNT / 2; ii++) { if (IntListUtil.contains(po...
java
public static int getClosest (int direction, int[] possible, boolean preferCW) { // rotate a tick at a time, looking for matches int first = direction; int second = direction; for (int ii = 0; ii <= FINE_DIRECTION_COUNT / 2; ii++) { if (IntListUtil.contains(po...
[ "public", "static", "int", "getClosest", "(", "int", "direction", ",", "int", "[", "]", "possible", ",", "boolean", "preferCW", ")", "{", "// rotate a tick at a time, looking for matches", "int", "first", "=", "direction", ";", "int", "second", "=", "direction", ...
Get the direction closest to the specified direction, out of the directions in the possible list. @param preferCW whether to prefer a clockwise match or a counter-clockwise match.
[ "Get", "the", "direction", "closest", "to", "the", "specified", "direction", "out", "of", "the", "directions", "in", "the", "possible", "list", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/DirectionUtil.java#L156-L176
train
threerings/nenya
core/src/main/java/com/threerings/util/DirectionUtil.java
DirectionUtil.moveDirection
public static void moveDirection (Point p, int direction, int dx, int dy) { if (direction >= DIRECTION_COUNT) { throw new IllegalArgumentException("Fine coordinates not supported."); } switch (direction) { case NORTH: case NORTHWEST: case NORTHEAST: p.y -= dy; ...
java
public static void moveDirection (Point p, int direction, int dx, int dy) { if (direction >= DIRECTION_COUNT) { throw new IllegalArgumentException("Fine coordinates not supported."); } switch (direction) { case NORTH: case NORTHWEST: case NORTHEAST: p.y -= dy; ...
[ "public", "static", "void", "moveDirection", "(", "Point", "p", ",", "int", "direction", ",", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "direction", ">=", "DIRECTION_COUNT", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Fine coordin...
Move the specified point in the specified screen direction, adjusting by the specified adjustments. Fine directions are not supported.
[ "Move", "the", "specified", "point", "in", "the", "specified", "screen", "direction", "adjusting", "by", "the", "specified", "adjustments", ".", "Fine", "directions", "are", "not", "supported", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/DirectionUtil.java#L264-L282
train
threerings/nenya
core/src/main/java/com/threerings/media/ActiveRepaintManager.java
ActiveRepaintManager.getRoot
protected Component getRoot (Component comp) { for (Component c = comp; c != null; c = c.getParent()) { boolean hidden = !c.isDisplayable(); // on the mac, the JRootPane is invalidated before it is visible and is never again // invalidated or repainted, so we punt and all...
java
protected Component getRoot (Component comp) { for (Component c = comp; c != null; c = c.getParent()) { boolean hidden = !c.isDisplayable(); // on the mac, the JRootPane is invalidated before it is visible and is never again // invalidated or repainted, so we punt and all...
[ "protected", "Component", "getRoot", "(", "Component", "comp", ")", "{", "for", "(", "Component", "c", "=", "comp", ";", "c", "!=", "null", ";", "c", "=", "c", ".", "getParent", "(", ")", ")", "{", "boolean", "hidden", "=", "!", "c", ".", "isDispla...
Returns the root component for the supplied component or null if it is not part of a rooted hierarchy or if any parent along the way is found to be hidden or without a peer.
[ "Returns", "the", "root", "component", "for", "the", "supplied", "component", "or", "null", "if", "it", "is", "not", "part", "of", "a", "rooted", "hierarchy", "or", "if", "any", "parent", "along", "the", "way", "is", "found", "to", "be", "hidden", "or", ...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/ActiveRepaintManager.java#L166-L184
train
threerings/nenya
core/src/main/java/com/threerings/media/ActiveRepaintManager.java
ActiveRepaintManager.validateComponents
public void validateComponents () { // swap out our invalid array Object[] invalid = null; synchronized (this) { invalid = _invalid; _invalid = null; } // if there's nothing to validate, we're home free if (invalid == null) { retur...
java
public void validateComponents () { // swap out our invalid array Object[] invalid = null; synchronized (this) { invalid = _invalid; _invalid = null; } // if there's nothing to validate, we're home free if (invalid == null) { retur...
[ "public", "void", "validateComponents", "(", ")", "{", "// swap out our invalid array", "Object", "[", "]", "invalid", "=", "null", ";", "synchronized", "(", "this", ")", "{", "invalid", "=", "_invalid", ";", "_invalid", "=", "null", ";", "}", "// if there's n...
Validates the invalid components that have been queued up since the last frame tick.
[ "Validates", "the", "invalid", "components", "that", "have", "been", "queued", "up", "since", "the", "last", "frame", "tick", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/ActiveRepaintManager.java#L204-L228
train
threerings/nenya
core/src/main/java/com/threerings/media/ActiveRepaintManager.java
ActiveRepaintManager.dumpHierarchy
protected static void dumpHierarchy (Component comp) { for (String indent = ""; comp != null; indent += " ") { log.info(indent + toString(comp)); comp = comp.getParent(); } }
java
protected static void dumpHierarchy (Component comp) { for (String indent = ""; comp != null; indent += " ") { log.info(indent + toString(comp)); comp = comp.getParent(); } }
[ "protected", "static", "void", "dumpHierarchy", "(", "Component", "comp", ")", "{", "for", "(", "String", "indent", "=", "\"\"", ";", "comp", "!=", "null", ";", "indent", "+=", "\" \"", ")", "{", "log", ".", "info", "(", "indent", "+", "toString", "(",...
Dumps the containment hierarchy for the supplied component.
[ "Dumps", "the", "containment", "hierarchy", "for", "the", "supplied", "component", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/ActiveRepaintManager.java#L426-L432
train
threerings/nenya
core/src/main/java/com/threerings/media/util/LineSegmentPath.java
LineSegmentPath.addNode
public void addNode (int x, int y, int dir) { _nodes.add(new PathNode(x, y, dir)); }
java
public void addNode (int x, int y, int dir) { _nodes.add(new PathNode(x, y, dir)); }
[ "public", "void", "addNode", "(", "int", "x", ",", "int", "y", ",", "int", "dir", ")", "{", "_nodes", ".", "add", "(", "new", "PathNode", "(", "x", ",", "y", ",", "dir", ")", ")", ";", "}" ]
Add a node to the path with the specified destination point and facing direction. @param x the x-position. @param y the y-position. @param dir the facing direction.
[ "Add", "a", "node", "to", "the", "path", "with", "the", "specified", "destination", "point", "and", "facing", "direction", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/LineSegmentPath.java#L102-L105
train
threerings/nenya
core/src/main/java/com/threerings/media/util/LineSegmentPath.java
LineSegmentPath.setDuration
public void setDuration (long millis) { // if we have only zero or one nodes, we don't have enough // information to compute our velocity int ncount = _nodes.size(); if (ncount < 2) { log.warning("Requested to set duration of bogus path", "path", this, "du...
java
public void setDuration (long millis) { // if we have only zero or one nodes, we don't have enough // information to compute our velocity int ncount = _nodes.size(); if (ncount < 2) { log.warning("Requested to set duration of bogus path", "path", this, "du...
[ "public", "void", "setDuration", "(", "long", "millis", ")", "{", "// if we have only zero or one nodes, we don't have enough", "// information to compute our velocity", "int", "ncount", "=", "_nodes", ".", "size", "(", ")", ";", "if", "(", "ncount", "<", "2", ")", ...
Computes the velocity at which the pathable will need to travel along this path such that it will arrive at the destination in approximately the specified number of milliseconds. Efforts are taken to get the pathable there as close to the desired time as possible, but framerate variation may prevent it from arriving ex...
[ "Computes", "the", "velocity", "at", "which", "the", "pathable", "will", "need", "to", "travel", "along", "this", "path", "such", "that", "it", "will", "arrive", "at", "the", "destination", "in", "approximately", "the", "specified", "number", "of", "millisecon...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/LineSegmentPath.java#L146-L168
train
threerings/nenya
core/src/main/java/com/threerings/media/util/LineSegmentPath.java
LineSegmentPath.headToNextNode
protected boolean headToNextNode (Pathable pable, long startstamp, long now) { if (_niter == null) { throw new IllegalStateException("headToNextNode() called before init()"); } // check to see if we've completed our path if (!_niter.hasNext()) { // move the p...
java
protected boolean headToNextNode (Pathable pable, long startstamp, long now) { if (_niter == null) { throw new IllegalStateException("headToNextNode() called before init()"); } // check to see if we've completed our path if (!_niter.hasNext()) { // move the p...
[ "protected", "boolean", "headToNextNode", "(", "Pathable", "pable", ",", "long", "startstamp", ",", "long", "now", ")", "{", "if", "(", "_niter", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"headToNextNode() called before init()\"", ")"...
Place the pathable moving along the path at the end of the previous path node, face it appropriately for the next node, and start it on its way. Returns whether the pathable position moved.
[ "Place", "the", "pathable", "moving", "along", "the", "path", "at", "the", "end", "of", "the", "previous", "path", "node", "face", "it", "appropriately", "for", "the", "next", "node", "and", "start", "it", "on", "its", "way", ".", "Returns", "whether", "...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/LineSegmentPath.java#L251-L291
train