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
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getBaseTile
protected BaseTile getBaseTile (int tx, int ty) { SceneBlock block = getBlock(tx, ty); return (block == null) ? null : block.getBaseTile(tx, ty); }
java
protected BaseTile getBaseTile (int tx, int ty) { SceneBlock block = getBlock(tx, ty); return (block == null) ? null : block.getBaseTile(tx, ty); }
[ "protected", "BaseTile", "getBaseTile", "(", "int", "tx", ",", "int", "ty", ")", "{", "SceneBlock", "block", "=", "getBlock", "(", "tx", ",", "ty", ")", ";", "return", "(", "block", "==", "null", ")", "?", "null", ":", "block", ".", "getBaseTile", "(...
Returns the base tile for the specified tile coordinate.
[ "Returns", "the", "base", "tile", "for", "the", "specified", "tile", "coordinate", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1385-L1389
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getFringeTile
protected BaseTile getFringeTile (int tx, int ty) { SceneBlock block = getBlock(tx, ty); return (block == null) ? null : block.getFringeTile(tx, ty); }
java
protected BaseTile getFringeTile (int tx, int ty) { SceneBlock block = getBlock(tx, ty); return (block == null) ? null : block.getFringeTile(tx, ty); }
[ "protected", "BaseTile", "getFringeTile", "(", "int", "tx", ",", "int", "ty", ")", "{", "SceneBlock", "block", "=", "getBlock", "(", "tx", ",", "ty", ")", ";", "return", "(", "block", "==", "null", ")", "?", "null", ":", "block", ".", "getFringeTile", ...
Returns the fringe tile for the specified tile coordinate.
[ "Returns", "the", "fringe", "tile", "for", "the", "specified", "tile", "coordinate", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1392-L1396
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/BuilderModel.java
BuilderModel.notifyListeners
protected void notifyListeners (int event) { int size = _listeners.size(); for (int ii = 0; ii < size; ii++) { _listeners.get(ii).modelChanged(event); } }
java
protected void notifyListeners (int event) { int size = _listeners.size(); for (int ii = 0; ii < size; ii++) { _listeners.get(ii).modelChanged(event); } }
[ "protected", "void", "notifyListeners", "(", "int", "event", ")", "{", "int", "size", "=", "_listeners", ".", "size", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "size", ";", "ii", "++", ")", "{", "_listeners", ".", "get", "...
Notifies all model listeners that the builder model has changed.
[ "Notifies", "all", "model", "listeners", "that", "the", "builder", "model", "has", "changed", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/BuilderModel.java#L64-L70
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/BuilderModel.java
BuilderModel.getComponents
public List<Integer> getComponents (ComponentClass cclass) { List<Integer> list = _components.get(cclass); if (list == null) { list = Lists.newArrayList(); } return list; }
java
public List<Integer> getComponents (ComponentClass cclass) { List<Integer> list = _components.get(cclass); if (list == null) { list = Lists.newArrayList(); } return list; }
[ "public", "List", "<", "Integer", ">", "getComponents", "(", "ComponentClass", "cclass", ")", "{", "List", "<", "Integer", ">", "list", "=", "_components", ".", "get", "(", "cclass", ")", ";", "if", "(", "list", "==", "null", ")", "{", "list", "=", "...
Returns the list of components available in the specified class.
[ "Returns", "the", "list", "of", "components", "available", "in", "the", "specified", "class", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/BuilderModel.java#L83-L90
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/BuilderModel.java
BuilderModel.getSelectedComponents
public int[] getSelectedComponents () { int[] values = new int[_selected.size()]; Iterator<Integer> iter = _selected.values().iterator(); for (int ii = 0; iter.hasNext(); ii++) { values[ii] = iter.next().intValue(); } return values; }
java
public int[] getSelectedComponents () { int[] values = new int[_selected.size()]; Iterator<Integer> iter = _selected.values().iterator(); for (int ii = 0; iter.hasNext(); ii++) { values[ii] = iter.next().intValue(); } return values; }
[ "public", "int", "[", "]", "getSelectedComponents", "(", ")", "{", "int", "[", "]", "values", "=", "new", "int", "[", "_selected", ".", "size", "(", ")", "]", ";", "Iterator", "<", "Integer", ">", "iter", "=", "_selected", ".", "values", "(", ")", ...
Returns the selected components in an array.
[ "Returns", "the", "selected", "components", "in", "an", "array", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/BuilderModel.java#L95-L103
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/BuilderModel.java
BuilderModel.setSelectedComponent
public void setSelectedComponent (ComponentClass cclass, int cid) { _selected.put(cclass, Integer.valueOf(cid)); notifyListeners(BuilderModelListener.COMPONENT_CHANGED); }
java
public void setSelectedComponent (ComponentClass cclass, int cid) { _selected.put(cclass, Integer.valueOf(cid)); notifyListeners(BuilderModelListener.COMPONENT_CHANGED); }
[ "public", "void", "setSelectedComponent", "(", "ComponentClass", "cclass", ",", "int", "cid", ")", "{", "_selected", ".", "put", "(", "cclass", ",", "Integer", ".", "valueOf", "(", "cid", ")", ")", ";", "notifyListeners", "(", "BuilderModelListener", ".", "C...
Sets the selected component for the given component class.
[ "Sets", "the", "selected", "component", "for", "the", "given", "component", "class", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/BuilderModel.java#L108-L112
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/BuilderModel.java
BuilderModel.gatherComponentInfo
protected void gatherComponentInfo (ComponentRepository crepo) { // get the list of all component classes Iterators.addAll(_classes, crepo.enumerateComponentClasses()); for (int ii = 0; ii < _classes.size(); ii++) { // get the list of components available for this class ...
java
protected void gatherComponentInfo (ComponentRepository crepo) { // get the list of all component classes Iterators.addAll(_classes, crepo.enumerateComponentClasses()); for (int ii = 0; ii < _classes.size(); ii++) { // get the list of components available for this class ...
[ "protected", "void", "gatherComponentInfo", "(", "ComponentRepository", "crepo", ")", "{", "// get the list of all component classes", "Iterators", ".", "addAll", "(", "_classes", ",", "crepo", ".", "enumerateComponentClasses", "(", ")", ")", ";", "for", "(", "int", ...
Gathers component class and component information from the character manager for later reference by others.
[ "Gathers", "component", "class", "and", "component", "information", "from", "the", "character", "manager", "for", "later", "reference", "by", "others", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/BuilderModel.java#L118-L138
train
threerings/nenya
core/src/main/java/com/threerings/util/FileUtil.java
FileUtil.getOldestLastModified
public static long getOldestLastModified (File dir) { long oldest = dir.lastModified(); File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { oldest = Math.min(oldest, getOldestLastModified(fil...
java
public static long getOldestLastModified (File dir) { long oldest = dir.lastModified(); File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { oldest = Math.min(oldest, getOldestLastModified(fil...
[ "public", "static", "long", "getOldestLastModified", "(", "File", "dir", ")", "{", "long", "oldest", "=", "dir", ".", "lastModified", "(", ")", ";", "File", "[", "]", "files", "=", "dir", ".", "listFiles", "(", ")", ";", "if", "(", "files", "!=", "nu...
Returns the timestamp of the oldest modification date of any file within the directory.
[ "Returns", "the", "timestamp", "of", "the", "oldest", "modification", "date", "of", "any", "file", "within", "the", "directory", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/FileUtil.java#L29-L43
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.intKeySet
public Set<Integer> intKeySet() { return data.keySet().stream() .map(Any2::getLeft) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty)) .collect(Collectors.toSet()); }
java
public Set<Integer> intKeySet() { return data.keySet().stream() .map(Any2::getLeft) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty)) .collect(Collectors.toSet()); }
[ "public", "Set", "<", "Integer", ">", "intKeySet", "(", ")", "{", "return", "data", ".", "keySet", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "Any2", "::", "getLeft", ")", ".", "flatMap", "(", "opt", "->", "opt", ".", "map", "(", "Stream...
The numeric set of keys held by the resolver map. @return the numberic set of keys held by the resolver map.
[ "The", "numeric", "set", "of", "keys", "held", "by", "the", "resolver", "map", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L211-L216
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.stringKeySet
public Set<String> stringKeySet() { return data.keySet().stream() .map(Any2::getRight) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty)) .collect(Collectors.toSet()); }
java
public Set<String> stringKeySet() { return data.keySet().stream() .map(Any2::getRight) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty)) .collect(Collectors.toSet()); }
[ "public", "Set", "<", "String", ">", "stringKeySet", "(", ")", "{", "return", "data", ".", "keySet", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "Any2", "::", "getRight", ")", ".", "flatMap", "(", "opt", "->", "opt", ".", "map", "(", "Str...
The string set of keys held by the resolver map. @return the string set of keys held by the resolver map.
[ "The", "string", "set", "of", "keys", "held", "by", "the", "resolver", "map", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L223-L228
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.getRawMap
public Map<Any2<Integer, String>, Any3<Boolean, Integer, String>> getRawMap() { return unmodifiableMap(data); }
java
public Map<Any2<Integer, String>, Any3<Boolean, Integer, String>> getRawMap() { return unmodifiableMap(data); }
[ "public", "Map", "<", "Any2", "<", "Integer", ",", "String", ">", ",", "Any3", "<", "Boolean", ",", "Integer", ",", "String", ">", ">", "getRawMap", "(", ")", "{", "return", "unmodifiableMap", "(", "data", ")", ";", "}" ]
Get the underlying map of data. @return The raw map underlying this NamedResolverMap.
[ "Get", "the", "underlying", "map", "of", "data", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L319-L321
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.getStringMap
public Map<Any2<Integer, String>, String> getStringMap() { return data.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().mapCombine(Object::toString, Object::toString, Object::toString))); }
java
public Map<Any2<Integer, String>, String> getStringMap() { return data.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().mapCombine(Object::toString, Object::toString, Object::toString))); }
[ "public", "Map", "<", "Any2", "<", "Integer", ",", "String", ">", ",", "String", ">", "getStringMap", "(", ")", "{", "return", "data", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "collect", "(", "Collectors", ".", "toMap", "(", "Map", ...
Get the underlying map, but with all values converted to string. @return The raw map with every value converted to a string.
[ "Get", "the", "underlying", "map", "but", "with", "all", "values", "converted", "to", "string", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L328-L331
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/SpritePanel.java
SpritePanel.generateSprite
protected void generateSprite () { int components[] = _model.getSelectedComponents(); CharacterDescriptor desc = new CharacterDescriptor(components, null); CharacterSprite sprite = _charmgr.getCharacter(desc); setSprite(sprite); }
java
protected void generateSprite () { int components[] = _model.getSelectedComponents(); CharacterDescriptor desc = new CharacterDescriptor(components, null); CharacterSprite sprite = _charmgr.getCharacter(desc); setSprite(sprite); }
[ "protected", "void", "generateSprite", "(", ")", "{", "int", "components", "[", "]", "=", "_model", ".", "getSelectedComponents", "(", ")", ";", "CharacterDescriptor", "desc", "=", "new", "CharacterDescriptor", "(", "components", ",", "null", ")", ";", "Charac...
Generates a new character sprite for display to reflect the currently selected character components.
[ "Generates", "a", "new", "character", "sprite", "for", "display", "to", "reflect", "the", "currently", "selected", "character", "components", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/SpritePanel.java#L88-L94
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/SpritePanel.java
SpritePanel.setSprite
protected void setSprite (CharacterSprite sprite) { sprite.setActionSequence(StandardActions.STANDING); sprite.setOrientation(WEST); _sprite = sprite; centerSprite(); repaint(); }
java
protected void setSprite (CharacterSprite sprite) { sprite.setActionSequence(StandardActions.STANDING); sprite.setOrientation(WEST); _sprite = sprite; centerSprite(); repaint(); }
[ "protected", "void", "setSprite", "(", "CharacterSprite", "sprite", ")", "{", "sprite", ".", "setActionSequence", "(", "StandardActions", ".", "STANDING", ")", ";", "sprite", ".", "setOrientation", "(", "WEST", ")", ";", "_sprite", "=", "sprite", ";", "centerS...
Sets the sprite to be displayed.
[ "Sets", "the", "sprite", "to", "be", "displayed", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/SpritePanel.java#L99-L106
train
threerings/nenya
core/src/main/java/com/threerings/cast/builder/SpritePanel.java
SpritePanel.centerSprite
protected void centerSprite () { if (_sprite != null) { Dimension d = getSize(); int shei = _sprite.getHeight(); int x = d.width / 2, y = (d.height + shei) / 2; _sprite.setLocation(x, y); } }
java
protected void centerSprite () { if (_sprite != null) { Dimension d = getSize(); int shei = _sprite.getHeight(); int x = d.width / 2, y = (d.height + shei) / 2; _sprite.setLocation(x, y); } }
[ "protected", "void", "centerSprite", "(", ")", "{", "if", "(", "_sprite", "!=", "null", ")", "{", "Dimension", "d", "=", "getSize", "(", ")", ";", "int", "shei", "=", "_sprite", ".", "getHeight", "(", ")", ";", "int", "x", "=", "d", ".", "width", ...
Sets the sprite's location to render it centered within the panel.
[ "Sets", "the", "sprite", "s", "location", "to", "render", "it", "centered", "within", "the", "panel", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/SpritePanel.java#L111-L119
train
threerings/nenya
tools/src/main/java/com/threerings/miso/tools/xml/SimpleMisoSceneParser.java
SimpleMisoSceneParser.parseScene
public SimpleMisoSceneModel parseScene (InputStream in) throws IOException, SAXException { _model = null; _digester.push(this); _digester.parse(in); return _model; }
java
public SimpleMisoSceneModel parseScene (InputStream in) throws IOException, SAXException { _model = null; _digester.push(this); _digester.parse(in); return _model; }
[ "public", "SimpleMisoSceneModel", "parseScene", "(", "InputStream", "in", ")", "throws", "IOException", ",", "SAXException", "{", "_model", "=", "null", ";", "_digester", ".", "push", "(", "this", ")", ";", "_digester", ".", "parse", "(", "in", ")", ";", "...
Parses the XML file on the supplied input stream into a scene model instance.
[ "Parses", "the", "XML", "file", "on", "the", "supplied", "input", "stream", "into", "a", "scene", "model", "instance", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/miso/tools/xml/SimpleMisoSceneParser.java#L77-L84
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.setGain
public void setGain (float gain) { _gain = gain; if (_fadeMode == FadeMode.NONE) { _source.setGain(_gain); } }
java
public void setGain (float gain) { _gain = gain; if (_fadeMode == FadeMode.NONE) { _source.setGain(_gain); } }
[ "public", "void", "setGain", "(", "float", "gain", ")", "{", "_gain", "=", "gain", ";", "if", "(", "_fadeMode", "==", "FadeMode", ".", "NONE", ")", "{", "_source", ".", "setGain", "(", "_gain", ")", ";", "}", "}" ]
Sets the base gain of the stream.
[ "Sets", "the", "base", "gain", "of", "the", "stream", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L59-L65
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.play
public void play () { if (_state == AL10.AL_PLAYING) { log.warning("Tried to play stream already playing."); return; } if (_state == AL10.AL_INITIAL) { _qidx = _qlen = 0; queueBuffers(_buffers.length); } _source.play(); ...
java
public void play () { if (_state == AL10.AL_PLAYING) { log.warning("Tried to play stream already playing."); return; } if (_state == AL10.AL_INITIAL) { _qidx = _qlen = 0; queueBuffers(_buffers.length); } _source.play(); ...
[ "public", "void", "play", "(", ")", "{", "if", "(", "_state", "==", "AL10", ".", "AL_PLAYING", ")", "{", "log", ".", "warning", "(", "\"Tried to play stream already playing.\"", ")", ";", "return", ";", "}", "if", "(", "_state", "==", "AL10", ".", "AL_IN...
Starts playing this stream.
[ "Starts", "playing", "this", "stream", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L86-L98
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.pause
public void pause () { if (_state != AL10.AL_PLAYING) { log.warning("Tried to pause stream that wasn't playing."); return; } _source.pause(); _state = AL10.AL_PAUSED; }
java
public void pause () { if (_state != AL10.AL_PLAYING) { log.warning("Tried to pause stream that wasn't playing."); return; } _source.pause(); _state = AL10.AL_PAUSED; }
[ "public", "void", "pause", "(", ")", "{", "if", "(", "_state", "!=", "AL10", ".", "AL_PLAYING", ")", "{", "log", ".", "warning", "(", "\"Tried to pause stream that wasn't playing.\"", ")", ";", "return", ";", "}", "_source", ".", "pause", "(", ")", ";", ...
Pauses this stream.
[ "Pauses", "this", "stream", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L103-L111
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.stop
public void stop () { if (_state == AL10.AL_STOPPED) { log.warning("Tried to stop stream that was already stopped."); return; } _source.stop(); _state = AL10.AL_STOPPED; }
java
public void stop () { if (_state == AL10.AL_STOPPED) { log.warning("Tried to stop stream that was already stopped."); return; } _source.stop(); _state = AL10.AL_STOPPED; }
[ "public", "void", "stop", "(", ")", "{", "if", "(", "_state", "==", "AL10", ".", "AL_STOPPED", ")", "{", "log", ".", "warning", "(", "\"Tried to stop stream that was already stopped.\"", ")", ";", "return", ";", "}", "_source", ".", "stop", "(", ")", ";", ...
Stops this stream.
[ "Stops", "this", "stream", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L116-L124
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.fadeIn
public void fadeIn (float interval) { if (_state != AL10.AL_PLAYING) { play(); } _source.setGain(0f); _fadeMode = FadeMode.IN; _fadeInterval = interval; _fadeElapsed = 0f; }
java
public void fadeIn (float interval) { if (_state != AL10.AL_PLAYING) { play(); } _source.setGain(0f); _fadeMode = FadeMode.IN; _fadeInterval = interval; _fadeElapsed = 0f; }
[ "public", "void", "fadeIn", "(", "float", "interval", ")", "{", "if", "(", "_state", "!=", "AL10", ".", "AL_PLAYING", ")", "{", "play", "(", ")", ";", "}", "_source", ".", "setGain", "(", "0f", ")", ";", "_fadeMode", "=", "FadeMode", ".", "IN", ";"...
Fades this stream in over the specified interval. If the stream isn't playing, it will be started.
[ "Fades", "this", "stream", "in", "over", "the", "specified", "interval", ".", "If", "the", "stream", "isn", "t", "playing", "it", "will", "be", "started", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L130-L139
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.fadeOut
public void fadeOut (float interval, boolean dispose) { _fadeMode = dispose ? FadeMode.OUT_DISPOSE : FadeMode.OUT; _fadeInterval = interval; _fadeElapsed = 0f; }
java
public void fadeOut (float interval, boolean dispose) { _fadeMode = dispose ? FadeMode.OUT_DISPOSE : FadeMode.OUT; _fadeInterval = interval; _fadeElapsed = 0f; }
[ "public", "void", "fadeOut", "(", "float", "interval", ",", "boolean", "dispose", ")", "{", "_fadeMode", "=", "dispose", "?", "FadeMode", ".", "OUT_DISPOSE", ":", "FadeMode", ".", "OUT", ";", "_fadeInterval", "=", "interval", ";", "_fadeElapsed", "=", "0f", ...
Fades this stream out over the specified interval. @param dispose if true, dispose of the stream when done fading out
[ "Fades", "this", "stream", "out", "over", "the", "specified", "interval", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L146-L151
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.dispose
public void dispose () { // make sure the stream is stopped if (_state != AL10.AL_STOPPED) { stop(); } // delete the source and buffers _source.delete(); for (Buffer buffer : _buffers) { buffer.delete(); } // remove from manag...
java
public void dispose () { // make sure the stream is stopped if (_state != AL10.AL_STOPPED) { stop(); } // delete the source and buffers _source.delete(); for (Buffer buffer : _buffers) { buffer.delete(); } // remove from manag...
[ "public", "void", "dispose", "(", ")", "{", "// make sure the stream is stopped", "if", "(", "_state", "!=", "AL10", ".", "AL_STOPPED", ")", "{", "stop", "(", ")", ";", "}", "// delete the source and buffers", "_source", ".", "delete", "(", ")", ";", "for", ...
Releases the resources held by this stream and removes it from the manager.
[ "Releases", "the", "resources", "held", "by", "this", "stream", "and", "removes", "it", "from", "the", "manager", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L156-L171
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.updateFade
protected void updateFade (float time) { if (_fadeMode == FadeMode.NONE) { return; } float alpha = Math.min((_fadeElapsed += time) / _fadeInterval, 1f); _source.setGain(_gain * (_fadeMode == FadeMode.IN ? alpha : (1f - alpha))); if (alpha == 1f) { if (...
java
protected void updateFade (float time) { if (_fadeMode == FadeMode.NONE) { return; } float alpha = Math.min((_fadeElapsed += time) / _fadeInterval, 1f); _source.setGain(_gain * (_fadeMode == FadeMode.IN ? alpha : (1f - alpha))); if (alpha == 1f) { if (...
[ "protected", "void", "updateFade", "(", "float", "time", ")", "{", "if", "(", "_fadeMode", "==", "FadeMode", ".", "NONE", ")", "{", "return", ";", "}", "float", "alpha", "=", "Math", ".", "min", "(", "(", "_fadeElapsed", "+=", "time", ")", "/", "_fad...
Updates the gain of the stream according to the fade state.
[ "Updates", "the", "gain", "of", "the", "stream", "according", "to", "the", "fade", "state", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L211-L226
train
threerings/nenya
core/src/main/java/com/threerings/openal/Stream.java
Stream.populateBuffer
protected boolean populateBuffer (Buffer buffer) { if (_abuf == null) { _abuf = ByteBuffer.allocateDirect(getBufferSize()).order(ByteOrder.nativeOrder()); } _abuf.clear(); int read = 0; try { read = Math.max(populateBuffer(_abuf), 0); } catch (...
java
protected boolean populateBuffer (Buffer buffer) { if (_abuf == null) { _abuf = ByteBuffer.allocateDirect(getBufferSize()).order(ByteOrder.nativeOrder()); } _abuf.clear(); int read = 0; try { read = Math.max(populateBuffer(_abuf), 0); } catch (...
[ "protected", "boolean", "populateBuffer", "(", "Buffer", "buffer", ")", "{", "if", "(", "_abuf", "==", "null", ")", "{", "_abuf", "=", "ByteBuffer", ".", "allocateDirect", "(", "getBufferSize", "(", ")", ")", ".", "order", "(", "ByteOrder", ".", "nativeOrd...
Populates the identified buffer with as much data as it can hold. @return true if data was read into the buffer and it should be enqueued, false if the end of the stream has been reached and no data was read into the buffer
[ "Populates", "the", "identified", "buffer", "with", "as", "much", "data", "as", "it", "can", "hold", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Stream.java#L250-L268
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java
MonitorMonitor.get_metrics_
private Map<MetricName, MetricValue> get_metrics_(DateTime now, Context ctx) { final Consumer<Alert> alert_manager = ctx.getAlertManager(); final long failed_collections = registry_.getFailedCollections(); final boolean has_config = registry_.hasConfig(); final Optional<Duration> scrape_...
java
private Map<MetricName, MetricValue> get_metrics_(DateTime now, Context ctx) { final Consumer<Alert> alert_manager = ctx.getAlertManager(); final long failed_collections = registry_.getFailedCollections(); final boolean has_config = registry_.hasConfig(); final Optional<Duration> scrape_...
[ "private", "Map", "<", "MetricName", ",", "MetricValue", ">", "get_metrics_", "(", "DateTime", "now", ",", "Context", "ctx", ")", "{", "final", "Consumer", "<", "Alert", ">", "alert_manager", "=", "ctx", ".", "getAlertManager", "(", ")", ";", "final", "lon...
Get metrics for the monitor. @return All metrics for the monitor.
[ "Get", "metrics", "for", "the", "monitor", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java#L96-L129
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java
MonitorMonitor.transform
@Override public void transform(Context<MutableTimeSeriesCollectionPair> ctx) { DateTime now = ctx.getTSData().getCurrentCollection().getTimestamp(); ctx.getTSData().getCurrentCollection().addMetrics(MONITOR_GROUP, get_metrics_(now, ctx)); ctx.getAlertManager().accept(new Alert(now, MONITO...
java
@Override public void transform(Context<MutableTimeSeriesCollectionPair> ctx) { DateTime now = ctx.getTSData().getCurrentCollection().getTimestamp(); ctx.getTSData().getCurrentCollection().addMetrics(MONITOR_GROUP, get_metrics_(now, ctx)); ctx.getAlertManager().accept(new Alert(now, MONITO...
[ "@", "Override", "public", "void", "transform", "(", "Context", "<", "MutableTimeSeriesCollectionPair", ">", "ctx", ")", "{", "DateTime", "now", "=", "ctx", ".", "getTSData", "(", ")", ".", "getCurrentCollection", "(", ")", ".", "getTimestamp", "(", ")", ";"...
Emit an alert monitor.down, which is in the OK state. @param ctx Rule evaluation context.
[ "Emit", "an", "alert", "monitor", ".", "down", "which", "is", "in", "the", "OK", "state", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java#L136-L143
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java
MonitorMonitor.opt_duration_to_metricvalue_
private static MetricValue opt_duration_to_metricvalue_(Optional<Duration> duration) { return duration .map(MonitorMonitor::duration_to_metricvalue_) .orElse(MetricValue.EMPTY); }
java
private static MetricValue opt_duration_to_metricvalue_(Optional<Duration> duration) { return duration .map(MonitorMonitor::duration_to_metricvalue_) .orElse(MetricValue.EMPTY); }
[ "private", "static", "MetricValue", "opt_duration_to_metricvalue_", "(", "Optional", "<", "Duration", ">", "duration", ")", "{", "return", "duration", ".", "map", "(", "MonitorMonitor", "::", "duration_to_metricvalue_", ")", ".", "orElse", "(", "MetricValue", ".", ...
Convert an optional duration to a metric value. The returned metric value is expressed as the duration in milliseconds. If the Optional is empty, an empty metric value is emitted. @param duration The duration to express. @return A metric value representing the duration.
[ "Convert", "an", "optional", "duration", "to", "a", "metric", "value", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java#L154-L158
train
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java
InterpolatedTSC.validate
private void validate() { try { DateTime ts; ts = current.getTimestamp(); for (TimeSeriesCollection b : backward) { if (b.getTimestamp().isAfter(ts)) throw new IllegalArgumentException("backwards collection must be before current and be or...
java
private void validate() { try { DateTime ts; ts = current.getTimestamp(); for (TimeSeriesCollection b : backward) { if (b.getTimestamp().isAfter(ts)) throw new IllegalArgumentException("backwards collection must be before current and be or...
[ "private", "void", "validate", "(", ")", "{", "try", "{", "DateTime", "ts", ";", "ts", "=", "current", ".", "getTimestamp", "(", ")", ";", "for", "(", "TimeSeriesCollection", "b", ":", "backward", ")", "{", "if", "(", "b", ".", "getTimestamp", "(", "...
Check the forward and backward invariants.
[ "Check", "the", "forward", "and", "backward", "invariants", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java#L88-L112
train
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java
InterpolatedTSC.calculateNames
private static Set<GroupName> calculateNames(TimeSeriesCollection current, Collection<TimeSeriesCollection> backward, Collection<TimeSeriesCollection> forward) { final Set<GroupName> names = backward.stream() .flatMap(tsc -> tsc.getGroups(x -> true).stream()) .collect(Collectors....
java
private static Set<GroupName> calculateNames(TimeSeriesCollection current, Collection<TimeSeriesCollection> backward, Collection<TimeSeriesCollection> forward) { final Set<GroupName> names = backward.stream() .flatMap(tsc -> tsc.getGroups(x -> true).stream()) .collect(Collectors....
[ "private", "static", "Set", "<", "GroupName", ">", "calculateNames", "(", "TimeSeriesCollection", "current", ",", "Collection", "<", "TimeSeriesCollection", ">", "backward", ",", "Collection", "<", "TimeSeriesCollection", ">", "forward", ")", "{", "final", "Set", ...
Calculate all names that can be interpolated. The returned set will not have any names present in the current collection.
[ "Calculate", "all", "names", "that", "can", "be", "interpolated", ".", "The", "returned", "set", "will", "not", "have", "any", "names", "present", "in", "the", "current", "collection", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java#L171-L180
train
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java
InterpolatedTSC.interpolateTSV
private TimeSeriesValue interpolateTSV(GroupName name) { final Map.Entry<DateTime, TimeSeriesValue> backTSV = findName(backward, name), forwTSV = findName(forward, name); final long backMillis = max(new Duration(backTSV.getKey(), getTimestamp()).getMillis(), 0), forwMill...
java
private TimeSeriesValue interpolateTSV(GroupName name) { final Map.Entry<DateTime, TimeSeriesValue> backTSV = findName(backward, name), forwTSV = findName(forward, name); final long backMillis = max(new Duration(backTSV.getKey(), getTimestamp()).getMillis(), 0), forwMill...
[ "private", "TimeSeriesValue", "interpolateTSV", "(", "GroupName", "name", ")", "{", "final", "Map", ".", "Entry", "<", "DateTime", ",", "TimeSeriesValue", ">", "backTSV", "=", "findName", "(", "backward", ",", "name", ")", ",", "forwTSV", "=", "findName", "(...
Interpolates a group name, based on the most recent backward and oldest forward occurence. @param name The name of the group to interpolate. @return The interpolated name of the group.
[ "Interpolates", "a", "group", "name", "based", "on", "the", "most", "recent", "backward", "and", "oldest", "forward", "occurence", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java#L189-L200
train
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java
InterpolatedTSC.findName
private static Map.Entry<DateTime, TimeSeriesValue> findName(List<TimeSeriesCollection> c, GroupName name) { ListIterator<TimeSeriesCollection> iter = c.listIterator(); while (iter.hasNext()) { final int idx = iter.nextIndex(); final TimeSeriesCollection tsdata = iter.next(); ...
java
private static Map.Entry<DateTime, TimeSeriesValue> findName(List<TimeSeriesCollection> c, GroupName name) { ListIterator<TimeSeriesCollection> iter = c.listIterator(); while (iter.hasNext()) { final int idx = iter.nextIndex(); final TimeSeriesCollection tsdata = iter.next(); ...
[ "private", "static", "Map", ".", "Entry", "<", "DateTime", ",", "TimeSeriesValue", ">", "findName", "(", "List", "<", "TimeSeriesCollection", ">", "c", ",", "GroupName", "name", ")", "{", "ListIterator", "<", "TimeSeriesCollection", ">", "iter", "=", "c", "....
Finds the first resolution of name in the given TimeSeriesCollections. The cache is used and updated to skip the linear search phase. @param c TimeSeriesCollection instances in which to search. @param name The searched for name. Note that the name must be present in the collection. @param cache Cache used and updated ...
[ "Finds", "the", "first", "resolution", "of", "name", "in", "the", "given", "TimeSeriesCollections", ".", "The", "cache", "is", "used", "and", "updated", "to", "skip", "the", "linear", "search", "phase", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/InterpolatedTSC.java#L215-L227
train
threerings/nenya
core/src/main/java/com/threerings/media/BackFrameManager.java
BackFrameManager.createBackBuffer
protected void createBackBuffer (GraphicsConfiguration gc) { // if we have an old image, clear it out if (_backimg != null) { _backimg.flush(); _bgfx.dispose(); } // create the offscreen buffer int width = _window.getWidth(), height = _window.getHeigh...
java
protected void createBackBuffer (GraphicsConfiguration gc) { // if we have an old image, clear it out if (_backimg != null) { _backimg.flush(); _bgfx.dispose(); } // create the offscreen buffer int width = _window.getWidth(), height = _window.getHeigh...
[ "protected", "void", "createBackBuffer", "(", "GraphicsConfiguration", "gc", ")", "{", "// if we have an old image, clear it out", "if", "(", "_backimg", "!=", "null", ")", "{", "_backimg", ".", "flush", "(", ")", ";", "_bgfx", ".", "dispose", "(", ")", ";", "...
Creates the off-screen buffer used to perform double buffered rendering of the animated panel.
[ "Creates", "the", "off", "-", "screen", "buffer", "used", "to", "perform", "double", "buffered", "rendering", "of", "the", "animated", "panel", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/BackFrameManager.java#L120-L144
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/util/TileSetTrimmer.java
TileSetTrimmer.trimTileSet
public static void trimTileSet ( TileSet source, OutputStream destImage, TrimMetricsReceiver tmr) throws IOException { trimTileSet(source, destImage, tmr, FastImageIO.FILE_SUFFIX); }
java
public static void trimTileSet ( TileSet source, OutputStream destImage, TrimMetricsReceiver tmr) throws IOException { trimTileSet(source, destImage, tmr, FastImageIO.FILE_SUFFIX); }
[ "public", "static", "void", "trimTileSet", "(", "TileSet", "source", ",", "OutputStream", "destImage", ",", "TrimMetricsReceiver", "tmr", ")", "throws", "IOException", "{", "trimTileSet", "(", "source", ",", "destImage", ",", "tmr", ",", "FastImageIO", ".", "FIL...
Convenience function to trim the tile set using FastImageIO to save the result.
[ "Convenience", "function", "to", "trim", "the", "tile", "set", "using", "FastImageIO", "to", "save", "the", "result", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/util/TileSetTrimmer.java#L76-L81
train
jdillon/gshell
gshell-util/src/main/java/com/planet57/gshell/util/converter/Converters.java
Converters.setRegisterWithVM
public static void setRegisterWithVM(final boolean registerWithVM) { if (Converters.registerWithVM != registerWithVM) { Converters.registerWithVM = registerWithVM; // register all converters with the VM if (registerWithVM) { for (Entry<Class, Converter> entry : REGISTRY.entrySet()) { ...
java
public static void setRegisterWithVM(final boolean registerWithVM) { if (Converters.registerWithVM != registerWithVM) { Converters.registerWithVM = registerWithVM; // register all converters with the VM if (registerWithVM) { for (Entry<Class, Converter> entry : REGISTRY.entrySet()) { ...
[ "public", "static", "void", "setRegisterWithVM", "(", "final", "boolean", "registerWithVM", ")", "{", "if", "(", "Converters", ".", "registerWithVM", "!=", "registerWithVM", ")", "{", "Converters", ".", "registerWithVM", "=", "registerWithVM", ";", "// register all ...
Sets if converters registered with the VM PropertyEditorManager. If the new value is true, all currently registered converters are immediately registered with the VM.
[ "Sets", "if", "converters", "registered", "with", "the", "VM", "PropertyEditorManager", ".", "If", "the", "new", "value", "is", "true", "all", "currently", "registered", "converters", "are", "immediately", "registered", "with", "the", "VM", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-util/src/main/java/com/planet57/gshell/util/converter/Converters.java#L185-L198
train
jdillon/gshell
gshell-util/src/main/java/com/planet57/gshell/util/converter/Converters.java
Converters.findEditor
private static PropertyEditor findEditor(final Type type) { assert type != null; Class clazz = toClass(type); // try to locate this directly from the editor manager first. PropertyEditor editor = PropertyEditorManager.findEditor(clazz); // we're outta here if we got one. if (editor != null) { ...
java
private static PropertyEditor findEditor(final Type type) { assert type != null; Class clazz = toClass(type); // try to locate this directly from the editor manager first. PropertyEditor editor = PropertyEditorManager.findEditor(clazz); // we're outta here if we got one. if (editor != null) { ...
[ "private", "static", "PropertyEditor", "findEditor", "(", "final", "Type", "type", ")", "{", "assert", "type", "!=", "null", ";", "Class", "clazz", "=", "toClass", "(", "type", ")", ";", "// try to locate this directly from the editor manager first.", "PropertyEditor"...
Locate a property editor for given class of object. @param type The target object class of the property. @return The resolved editor, if any. Returns null if a suitable editor could not be located.
[ "Locate", "a", "property", "editor", "for", "given", "class", "of", "object", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-util/src/main/java/com/planet57/gshell/util/converter/Converters.java#L474-L502
train
threerings/nenya
core/src/main/java/com/threerings/media/image/Quantize.java
Quantize.quantizeImage
public static int[] quantizeImage(int pixels[][], int max_colors) { Cube cube = new Cube(pixels, max_colors); cube.classification(); cube.reduction(); cube.assignment(); return cube.colormap; }
java
public static int[] quantizeImage(int pixels[][], int max_colors) { Cube cube = new Cube(pixels, max_colors); cube.classification(); cube.reduction(); cube.assignment(); return cube.colormap; }
[ "public", "static", "int", "[", "]", "quantizeImage", "(", "int", "pixels", "[", "]", "[", "]", ",", "int", "max_colors", ")", "{", "Cube", "cube", "=", "new", "Cube", "(", "pixels", ",", "max_colors", ")", ";", "cube", ".", "classification", "(", ")...
Reduce the image to the given number of colors. @param pixels an in/out parameter that should initially contain [A]RGB values but that will contain color palette indicies upon return. @return The new color palette.
[ "Reduce", "the", "image", "to", "the", "given", "number", "of", "colors", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/Quantize.java#L310-L316
train
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.paint
public void paint (Graphics2D gfx, int layer, Shape clip) { for (int ii = 0, nn = _media.size(); ii < nn; ii++) { AbstractMedia media = _media.get(ii); int order = media.getRenderOrder(); try { if (((layer == ALL) || (layer == FRONT && order >= 0) || ...
java
public void paint (Graphics2D gfx, int layer, Shape clip) { for (int ii = 0, nn = _media.size(); ii < nn; ii++) { AbstractMedia media = _media.get(ii); int order = media.getRenderOrder(); try { if (((layer == ALL) || (layer == FRONT && order >= 0) || ...
[ "public", "void", "paint", "(", "Graphics2D", "gfx", ",", "int", "layer", ",", "Shape", "clip", ")", "{", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "_media", ".", "size", "(", ")", ";", "ii", "<", "nn", ";", "ii", "++", ")", "{", "Ab...
Renders all registered media in the given layer that intersect the supplied clipping rectangle to the given graphics context. @param layer the layer to render; one of {@link #FRONT}, {@link #BACK}, or {@link #ALL}. The front layer contains all animations with a positive render order; the back layer contains all animat...
[ "Renders", "all", "registered", "media", "in", "the", "given", "layer", "that", "intersect", "the", "supplied", "clipping", "rectangle", "to", "the", "given", "graphics", "context", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L103-L118
train
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.fastForward
public void fastForward (long timeDelta) { if (_tickStamp > 0) { log.warning("Egads! Asked to fastForward() during a tick.", new Exception()); } for (int ii = 0, nn = _media.size(); ii < nn; ii++) { _media.get(ii).fastForward(timeDelta); } }
java
public void fastForward (long timeDelta) { if (_tickStamp > 0) { log.warning("Egads! Asked to fastForward() during a tick.", new Exception()); } for (int ii = 0, nn = _media.size(); ii < nn; ii++) { _media.get(ii).fastForward(timeDelta); } }
[ "public", "void", "fastForward", "(", "long", "timeDelta", ")", "{", "if", "(", "_tickStamp", ">", "0", ")", "{", "log", ".", "warning", "(", "\"Egads! Asked to fastForward() during a tick.\"", ",", "new", "Exception", "(", ")", ")", ";", "}", "for", "(", ...
If the manager is paused for some length of time, it should be fast forwarded by the appropriate number of milliseconds. This allows media to smoothly pick up where they left off rather than abruptly jumping into the future, thinking that some outrageous amount of time passed since their last tick.
[ "If", "the", "manager", "is", "paused", "for", "some", "length", "of", "time", "it", "should", "be", "fast", "forwarded", "by", "the", "appropriate", "number", "of", "milliseconds", ".", "This", "allows", "media", "to", "smoothly", "pick", "up", "where", "...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L126-L135
train
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.insertMedia
protected boolean insertMedia (AbstractMedia media) { if (_media.contains(media)) { log.warning("Attempt to insert media more than once [media=" + media + "].", new Exception()); return false; } media.init(this); int ipos = _media.inse...
java
protected boolean insertMedia (AbstractMedia media) { if (_media.contains(media)) { log.warning("Attempt to insert media more than once [media=" + media + "].", new Exception()); return false; } media.init(this); int ipos = _media.inse...
[ "protected", "boolean", "insertMedia", "(", "AbstractMedia", "media", ")", "{", "if", "(", "_media", ".", "contains", "(", "media", ")", ")", "{", "log", ".", "warning", "(", "\"Attempt to insert media more than once [media=\"", "+", "media", "+", "\"].\"", ",",...
Inserts the specified media into this manager, return true on success.
[ "Inserts", "the", "specified", "media", "into", "this", "manager", "return", "true", "on", "success", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L189-L217
train
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.removeMedia
protected boolean removeMedia (AbstractMedia media) { int mpos = _media.indexOf(media); if (mpos != -1) { _media.remove(mpos); media.invalidate(); media.shutdown(); // if we're in the middle of ticking, we need to adjust the _tickpos if necessary ...
java
protected boolean removeMedia (AbstractMedia media) { int mpos = _media.indexOf(media); if (mpos != -1) { _media.remove(mpos); media.invalidate(); media.shutdown(); // if we're in the middle of ticking, we need to adjust the _tickpos if necessary ...
[ "protected", "boolean", "removeMedia", "(", "AbstractMedia", "media", ")", "{", "int", "mpos", "=", "_media", ".", "indexOf", "(", "media", ")", ";", "if", "(", "mpos", "!=", "-", "1", ")", "{", "_media", ".", "remove", "(", "mpos", ")", ";", "media"...
Removes the specified media from this manager, return true on success.
[ "Removes", "the", "specified", "media", "from", "this", "manager", "return", "true", "on", "success", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L231-L246
train
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.queueNotification
public void queueNotification (ObserverList<Object> observers, ObserverOp<Object> event) { _notify.add(new Tuple<ObserverList<Object>,ObserverOp<Object>>(observers, event)); }
java
public void queueNotification (ObserverList<Object> observers, ObserverOp<Object> event) { _notify.add(new Tuple<ObserverList<Object>,ObserverOp<Object>>(observers, event)); }
[ "public", "void", "queueNotification", "(", "ObserverList", "<", "Object", ">", "observers", ",", "ObserverOp", "<", "Object", ">", "event", ")", "{", "_notify", ".", "add", "(", "new", "Tuple", "<", "ObserverList", "<", "Object", ">", ",", "ObserverOp", "...
Queues the notification for dispatching after we've ticked all the media.
[ "Queues", "the", "notification", "for", "dispatching", "after", "we", "ve", "ticked", "all", "the", "media", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L266-L269
train
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.dispatchNotifications
protected void dispatchNotifications () { for (int ii = 0, nn = _notify.size(); ii < nn; ii++) { Tuple<ObserverList<Object>,ObserverOp<Object>> tuple = _notify.get(ii); tuple.left.apply(tuple.right); } _notify.clear(); }
java
protected void dispatchNotifications () { for (int ii = 0, nn = _notify.size(); ii < nn; ii++) { Tuple<ObserverList<Object>,ObserverOp<Object>> tuple = _notify.get(ii); tuple.left.apply(tuple.right); } _notify.clear(); }
[ "protected", "void", "dispatchNotifications", "(", ")", "{", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "_notify", ".", "size", "(", ")", ";", "ii", "<", "nn", ";", "ii", "++", ")", "{", "Tuple", "<", "ObserverList", "<", "Object", ">", "...
Dispatches all queued media notifications.
[ "Dispatches", "all", "queued", "media", "notifications", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L277-L284
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/json/JsonOutput.java
JsonOutput.addArrayIfNotNull
public static <T> void addArrayIfNotNull(JSONWriter writer, String field, Collection<T> items, JsonObjectWriter<T> objWriter) throws JSONException { if (items == null) return; addCollection(writer, field, items, objWriter); }
java
public static <T> void addArrayIfNotNull(JSONWriter writer, String field, Collection<T> items, JsonObjectWriter<T> objWriter) throws JSONException { if (items == null) return; addCollection(writer, field, items, objWriter); }
[ "public", "static", "<", "T", ">", "void", "addArrayIfNotNull", "(", "JSONWriter", "writer", ",", "String", "field", ",", "Collection", "<", "T", ">", "items", ",", "JsonObjectWriter", "<", "T", ">", "objWriter", ")", "throws", "JSONException", "{", "if", ...
Adds a list. @param writer used writer. @param field field to write. @param items used items. @param objWriter single object writer.
[ "Adds", "a", "list", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/json/JsonOutput.java#L154-L160
train
threerings/nenya
core/src/main/java/com/threerings/media/animation/AnimationSequencer.java
AnimationSequencer.startAnimation
protected void startAnimation (Animation anim, long tickStamp) { // account for any view scrolling that happened before this animation // was actually added to the view if (_vdx != 0 || _vdy != 0) { anim.viewLocationDidChange(_vdx, _vdy); } _animmgr.registerAnima...
java
protected void startAnimation (Animation anim, long tickStamp) { // account for any view scrolling that happened before this animation // was actually added to the view if (_vdx != 0 || _vdy != 0) { anim.viewLocationDidChange(_vdx, _vdy); } _animmgr.registerAnima...
[ "protected", "void", "startAnimation", "(", "Animation", "anim", ",", "long", "tickStamp", ")", "{", "// account for any view scrolling that happened before this animation", "// was actually added to the view", "if", "(", "_vdx", "!=", "0", "||", "_vdy", "!=", "0", ")", ...
Called when the time comes to start an animation. Derived classes may override this method and pass the animation on to their animation manager and do whatever else they need to do with operating animations. The default implementation simply adds them to the media panel supplied when we were constructed. @param anim t...
[ "Called", "when", "the", "time", "comes", "to", "start", "an", "animation", ".", "Derived", "classes", "may", "override", "this", "method", "and", "pass", "the", "animation", "on", "to", "their", "animation", "manager", "and", "do", "whatever", "else", "they...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/AnimationSequencer.java#L189-L198
train
threerings/nenya
core/src/main/java/com/threerings/media/VirtualRangeModel.java
VirtualRangeModel.setScrollableArea
public void setScrollableArea (int x, int y, int width, int height) { Rectangle vb = _panel.getViewBounds(); int hmax = x + width, vmax = y + height, value; if (width > vb.width) { value = MathUtil.bound(x, _hrange.getValue(), hmax - vb.width); _hrange.setRangeProper...
java
public void setScrollableArea (int x, int y, int width, int height) { Rectangle vb = _panel.getViewBounds(); int hmax = x + width, vmax = y + height, value; if (width > vb.width) { value = MathUtil.bound(x, _hrange.getValue(), hmax - vb.width); _hrange.setRangeProper...
[ "public", "void", "setScrollableArea", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "Rectangle", "vb", "=", "_panel", ".", "getViewBounds", "(", ")", ";", "int", "hmax", "=", "x", "+", "width", ",", "vmax", ...
Informs the virtual range model the extent of the area over which we can scroll.
[ "Informs", "the", "virtual", "range", "model", "the", "extent", "of", "the", "area", "over", "which", "we", "can", "scroll", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/VirtualRangeModel.java#L56-L77
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.createImage
public BufferedImage createImage (int width, int height, int transparency) { return _icreator.createImage(width, height, transparency); }
java
public BufferedImage createImage (int width, int height, int transparency) { return _icreator.createImage(width, height, transparency); }
[ "public", "BufferedImage", "createImage", "(", "int", "width", ",", "int", "height", ",", "int", "transparency", ")", "{", "return", "_icreator", ".", "createImage", "(", "width", ",", "height", ",", "transparency", ")", ";", "}" ]
Creates a buffered image, optimized for display on our graphics device.
[ "Creates", "a", "buffered", "image", "optimized", "for", "display", "on", "our", "graphics", "device", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L164-L167
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.getImageKey
public ImageKey getImageKey (String rset, String path) { return getImageKey(getDataProvider(rset), path); }
java
public ImageKey getImageKey (String rset, String path) { return getImageKey(getDataProvider(rset), path); }
[ "public", "ImageKey", "getImageKey", "(", "String", "rset", ",", "String", "path", ")", "{", "return", "getImageKey", "(", "getDataProvider", "(", "rset", ")", ",", "path", ")", ";", "}" ]
Returns an image key that can be used to fetch the image identified by the specified resource set and image path.
[ "Returns", "an", "image", "key", "that", "can", "be", "used", "to", "fetch", "the", "image", "identified", "by", "the", "specified", "resource", "set", "and", "image", "path", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L262-L265
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.getImage
public BufferedImage getImage (ImageKey key, Colorization[] zations) { CacheRecord crec = null; synchronized (_ccache) { crec = _ccache.get(key); } if (crec != null) { // log.info("Cache hit", "key", key, "crec", crec); return crec.getImage(zations...
java
public BufferedImage getImage (ImageKey key, Colorization[] zations) { CacheRecord crec = null; synchronized (_ccache) { crec = _ccache.get(key); } if (crec != null) { // log.info("Cache hit", "key", key, "crec", crec); return crec.getImage(zations...
[ "public", "BufferedImage", "getImage", "(", "ImageKey", "key", ",", "Colorization", "[", "]", "zations", ")", "{", "CacheRecord", "crec", "=", "null", ";", "synchronized", "(", "_ccache", ")", "{", "crec", "=", "_ccache", ".", "get", "(", "key", ")", ";"...
Obtains the image identified by the specified key, caching if possible. The image will be recolored using the supplied colorizations if requested.
[ "Obtains", "the", "image", "identified", "by", "the", "specified", "key", "caching", "if", "possible", ".", "The", "image", "will", "be", "recolored", "using", "the", "supplied", "colorizations", "if", "requested", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L280-L314
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.getMirage
public Mirage getMirage (String rsrcPath) { return getMirage(getImageKey(_defaultProvider, rsrcPath), null, null); }
java
public Mirage getMirage (String rsrcPath) { return getMirage(getImageKey(_defaultProvider, rsrcPath), null, null); }
[ "public", "Mirage", "getMirage", "(", "String", "rsrcPath", ")", "{", "return", "getMirage", "(", "getImageKey", "(", "_defaultProvider", ",", "rsrcPath", ")", ",", "null", ",", "null", ")", ";", "}" ]
Creates a mirage which is an image optimized for display on our current display device and which will be stored into video memory if possible.
[ "Creates", "a", "mirage", "which", "is", "an", "image", "optimized", "for", "display", "on", "our", "current", "display", "device", "and", "which", "will", "be", "stored", "into", "video", "memory", "if", "possible", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L320-L323
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.getDataProvider
protected ImageDataProvider getDataProvider (final String rset) { if (rset == null) { return _defaultProvider; } ImageDataProvider dprov = _providers.get(rset); if (dprov == null) { dprov = new ImageDataProvider() { public BufferedImage loadIm...
java
protected ImageDataProvider getDataProvider (final String rset) { if (rset == null) { return _defaultProvider; } ImageDataProvider dprov = _providers.get(rset); if (dprov == null) { dprov = new ImageDataProvider() { public BufferedImage loadIm...
[ "protected", "ImageDataProvider", "getDataProvider", "(", "final", "String", "rset", ")", "{", "if", "(", "rset", "==", "null", ")", "{", "return", "_defaultProvider", ";", "}", "ImageDataProvider", "dprov", "=", "_providers", ".", "get", "(", "rset", ")", "...
Returns the data provider configured to obtain image data from the specified resource set.
[ "Returns", "the", "data", "provider", "configured", "to", "obtain", "image", "data", "from", "the", "specified", "resource", "set", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L381-L409
train
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.loadImage
protected BufferedImage loadImage (ImageKey key) { // if (EventQueue.isDispatchThread()) { // Log.info("Loading image on AWT thread " + key + "."); // } BufferedImage image = null; try { log.debug("Loading image " + key + "."); image = key.daprov....
java
protected BufferedImage loadImage (ImageKey key) { // if (EventQueue.isDispatchThread()) { // Log.info("Loading image on AWT thread " + key + "."); // } BufferedImage image = null; try { log.debug("Loading image " + key + "."); image = key.daprov....
[ "protected", "BufferedImage", "loadImage", "(", "ImageKey", "key", ")", "{", "// if (EventQueue.isDispatchThread()) {", "// Log.info(\"Loading image on AWT thread \" + key + \".\");", "// }", "BufferedImage", "image", "=", "null", ";", "try", "{", "log...
Loads and returns the image with the specified key from the supplied data provider.
[ "Loads", "and", "returns", "the", "image", "with", "the", "specified", "key", "from", "the", "supplied", "data", "provider", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L414-L436
train
threerings/nenya
core/src/main/java/com/threerings/openal/Sound.java
Sound.setPosition
public void setPosition (float x, float y, float z) { if (_source != null) { _source.setPosition(x, y, z); } _px = x; _py = y; _pz = z; }
java
public void setPosition (float x, float y, float z) { if (_source != null) { _source.setPosition(x, y, z); } _px = x; _py = y; _pz = z; }
[ "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "_source", "!=", "null", ")", "{", "_source", ".", "setPosition", "(", "x", ",", "y", ",", "z", ")", ";", "}", "_px", "=", "x", ";", ...
Sets the position of the sound.
[ "Sets", "the", "position", "of", "the", "sound", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Sound.java#L62-L70
train
threerings/nenya
core/src/main/java/com/threerings/openal/Sound.java
Sound.setVelocity
public void setVelocity (float x, float y, float z) { if (_source != null) { _source.setVelocity(x, y, z); } _vx = x; _vy = y; _vz = z; }
java
public void setVelocity (float x, float y, float z) { if (_source != null) { _source.setVelocity(x, y, z); } _vx = x; _vy = y; _vz = z; }
[ "public", "void", "setVelocity", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "_source", "!=", "null", ")", "{", "_source", ".", "setVelocity", "(", "x", ",", "y", ",", "z", ")", ";", "}", "_vx", "=", "x", ";", ...
Sets the velocity of the sound.
[ "Sets", "the", "velocity", "of", "the", "sound", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Sound.java#L75-L83
train
threerings/nenya
core/src/main/java/com/threerings/openal/Sound.java
Sound.setDirection
public void setDirection (float x, float y, float z) { if (_source != null) { _source.setDirection(x, y, z); } _dx = x; _dy = y; _dz = z; }
java
public void setDirection (float x, float y, float z) { if (_source != null) { _source.setDirection(x, y, z); } _dx = x; _dy = y; _dz = z; }
[ "public", "void", "setDirection", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "_source", "!=", "null", ")", "{", "_source", ".", "setDirection", "(", "x", ",", "y", ",", "z", ")", ";", "}", "_dx", "=", "x", ";"...
Sets the direction of the sound.
[ "Sets", "the", "direction", "of", "the", "sound", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Sound.java#L175-L183
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.createTimer
public static MediaTimer createTimer () { MediaTimer timer = null; for (String timerClass : PERF_TIMERS) { try { timer = (MediaTimer)Class.forName(timerClass).newInstance(); break; } catch (Throwable t) { // try the next one ...
java
public static MediaTimer createTimer () { MediaTimer timer = null; for (String timerClass : PERF_TIMERS) { try { timer = (MediaTimer)Class.forName(timerClass).newInstance(); break; } catch (Throwable t) { // try the next one ...
[ "public", "static", "MediaTimer", "createTimer", "(", ")", "{", "MediaTimer", "timer", "=", "null", ";", "for", "(", "String", "timerClass", ":", "PERF_TIMERS", ")", "{", "try", "{", "timer", "=", "(", "MediaTimer", ")", "Class", ".", "forName", "(", "ti...
Attempts to create a high resolution timer, but if that isn't possible, uses a System.currentTimeMillis based timer.
[ "Attempts", "to", "create", "a", "high", "resolution", "timer", "but", "if", "that", "isn", "t", "possible", "uses", "a", "System", ".", "currentTimeMillis", "based", "timer", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L136-L153
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.newInstance
public static FrameManager newInstance (ManagedRoot root, MediaTimer timer) { FrameManager fmgr = (root instanceof ManagedJFrame && _useFlip.getValue()) ? new FlipFrameManager() : new BackFrameManager(); fmgr.init(root, timer); return fmgr; }
java
public static FrameManager newInstance (ManagedRoot root, MediaTimer timer) { FrameManager fmgr = (root instanceof ManagedJFrame && _useFlip.getValue()) ? new FlipFrameManager() : new BackFrameManager(); fmgr.init(root, timer); return fmgr; }
[ "public", "static", "FrameManager", "newInstance", "(", "ManagedRoot", "root", ",", "MediaTimer", "timer", ")", "{", "FrameManager", "fmgr", "=", "(", "root", "instanceof", "ManagedJFrame", "&&", "_useFlip", ".", "getValue", "(", ")", ")", "?", "new", "FlipFra...
Constructs a frame manager that will do its rendering to the supplied root and use the supplied media timer for timing information.
[ "Constructs", "a", "frame", "manager", "that", "will", "do", "its", "rendering", "to", "the", "supplied", "root", "and", "use", "the", "supplied", "media", "timer", "for", "timing", "information", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L159-L165
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.registerFrameParticipant
public void registerFrameParticipant (FrameParticipant participant) { Object[] nparts = ListUtil.testAndAddRef(_participants, participant); if (nparts == null) { log.warning("Refusing to add duplicate frame participant! " + participant); } else { _participants = npart...
java
public void registerFrameParticipant (FrameParticipant participant) { Object[] nparts = ListUtil.testAndAddRef(_participants, participant); if (nparts == null) { log.warning("Refusing to add duplicate frame participant! " + participant); } else { _participants = npart...
[ "public", "void", "registerFrameParticipant", "(", "FrameParticipant", "participant", ")", "{", "Object", "[", "]", "nparts", "=", "ListUtil", ".", "testAndAddRef", "(", "_participants", ",", "participant", ")", ";", "if", "(", "nparts", "==", "null", ")", "{"...
Registers a frame participant. The participant will be given the opportunity to do processing and rendering on each frame.
[ "Registers", "a", "frame", "participant", ".", "The", "participant", "will", "be", "given", "the", "opportunity", "to", "do", "processing", "and", "rendering", "on", "each", "frame", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L184-L192
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.getPerfMetrics
public TrailingAverage[] getPerfMetrics () { if (_metrics == null) { _metrics = new TrailingAverage[] { new TrailingAverage(150), new TrailingAverage(150), new TrailingAverage(150) }; } return _metrics; }
java
public TrailingAverage[] getPerfMetrics () { if (_metrics == null) { _metrics = new TrailingAverage[] { new TrailingAverage(150), new TrailingAverage(150), new TrailingAverage(150) }; } return _metrics; }
[ "public", "TrailingAverage", "[", "]", "getPerfMetrics", "(", ")", "{", "if", "(", "_metrics", "==", "null", ")", "{", "_metrics", "=", "new", "TrailingAverage", "[", "]", "{", "new", "TrailingAverage", "(", "150", ")", ",", "new", "TrailingAverage", "(", ...
Returns debug performance metrics.
[ "Returns", "debug", "performance", "metrics", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L327-L335
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.getRoot
public static Component getRoot (Component comp, Rectangle rect) { for (Component c = comp; c != null; c = c.getParent()) { if (!c.isVisible() || !c.isDisplayable()) { return null; } if (c instanceof Window || c instanceof Applet) { return ...
java
public static Component getRoot (Component comp, Rectangle rect) { for (Component c = comp; c != null; c = c.getParent()) { if (!c.isVisible() || !c.isDisplayable()) { return null; } if (c instanceof Window || c instanceof Applet) { return ...
[ "public", "static", "Component", "getRoot", "(", "Component", "comp", ",", "Rectangle", "rect", ")", "{", "for", "(", "Component", "c", "=", "comp", ";", "c", "!=", "null", ";", "c", "=", "c", ".", "getParent", "(", ")", ")", "{", "if", "(", "!", ...
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. Along the way, it adjusts the supplied component-relative rectangle to be relative to the returned root component.
[ "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/FrameManager.java#L343-L356
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.init
protected void init (ManagedRoot root, MediaTimer timer) { _window = root.getWindow(); _root = root; _root.init(this); _timer = timer; // set up our custom repaint manager _repainter = new ActiveRepaintManager( (_root instanceof Component) ? (Component)_r...
java
protected void init (ManagedRoot root, MediaTimer timer) { _window = root.getWindow(); _root = root; _root.init(this); _timer = timer; // set up our custom repaint manager _repainter = new ActiveRepaintManager( (_root instanceof Component) ? (Component)_r...
[ "protected", "void", "init", "(", "ManagedRoot", "root", ",", "MediaTimer", "timer", ")", "{", "_window", "=", "root", ".", "getWindow", "(", ")", ";", "_root", "=", "root", ";", "_root", ".", "init", "(", "this", ")", ";", "_timer", "=", "timer", ";...
Initializes this frame manager and prepares it for operation.
[ "Initializes", "this", "frame", "manager", "and", "prepares", "it", "for", "operation", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L361-L375
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.tick
protected void tick (long tickStamp) { long start = 0L, paint = 0L; if (_perfDebug.getValue()) { start = paint = _timer.getElapsedMicros(); } // if our frame is not showing (or is impossibly sized), don't try rendering anything if (_window.isShowing() && _window....
java
protected void tick (long tickStamp) { long start = 0L, paint = 0L; if (_perfDebug.getValue()) { start = paint = _timer.getElapsedMicros(); } // if our frame is not showing (or is impossibly sized), don't try rendering anything if (_window.isShowing() && _window....
[ "protected", "void", "tick", "(", "long", "tickStamp", ")", "{", "long", "start", "=", "0L", ",", "paint", "=", "0L", ";", "if", "(", "_perfDebug", ".", "getValue", "(", ")", ")", "{", "start", "=", "paint", "=", "_timer", ".", "getElapsedMicros", "(...
Called to perform the frame processing and rendering.
[ "Called", "to", "perform", "the", "frame", "processing", "and", "rendering", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L380-L401
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.paint
protected boolean paint (Graphics2D gfx) { // paint our frame participants (which want to be handled specially) int painted = 0; for (Object participant : _participants) { FrameParticipant part = (FrameParticipant)participant; if (part == null) { conti...
java
protected boolean paint (Graphics2D gfx) { // paint our frame participants (which want to be handled specially) int painted = 0; for (Object participant : _participants) { FrameParticipant part = (FrameParticipant)participant; if (part == null) { conti...
[ "protected", "boolean", "paint", "(", "Graphics2D", "gfx", ")", "{", "// paint our frame participants (which want to be handled specially)", "int", "painted", "=", "0", ";", "for", "(", "Object", "participant", ":", "_participants", ")", "{", "FrameParticipant", "part",...
Paints our frame participants and any dirty components via the repaint manager. @return true if anything was painted, false if not.
[ "Paints", "our", "frame", "participants", "and", "any", "dirty", "components", "via", "the", "repaint", "manager", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L475-L552
train
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.renderLayer
protected void renderLayer (Graphics2D g, Rectangle bounds, JLayeredPane pane, boolean[] clipped, Integer layer) { // stop now if there are no components in that layer int ccount = pane.getComponentCountInLayer(layer.intValue()); if (ccount == 0) { ...
java
protected void renderLayer (Graphics2D g, Rectangle bounds, JLayeredPane pane, boolean[] clipped, Integer layer) { // stop now if there are no components in that layer int ccount = pane.getComponentCountInLayer(layer.intValue()); if (ccount == 0) { ...
[ "protected", "void", "renderLayer", "(", "Graphics2D", "g", ",", "Rectangle", "bounds", ",", "JLayeredPane", "pane", ",", "boolean", "[", "]", "clipped", ",", "Integer", "layer", ")", "{", "// stop now if there are no components in that layer", "int", "ccount", "=",...
Renders all components in the specified layer of the supplied layered pane that intersect the supplied bounds.
[ "Renders", "all", "components", "in", "the", "specified", "layer", "of", "the", "supplied", "layered", "pane", "that", "intersect", "the", "supplied", "bounds", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L585-L626
train
calrissian/mango
mango-core/src/main/java/org/calrissian/mango/collect/Iterators2.java
Iterators2.distinct
public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T co...
java
public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T co...
[ "public", "static", "<", "T", ">", "Iterator", "<", "T", ">", "distinct", "(", "final", "Iterator", "<", "T", ">", "iterator", ")", "{", "requireNonNull", "(", "iterator", ")", ";", "return", "new", "AbstractIterator", "<", "T", ">", "(", ")", "{", "...
If we can assume the iterator is sorted, return the distinct elements. This only works if the data provided is sorted.
[ "If", "we", "can", "assume", "the", "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/Iterators2.java#L42-L60
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterComponent.java
CharacterComponent.getFrames
public ActionFrames getFrames (String action, String type) { return _frameProvider.getFrames(this, action, type); }
java
public ActionFrames getFrames (String action, String type) { return _frameProvider.getFrames(this, action, type); }
[ "public", "ActionFrames", "getFrames", "(", "String", "action", ",", "String", "type", ")", "{", "return", "_frameProvider", ".", "getFrames", "(", "this", ",", "action", ",", "type", ")", ";", "}" ]
Returns the image frames for the specified action animation or null if no animation for the specified action is available for this component. @param type null for the normal action frames or one of the custom action sub-types: {@link StandardActions#SHADOW_TYPE}, etc.
[ "Returns", "the", "image", "frames", "for", "the", "specified", "action", "animation", "or", "null", "if", "no", "animation", "for", "the", "specified", "action", "is", "available", "for", "this", "component", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterComponent.java#L74-L77
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterComponent.java
CharacterComponent.getFramePath
public String getFramePath (String action, String type, Set<String> existentPaths) { return _frameProvider.getFramePath(this, action, type, existentPaths); }
java
public String getFramePath (String action, String type, Set<String> existentPaths) { return _frameProvider.getFramePath(this, action, type, existentPaths); }
[ "public", "String", "getFramePath", "(", "String", "action", ",", "String", "type", ",", "Set", "<", "String", ">", "existentPaths", ")", "{", "return", "_frameProvider", ".", "getFramePath", "(", "this", ",", "action", ",", "type", ",", "existentPaths", ")"...
Returns the path to the image frames for the specified action animation or null if no animation for the specified action is available for this component. @param type null for the normal action frames or one of the custom action sub-types: {@link StandardActions#SHADOW_TYPE}, etc. @param existentPaths the set of all p...
[ "Returns", "the", "path", "to", "the", "image", "frames", "for", "the", "specified", "action", "animation", "or", "null", "if", "no", "animation", "for", "the", "specified", "action", "is", "available", "for", "this", "component", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterComponent.java#L88-L91
train
threerings/nenya
tools/src/main/java/com/threerings/cast/bundle/tools/MetadataBundlerTask.java
MetadataBundlerTask.nextEntry
protected OutputStream nextEntry (OutputStream lastEntry, String path) throws IOException { ((JarOutputStream)lastEntry).putNextEntry(new JarEntry(path)); return lastEntry; }
java
protected OutputStream nextEntry (OutputStream lastEntry, String path) throws IOException { ((JarOutputStream)lastEntry).putNextEntry(new JarEntry(path)); return lastEntry; }
[ "protected", "OutputStream", "nextEntry", "(", "OutputStream", "lastEntry", ",", "String", "path", ")", "throws", "IOException", "{", "(", "(", "JarOutputStream", ")", "lastEntry", ")", ".", "putNextEntry", "(", "new", "JarEntry", "(", "path", ")", ")", ";", ...
Advances to the next named entry in the bundle and returns the stream to which to write that entry.
[ "Advances", "to", "the", "next", "named", "entry", "in", "the", "bundle", "and", "returns", "the", "stream", "to", "which", "to", "write", "that", "entry", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/bundle/tools/MetadataBundlerTask.java#L164-L169
train
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java
QueryBuilder.map
public QueryBuilder map(String query, String method_name, Object... items) throws Exception { JSONObject op = new JSONObject(); if (query != null) op.put(Constants.REQUEST_QUERY, query); java.util.Map<String, Object> operation = new LinkedHashMap<String, Object>(); operation...
java
public QueryBuilder map(String query, String method_name, Object... items) throws Exception { JSONObject op = new JSONObject(); if (query != null) op.put(Constants.REQUEST_QUERY, query); java.util.Map<String, Object> operation = new LinkedHashMap<String, Object>(); operation...
[ "public", "QueryBuilder", "map", "(", "String", "query", ",", "String", "method_name", ",", "Object", "...", "items", ")", "throws", "Exception", "{", "JSONObject", "op", "=", "new", "JSONObject", "(", ")", ";", "if", "(", "query", "!=", "null", ")", "op...
Used to get the return from a method call @param query @param method_name @param items @return @throws Exception
[ "Used", "to", "get", "the", "return", "from", "a", "method", "call" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java#L82-L104
train
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java
QueryBuilder.instantiate
public QueryBuilder instantiate(String query, Object... items) throws Exception { JSONObject op = new JSONObject(); if (query != null) op.put(Constants.REQUEST_INSTANTIATE, query); if (query != null) queryStringRepresentation += query; op.put(Constants.REQUEST_A...
java
public QueryBuilder instantiate(String query, Object... items) throws Exception { JSONObject op = new JSONObject(); if (query != null) op.put(Constants.REQUEST_INSTANTIATE, query); if (query != null) queryStringRepresentation += query; op.put(Constants.REQUEST_A...
[ "public", "QueryBuilder", "instantiate", "(", "String", "query", ",", "Object", "...", "items", ")", "throws", "Exception", "{", "JSONObject", "op", "=", "new", "JSONObject", "(", ")", ";", "if", "(", "query", "!=", "null", ")", "op", ".", "put", "(", ...
Used to instantiate a class @param query @param items @return @throws Exception
[ "Used", "to", "instantiate", "a", "class" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java#L113-L129
train
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java
QueryBuilder.buildArgsArray
private JSONArray buildArgsArray(Object ... items) throws Exception { JSONArray args = new JSONArray(); for (int i = 0; i < items.length; i++) { if (items[i] instanceof java.lang.String) { args.put((String) items[i]); } else if (items[i] i...
java
private JSONArray buildArgsArray(Object ... items) throws Exception { JSONArray args = new JSONArray(); for (int i = 0; i < items.length; i++) { if (items[i] instanceof java.lang.String) { args.put((String) items[i]); } else if (items[i] i...
[ "private", "JSONArray", "buildArgsArray", "(", "Object", "...", "items", ")", "throws", "Exception", "{", "JSONArray", "args", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "items", ".", "length", ";", "i", ...
Internal function used to build a JSON Array of arguments from a list of items @param items @return @throws Exception
[ "Internal", "function", "used", "to", "build", "a", "JSON", "Array", "of", "arguments", "from", "a", "list", "of", "items" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java#L137-L163
train
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java
QueryBuilder.genericRequest
private QueryBuilder genericRequest(String type, String value) throws Exception { JSONObject op = new JSONObject(); op.put(type, value); JSONArray operations = (JSONArray) request.get(Constants.REQUEST_OPERATIONS); operations.put(op); request.remove(Constants.REQUEST_OPERATIONS);...
java
private QueryBuilder genericRequest(String type, String value) throws Exception { JSONObject op = new JSONObject(); op.put(type, value); JSONArray operations = (JSONArray) request.get(Constants.REQUEST_OPERATIONS); operations.put(op); request.remove(Constants.REQUEST_OPERATIONS);...
[ "private", "QueryBuilder", "genericRequest", "(", "String", "type", ",", "String", "value", ")", "throws", "Exception", "{", "JSONObject", "op", "=", "new", "JSONObject", "(", ")", ";", "op", ".", "put", "(", "type", ",", "value", ")", ";", "JSONArray", ...
Creates a key value request @param type @param value @return @throws Exception
[ "Creates", "a", "key", "value", "request" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java#L227-L235
train
groupon/robo-remote
RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java
QueryBuilder.execute
public JSONArray execute() throws Exception { try { JSONArray retVal = Client.getInstance(port).map(toString()); return retVal; } catch (Exception e) { throw new Exception(queryStringRepresentation + ": " + e.getMessage()); } }
java
public JSONArray execute() throws Exception { try { JSONArray retVal = Client.getInstance(port).map(toString()); return retVal; } catch (Exception e) { throw new Exception(queryStringRepresentation + ": " + e.getMessage()); } }
[ "public", "JSONArray", "execute", "(", ")", "throws", "Exception", "{", "try", "{", "JSONArray", "retVal", "=", "Client", ".", "getInstance", "(", "port", ")", ".", "map", "(", "toString", "(", ")", ")", ";", "return", "retVal", ";", "}", "catch", "(",...
Execute a series of commands @return @throws Exception
[ "Execute", "a", "series", "of", "commands" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/QueryBuilder.java#L242-L250
train
groupon/robo-remote
UIAutomatorServer/src/main/com/groupon/roboremote/uiautomatorserver/UiAutomatorServer.java
UiAutomatorServer.getInstantiatedClass
protected Object getInstantiatedClass(String query) { if (query.equals(Constants.UIAUTOMATOR_UIDEVICE)) { return device; } return null; }
java
protected Object getInstantiatedClass(String query) { if (query.equals(Constants.UIAUTOMATOR_UIDEVICE)) { return device; } return null; }
[ "protected", "Object", "getInstantiatedClass", "(", "String", "query", ")", "{", "if", "(", "query", ".", "equals", "(", "Constants", ".", "UIAUTOMATOR_UIDEVICE", ")", ")", "{", "return", "device", ";", "}", "return", "null", ";", "}" ]
Implementation of getInstantiatedClass that returns a UiDevice if one is requested @param query @return
[ "Implementation", "of", "getInstantiatedClass", "that", "returns", "a", "UiDevice", "if", "one", "is", "requested" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/UIAutomatorServer/src/main/com/groupon/roboremote/uiautomatorserver/UiAutomatorServer.java#L52-L57
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java
PushMetricRegistryInstance.setHistory
public synchronized void setHistory(CollectHistory history) { history_ = Optional.of(history); history_.ifPresent(getApi()::setHistory); data_.initWithHistoricalData(history, getDecoratorLookBack()); }
java
public synchronized void setHistory(CollectHistory history) { history_ = Optional.of(history); history_.ifPresent(getApi()::setHistory); data_.initWithHistoricalData(history, getDecoratorLookBack()); }
[ "public", "synchronized", "void", "setHistory", "(", "CollectHistory", "history", ")", "{", "history_", "=", "Optional", ".", "of", "(", "history", ")", ";", "history_", ".", "ifPresent", "(", "getApi", "(", ")", "::", "setHistory", ")", ";", "data_", ".",...
Set the history module that the push processor is to use.
[ "Set", "the", "history", "module", "that", "the", "push", "processor", "is", "to", "use", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java#L72-L76
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java
PushMetricRegistryInstance.beginCollection
@Override protected synchronized CollectionContext beginCollection(DateTime now) { data_.startNewCycle(now, getDecoratorLookBack()); return new CollectionContext() { final Map<GroupName, Alert> alerts = new HashMap<>(); @Override public Consumer<Alert> alertMana...
java
@Override protected synchronized CollectionContext beginCollection(DateTime now) { data_.startNewCycle(now, getDecoratorLookBack()); return new CollectionContext() { final Map<GroupName, Alert> alerts = new HashMap<>(); @Override public Consumer<Alert> alertMana...
[ "@", "Override", "protected", "synchronized", "CollectionContext", "beginCollection", "(", "DateTime", "now", ")", "{", "data_", ".", "startNewCycle", "(", "now", ",", "getDecoratorLookBack", "(", ")", ")", ";", "return", "new", "CollectionContext", "(", ")", "{...
Begin a new collection cycle. Note that the cycle isn't stored (a call to commitCollection is required). @return A new collection cycle.
[ "Begin", "a", "new", "collection", "cycle", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java#L108-L141
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java
PushMetricRegistryInstance.combine_alert_with_past_
private static Alert combine_alert_with_past_(Alert alert, Map<GroupName, Alert> previous) { Alert result = Optional.ofNullable(previous.get(alert.getName())) .map((prev) -> prev.extend(alert)) .orElse(alert); logger.log(Level.FINE, "emitting alert {0} -> {1}", new Object...
java
private static Alert combine_alert_with_past_(Alert alert, Map<GroupName, Alert> previous) { Alert result = Optional.ofNullable(previous.get(alert.getName())) .map((prev) -> prev.extend(alert)) .orElse(alert); logger.log(Level.FINE, "emitting alert {0} -> {1}", new Object...
[ "private", "static", "Alert", "combine_alert_with_past_", "(", "Alert", "alert", ",", "Map", "<", "GroupName", ",", "Alert", ">", "previous", ")", "{", "Alert", "result", "=", "Optional", ".", "ofNullable", "(", "previous", ".", "get", "(", "alert", ".", "...
Combine a new alert with its previous state. @param alert An emitted alert. @param previous A map with alerts during the previous cycle. @return An alert that its predecessor extended.
[ "Combine", "a", "new", "alert", "with", "its", "previous", "state", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java#L150-L156
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java
PushMetricRegistryInstance.create
public static synchronized PushMetricRegistryInstance create(Supplier<DateTime> now, boolean has_config, EndpointRegistration api) { return new PushMetricRegistryInstance(now, has_config, api); }
java
public static synchronized PushMetricRegistryInstance create(Supplier<DateTime> now, boolean has_config, EndpointRegistration api) { return new PushMetricRegistryInstance(now, has_config, api); }
[ "public", "static", "synchronized", "PushMetricRegistryInstance", "create", "(", "Supplier", "<", "DateTime", ">", "now", ",", "boolean", "has_config", ",", "EndpointRegistration", "api", ")", "{", "return", "new", "PushMetricRegistryInstance", "(", "now", ",", "has...
Create a plain, uninitialized metric registry. The metric registry is registered under its mbeanObjectName(package_name). @param now A function returning DateTime.now(DateTimeZone.UTC). Allowing specifying it, for the benefit of unit tests. @param has_config True if the metric registry instance should mark monsoon as...
[ "Create", "a", "plain", "uninitialized", "metric", "registry", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/PushMetricRegistryInstance.java#L183-L185
train
threerings/nenya
core/src/main/java/com/threerings/media/image/NinePatchMirage.java
NinePatchMirage.newNinePatchContaining
public static Mirage newNinePatchContaining(NinePatch ninePatch, Rectangle content) { Rectangle bounds = ninePatch.getBoundsSurrounding(content); Mirage mirage = new NinePatchMirage(ninePatch, bounds.width, bounds.height); return new TransformedMirage(mirage, AffineTransform.get...
java
public static Mirage newNinePatchContaining(NinePatch ninePatch, Rectangle content) { Rectangle bounds = ninePatch.getBoundsSurrounding(content); Mirage mirage = new NinePatchMirage(ninePatch, bounds.width, bounds.height); return new TransformedMirage(mirage, AffineTransform.get...
[ "public", "static", "Mirage", "newNinePatchContaining", "(", "NinePatch", "ninePatch", ",", "Rectangle", "content", ")", "{", "Rectangle", "bounds", "=", "ninePatch", ".", "getBoundsSurrounding", "(", "content", ")", ";", "Mirage", "mirage", "=", "new", "NinePatch...
Returns a new Mirage that's a NinePatch stretched and positioned to contain the given Rectangle.
[ "Returns", "a", "new", "Mirage", "that", "s", "a", "NinePatch", "stretched", "and", "positioned", "to", "contain", "the", "given", "Rectangle", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/NinePatchMirage.java#L53-L60
train
knowitall/common-java
src/main/java/edu/washington/cs/knowitall/commonlib/Range.java
Range.isDisjoint
public static boolean isDisjoint(Collection<Range> ranges) { List<Range> rangesList = new ArrayList<Range>(ranges.size()); rangesList.addAll(ranges); Collections.sort(rangesList); for (int i = 0; i < rangesList.size() - 1; i++) { Range rCurrent = rangesList.get(i); ...
java
public static boolean isDisjoint(Collection<Range> ranges) { List<Range> rangesList = new ArrayList<Range>(ranges.size()); rangesList.addAll(ranges); Collections.sort(rangesList); for (int i = 0; i < rangesList.size() - 1; i++) { Range rCurrent = rangesList.get(i); ...
[ "public", "static", "boolean", "isDisjoint", "(", "Collection", "<", "Range", ">", "ranges", ")", "{", "List", "<", "Range", ">", "rangesList", "=", "new", "ArrayList", "<", "Range", ">", "(", "ranges", ".", "size", "(", ")", ")", ";", "rangesList", "....
Checks weather the given set of ranges are disjoint, i.e. none of the ranges overlap. @param ranges
[ "Checks", "weather", "the", "given", "set", "of", "ranges", "are", "disjoint", "i", ".", "e", ".", "none", "of", "the", "ranges", "overlap", "." ]
6c3e7b2f13da5afb1306e87a6c322c55b65fddfc
https://github.com/knowitall/common-java/blob/6c3e7b2f13da5afb1306e87a6c322c55b65fddfc/src/main/java/edu/washington/cs/knowitall/commonlib/Range.java#L265-L277
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java
ConfigSupport.escapeString
private static EscapeStringResult escapeString(String s, char quote) { final String[] octal_strings = { "\\0", "\\001", "\\002", "\\003", "\\004", "\\005", "\\006", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "\\016", "\\017", "\\020", "\\021", "\\022", "\\...
java
private static EscapeStringResult escapeString(String s, char quote) { final String[] octal_strings = { "\\0", "\\001", "\\002", "\\003", "\\004", "\\005", "\\006", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "\\016", "\\017", "\\020", "\\021", "\\022", "\\...
[ "private", "static", "EscapeStringResult", "escapeString", "(", "String", "s", ",", "char", "quote", ")", "{", "final", "String", "[", "]", "octal_strings", "=", "{", "\"\\\\0\"", ",", "\"\\\\001\"", ",", "\"\\\\002\"", ",", "\"\\\\003\"", ",", "\"\\\\004\"", ...
Escape a string configuration element. @param s a string. @return the string, between quotes, escaped such that the configuration parser will accept it as a string.
[ "Escape", "a", "string", "configuration", "element", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java#L103-L147
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java
ConfigSupport.quotedString
public static StringBuilder quotedString(String s) { final EscapeStringResult escapeString = escapeString(s, '\"'); final StringBuilder result = escapeString.buffer; result.insert(0, '\"'); result.append('\"'); return result; }
java
public static StringBuilder quotedString(String s) { final EscapeStringResult escapeString = escapeString(s, '\"'); final StringBuilder result = escapeString.buffer; result.insert(0, '\"'); result.append('\"'); return result; }
[ "public", "static", "StringBuilder", "quotedString", "(", "String", "s", ")", "{", "final", "EscapeStringResult", "escapeString", "=", "escapeString", "(", "s", ",", "'", "'", ")", ";", "final", "StringBuilder", "result", "=", "escapeString", ".", "buffer", ";...
Create a quoted string configuration element. @param s a string. @return the string, between quotes, escaped such that the configuration parser will accept it as a string.
[ "Create", "a", "quoted", "string", "configuration", "element", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java#L154-L161
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java
ConfigSupport.maybeQuoteIdentifier
public static StringBuilder maybeQuoteIdentifier(String s) { final EscapeStringResult escapeString = escapeString(s, '\''); final StringBuilder result = escapeString.buffer; final boolean need_quotes = s.isEmpty() || escapeString.needQuotes || KEYWORDS.contains(s...
java
public static StringBuilder maybeQuoteIdentifier(String s) { final EscapeStringResult escapeString = escapeString(s, '\''); final StringBuilder result = escapeString.buffer; final boolean need_quotes = s.isEmpty() || escapeString.needQuotes || KEYWORDS.contains(s...
[ "public", "static", "StringBuilder", "maybeQuoteIdentifier", "(", "String", "s", ")", "{", "final", "EscapeStringResult", "escapeString", "=", "escapeString", "(", "s", ",", "'", "'", ")", ";", "final", "StringBuilder", "result", "=", "escapeString", ".", "buffe...
Create an identifier configuration element. @param s an identifier @return the identifier as a string, which is escaped and quoted if needed.
[ "Create", "an", "identifier", "configuration", "element", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java#L168-L182
train
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java
ConfigSupport.durationConfigString
public static StringBuilder durationConfigString(Duration duration) { Duration remainder = duration; long days = remainder.getStandardDays(); remainder = remainder.minus(Duration.standardDays(days)); long hours = remainder.getStandardHours(); remainder = remainder.minus(Duratio...
java
public static StringBuilder durationConfigString(Duration duration) { Duration remainder = duration; long days = remainder.getStandardDays(); remainder = remainder.minus(Duration.standardDays(days)); long hours = remainder.getStandardHours(); remainder = remainder.minus(Duratio...
[ "public", "static", "StringBuilder", "durationConfigString", "(", "Duration", "duration", ")", "{", "Duration", "remainder", "=", "duration", ";", "long", "days", "=", "remainder", ".", "getStandardDays", "(", ")", ";", "remainder", "=", "remainder", ".", "minus...
Convert duration to an representation accepted by Configuration parser. @param duration A duration. @return A StringBuilder with the string representation of the duration.
[ "Convert", "duration", "to", "an", "representation", "accepted", "by", "Configuration", "parser", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/ConfigSupport.java#L200-L237
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/Transport.java
Transport.download
public <R> R download(String uri, ContentHandler<BasicHttpResponse, R> handler) throws RedmineException { final HttpGet request = new HttpGet(uri); return errorCheckingCommunicator.sendRequest(request, handler); }
java
public <R> R download(String uri, ContentHandler<BasicHttpResponse, R> handler) throws RedmineException { final HttpGet request = new HttpGet(uri); return errorCheckingCommunicator.sendRequest(request, handler); }
[ "public", "<", "R", ">", "R", "download", "(", "String", "uri", ",", "ContentHandler", "<", "BasicHttpResponse", ",", "R", ">", "handler", ")", "throws", "RedmineException", "{", "final", "HttpGet", "request", "=", "new", "HttpGet", "(", "uri", ")", ";", ...
Downloads a redmine content. @param uri target uri. @param handler content handler. @return handler result. @throws RedmineException if something goes wrong.
[ "Downloads", "a", "redmine", "content", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/Transport.java#L288-L293
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/Transport.java
Transport.upload
public String upload(InputStream content) throws RedmineException { final URI uploadURI = getURIConfigurator().getUploadURI(); final HttpPost request = new HttpPost(uploadURI); final AbstractHttpEntity entity = new InputStreamEntity(content, -1); /* Content type required by a Redmine */ entity.setContentType(...
java
public String upload(InputStream content) throws RedmineException { final URI uploadURI = getURIConfigurator().getUploadURI(); final HttpPost request = new HttpPost(uploadURI); final AbstractHttpEntity entity = new InputStreamEntity(content, -1); /* Content type required by a Redmine */ entity.setContentType(...
[ "public", "String", "upload", "(", "InputStream", "content", ")", "throws", "RedmineException", "{", "final", "URI", "uploadURI", "=", "getURIConfigurator", "(", ")", ".", "getUploadURI", "(", ")", ";", "final", "HttpPost", "request", "=", "new", "HttpPost", "...
UPloads content on a server. @param content content stream. @return uploaded item token. @throws RedmineException if something goes wrong.
[ "UPloads", "content", "on", "a", "server", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/Transport.java#L304-L315
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/Transport.java
Transport.getObjectsList
public <T> List<T> getObjectsList(Class<T> objectClass, Collection<? extends NameValuePair> params) throws RedmineException { final EntityConfig<T> config = getConfig(objectClass); final List<T> result = new ArrayList<T>(); final List<NameValuePair> newParams = new ArrayList<NameValuePair>( params); ne...
java
public <T> List<T> getObjectsList(Class<T> objectClass, Collection<? extends NameValuePair> params) throws RedmineException { final EntityConfig<T> config = getConfig(objectClass); final List<T> result = new ArrayList<T>(); final List<NameValuePair> newParams = new ArrayList<NameValuePair>( params); ne...
[ "public", "<", "T", ">", "List", "<", "T", ">", "getObjectsList", "(", "Class", "<", "T", ">", "objectClass", ",", "Collection", "<", "?", "extends", "NameValuePair", ">", "params", ")", "throws", "RedmineException", "{", "final", "EntityConfig", "<", "T",...
Returns an object list. @return objects list, never NULL
[ "Returns", "an", "object", "list", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/Transport.java#L346-L400
train
jdillon/gshell
gshell-api/src/main/java/com/planet57/gshell/command/CommandActionSupport.java
CommandActionSupport.discoverCompleter
@Nonnull protected Completer discoverCompleter() { log.debug("Discovering completer"); // TODO: Could probably use CliProcessorAware to avoid re-creating this CliProcessor cli = new CliProcessor(); cli.addBean(this); List<ArgumentDescriptor> argumentDescriptors = cli.getArgumentDescriptors(); ...
java
@Nonnull protected Completer discoverCompleter() { log.debug("Discovering completer"); // TODO: Could probably use CliProcessorAware to avoid re-creating this CliProcessor cli = new CliProcessor(); cli.addBean(this); List<ArgumentDescriptor> argumentDescriptors = cli.getArgumentDescriptors(); ...
[ "@", "Nonnull", "protected", "Completer", "discoverCompleter", "(", ")", "{", "log", ".", "debug", "(", "\"Discovering completer\"", ")", ";", "// TODO: Could probably use CliProcessorAware to avoid re-creating this", "CliProcessor", "cli", "=", "new", "CliProcessor", "(", ...
Discover the completer for the command. @since 3.0
[ "Discover", "the", "completer", "for", "the", "command", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-api/src/main/java/com/planet57/gshell/command/CommandActionSupport.java#L105-L154
train
Systemdir/GML-Writer-for-yED
Example/src/com/github/systemdir/gml/examples/example1/Example.java
Example.getSimpleGraphFromUser
public static SimpleGraph<String, DefaultEdge> getSimpleGraphFromUser() { Scanner sc = new Scanner(System.in); SimpleGraph<String, DefaultEdge> graph = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class); // input number of vertices int verticeAmount; do { System...
java
public static SimpleGraph<String, DefaultEdge> getSimpleGraphFromUser() { Scanner sc = new Scanner(System.in); SimpleGraph<String, DefaultEdge> graph = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class); // input number of vertices int verticeAmount; do { System...
[ "public", "static", "SimpleGraph", "<", "String", ",", "DefaultEdge", ">", "getSimpleGraphFromUser", "(", ")", "{", "Scanner", "sc", "=", "new", "Scanner", "(", "System", ".", "in", ")", ";", "SimpleGraph", "<", "String", ",", "DefaultEdge", ">", "graph", ...
Asks the user to input an graph @return graph inputted by the user
[ "Asks", "the", "user", "to", "input", "an", "graph" ]
353ecf132929889cb15968865283ee511f7c8d87
https://github.com/Systemdir/GML-Writer-for-yED/blob/353ecf132929889cb15968865283ee511f7c8d87/Example/src/com/github/systemdir/gml/examples/example1/Example.java#L43-L89
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/TrimmedTile.java
TrimmedTile.getTrimmedBounds
public void getTrimmedBounds (Rectangle tbounds) { tbounds.setBounds(_tbounds.x, _tbounds.y, _mirage.getWidth(), _mirage.getHeight()); }
java
public void getTrimmedBounds (Rectangle tbounds) { tbounds.setBounds(_tbounds.x, _tbounds.y, _mirage.getWidth(), _mirage.getHeight()); }
[ "public", "void", "getTrimmedBounds", "(", "Rectangle", "tbounds", ")", "{", "tbounds", ".", "setBounds", "(", "_tbounds", ".", "x", ",", "_tbounds", ".", "y", ",", "_mirage", ".", "getWidth", "(", ")", ",", "_mirage", ".", "getHeight", "(", ")", ")", ...
Fills in the bounds of the trimmed image within the coordinate system defined by the complete virtual tile.
[ "Fills", "in", "the", "bounds", "of", "the", "trimmed", "image", "within", "the", "coordinate", "system", "defined", "by", "the", "complete", "virtual", "tile", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TrimmedTile.java#L67-L70
train
threerings/nenya
core/src/main/java/com/threerings/media/image/NinePatch.java
NinePatch.getBoundsSurrounding
public Rectangle getBoundsSurrounding (Rectangle content) { Rectangle bounds = new Rectangle(content); bounds.width += _leftPad + _rightPad; bounds.height += _topPad + _bottomPad; bounds.x -= _leftPad; bounds.y -= _topPad; return bounds; }
java
public Rectangle getBoundsSurrounding (Rectangle content) { Rectangle bounds = new Rectangle(content); bounds.width += _leftPad + _rightPad; bounds.height += _topPad + _bottomPad; bounds.x -= _leftPad; bounds.y -= _topPad; return bounds; }
[ "public", "Rectangle", "getBoundsSurrounding", "(", "Rectangle", "content", ")", "{", "Rectangle", "bounds", "=", "new", "Rectangle", "(", "content", ")", ";", "bounds", ".", "width", "+=", "_leftPad", "+", "_rightPad", ";", "bounds", ".", "height", "+=", "_...
Returns a rectangle describing the bounds of this NinePatch when drawn such that it frames the given content rectangle.
[ "Returns", "a", "rectangle", "describing", "the", "bounds", "of", "this", "NinePatch", "when", "drawn", "such", "that", "it", "frames", "the", "given", "content", "rectangle", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/NinePatch.java#L206-L216
train
threerings/nenya
core/src/main/java/com/threerings/media/image/NinePatch.java
NinePatch.getRectangle
protected static Rectangle getRectangle (BufferedImage img, boolean stretch) { Rectangle rect = new Rectangle(0, 0, img.getWidth() - 2, img.getHeight() - 2); for (int xx = 1; xx < rect.width + 1; xx++) { if (ImageUtil.hitTest(img, xx, stretch ? 0 : img.getHeight() - 1)) { ...
java
protected static Rectangle getRectangle (BufferedImage img, boolean stretch) { Rectangle rect = new Rectangle(0, 0, img.getWidth() - 2, img.getHeight() - 2); for (int xx = 1; xx < rect.width + 1; xx++) { if (ImageUtil.hitTest(img, xx, stretch ? 0 : img.getHeight() - 1)) { ...
[ "protected", "static", "Rectangle", "getRectangle", "(", "BufferedImage", "img", ",", "boolean", "stretch", ")", "{", "Rectangle", "rect", "=", "new", "Rectangle", "(", "0", ",", "0", ",", "img", ".", "getWidth", "(", ")", "-", "2", ",", "img", ".", "g...
Parses the image to find the bounds of the rectangle defined by pixels on the outside.
[ "Parses", "the", "image", "to", "find", "the", "bounds", "of", "the", "rectangle", "defined", "by", "pixels", "on", "the", "outside", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/NinePatch.java#L221-L256
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/DirtyItemList.java
DirtyItemList.appendDirtySprite
public void appendDirtySprite (Sprite sprite, int tx, int ty) { DirtyItem item = getDirtyItem(); item.init(sprite, tx, ty); _items.add(item); }
java
public void appendDirtySprite (Sprite sprite, int tx, int ty) { DirtyItem item = getDirtyItem(); item.init(sprite, tx, ty); _items.add(item); }
[ "public", "void", "appendDirtySprite", "(", "Sprite", "sprite", ",", "int", "tx", ",", "int", "ty", ")", "{", "DirtyItem", "item", "=", "getDirtyItem", "(", ")", ";", "item", ".", "init", "(", "sprite", ",", "tx", ",", "ty", ")", ";", "_items", ".", ...
Appends the dirty sprite at the given coordinates to the dirty item list. @param sprite the dirty sprite itself. @param tx the sprite's x tile position. @param ty the sprite's y tile position.
[ "Appends", "the", "dirty", "sprite", "at", "the", "given", "coordinates", "to", "the", "dirty", "item", "list", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/DirtyItemList.java#L56-L61
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/DirtyItemList.java
DirtyItemList.appendDirtyObject
public void appendDirtyObject (SceneObject scobj) { DirtyItem item = getDirtyItem(); item.init(scobj, scobj.info.x, scobj.info.y); _items.add(item); }
java
public void appendDirtyObject (SceneObject scobj) { DirtyItem item = getDirtyItem(); item.init(scobj, scobj.info.x, scobj.info.y); _items.add(item); }
[ "public", "void", "appendDirtyObject", "(", "SceneObject", "scobj", ")", "{", "DirtyItem", "item", "=", "getDirtyItem", "(", ")", ";", "item", ".", "init", "(", "scobj", ",", "scobj", ".", "info", ".", "x", ",", "scobj", ".", "info", ".", "y", ")", "...
Appends the dirty object tile at the given coordinates to the dirty item list. @param scobj the scene object that is dirty.
[ "Appends", "the", "dirty", "object", "tile", "at", "the", "given", "coordinates", "to", "the", "dirty", "item", "list", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/DirtyItemList.java#L68-L73
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/DirtyItemList.java
DirtyItemList.paintAndClear
public void paintAndClear (Graphics2D gfx) { int icount = _items.size(); for (int ii = 0; ii < icount; ii++) { DirtyItem item = _items.get(ii); item.paint(gfx); item.clear(); _freelist.add(item); } _items.clear(); }
java
public void paintAndClear (Graphics2D gfx) { int icount = _items.size(); for (int ii = 0; ii < icount; ii++) { DirtyItem item = _items.get(ii); item.paint(gfx); item.clear(); _freelist.add(item); } _items.clear(); }
[ "public", "void", "paintAndClear", "(", "Graphics2D", "gfx", ")", "{", "int", "icount", "=", "_items", ".", "size", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "icount", ";", "ii", "++", ")", "{", "DirtyItem", "item", "=", "...
Paints all the dirty items in this list using the supplied graphics context. The items are removed from the dirty list after being painted and the dirty list ends up empty.
[ "Paints", "all", "the", "dirty", "items", "in", "this", "list", "using", "the", "supplied", "graphics", "context", ".", "The", "items", "are", "removed", "from", "the", "dirty", "list", "after", "being", "painted", "and", "the", "dirty", "list", "ends", "u...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/DirtyItemList.java#L158-L168
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/DirtyItemList.java
DirtyItemList.clear
public void clear () { for (int icount = _items.size(); icount > 0; icount--) { DirtyItem item = _items.remove(0); item.clear(); _freelist.add(item); } }
java
public void clear () { for (int icount = _items.size(); icount > 0; icount--) { DirtyItem item = _items.remove(0); item.clear(); _freelist.add(item); } }
[ "public", "void", "clear", "(", ")", "{", "for", "(", "int", "icount", "=", "_items", ".", "size", "(", ")", ";", "icount", ">", "0", ";", "icount", "--", ")", "{", "DirtyItem", "item", "=", "_items", ".", "remove", "(", "0", ")", ";", "item", ...
Clears out any items that were in this list.
[ "Clears", "out", "any", "items", "that", "were", "in", "this", "list", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/DirtyItemList.java#L173-L180
train
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/TimeSeriesMetricAggregate.java
TimeSeriesMetricAggregate.mapAndReduce
private Intermediate mapAndReduce(Context ctx) { /* Fetch each metric wildcard and add it to the to-be-processed list. */ final List<Map.Entry<Tags, MetricValue>> matcher_tsvs = matchers_.stream() .flatMap(m -> m.filter(ctx)) .map(named_entry -> SimpleMapEntry.create(name...
java
private Intermediate mapAndReduce(Context ctx) { /* Fetch each metric wildcard and add it to the to-be-processed list. */ final List<Map.Entry<Tags, MetricValue>> matcher_tsvs = matchers_.stream() .flatMap(m -> m.filter(ctx)) .map(named_entry -> SimpleMapEntry.create(name...
[ "private", "Intermediate", "mapAndReduce", "(", "Context", "ctx", ")", "{", "/* Fetch each metric wildcard and add it to the to-be-processed list. */", "final", "List", "<", "Map", ".", "Entry", "<", "Tags", ",", "MetricValue", ">", ">", "matcher_tsvs", "=", "matchers_"...
Create a reduction of the matchers and expressions for a given context. @param ctx The context on which to apply the reduction. @return A reduction.
[ "Create", "a", "reduction", "of", "the", "matchers", "and", "expressions", "for", "a", "given", "context", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/TimeSeriesMetricAggregate.java#L130-L161
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/RedmineManager.java
RedmineManager.getIssues
public List<Issue> getIssues(Map<String, String> pParameters) throws RedmineException { Set<NameValuePair> params = new HashSet<NameValuePair>(); for (final Entry<String, String> param : pParameters.entrySet()) { params.add(new BasicNameValuePair(param.getKey(), param.getValue())); ...
java
public List<Issue> getIssues(Map<String, String> pParameters) throws RedmineException { Set<NameValuePair> params = new HashSet<NameValuePair>(); for (final Entry<String, String> param : pParameters.entrySet()) { params.add(new BasicNameValuePair(param.getKey(), param.getValue())); ...
[ "public", "List", "<", "Issue", ">", "getIssues", "(", "Map", "<", "String", ",", "String", ">", "pParameters", ")", "throws", "RedmineException", "{", "Set", "<", "NameValuePair", ">", "params", "=", "new", "HashSet", "<", "NameValuePair", ">", "(", ")", ...
Generic method to search for issues. @param pParameters the http parameters key/value pairs to append to the rest api request @return empty list if not issues with this summary field exist, never NULL @throws RedmineAuthenticationException invalid or no API access key is used with the server, which requires authorizat...
[ "Generic", "method", "to", "search", "for", "issues", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/RedmineManager.java#L194-L202
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/RedmineManager.java
RedmineManager.deleteRelation
public void deleteRelation(Integer id) throws RedmineException { transport.deleteObject(IssueRelation.class, Integer.toString(id)); }
java
public void deleteRelation(Integer id) throws RedmineException { transport.deleteObject(IssueRelation.class, Integer.toString(id)); }
[ "public", "void", "deleteRelation", "(", "Integer", "id", ")", "throws", "RedmineException", "{", "transport", ".", "deleteObject", "(", "IssueRelation", ".", "class", ",", "Integer", ".", "toString", "(", "id", ")", ")", ";", "}" ]
Delete Issue Relation with the given ID.
[ "Delete", "Issue", "Relation", "with", "the", "given", "ID", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/RedmineManager.java#L459-L461
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/RedmineManager.java
RedmineManager.uploadAttachment
public Attachment uploadAttachment(String fileName, String contentType, InputStream content) throws RedmineException, IOException { final InputStream wrapper = new MarkedInputStream(content, "uploadStream"); final String token; try { token = transport.upload(wrapper); final Attachment result = new At...
java
public Attachment uploadAttachment(String fileName, String contentType, InputStream content) throws RedmineException, IOException { final InputStream wrapper = new MarkedInputStream(content, "uploadStream"); final String token; try { token = transport.upload(wrapper); final Attachment result = new At...
[ "public", "Attachment", "uploadAttachment", "(", "String", "fileName", ",", "String", "contentType", ",", "InputStream", "content", ")", "throws", "RedmineException", ",", "IOException", "{", "final", "InputStream", "wrapper", "=", "new", "MarkedInputStream", "(", "...
Uploads an attachement. @param fileName file name of the attachement. @param contentType content type of the attachement. @param content attachement content stream. @return attachement content. @throws RedmineException if something goes wrong. @throws IOException if input cannot be read. This exception cannot be throw...
[ "Uploads", "an", "attachement", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/RedmineManager.java#L693-L709
train