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/media/util/LineSegmentPath.java
LineSegmentPath.createPath
protected void createPath (List<Point> points) { Point last = null; int size = points.size(); for (int ii = 0; ii < size; ii++) { Point p = points.get(ii); int dir = (ii == 0) ? NORTH : DirectionUtil.getDirection(last, p); addNode(p.x, p.y, dir); last = p; } }
java
protected void createPath (List<Point> points) { Point last = null; int size = points.size(); for (int ii = 0; ii < size; ii++) { Point p = points.get(ii); int dir = (ii == 0) ? NORTH : DirectionUtil.getDirection(last, p); addNode(p.x, p.y, dir); last = p; } }
[ "protected", "void", "createPath", "(", "List", "<", "Point", ">", "points", ")", "{", "Point", "last", "=", "null", ";", "int", "size", "=", "points", ".", "size", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "size", ";", ...
Populate the path with the path nodes that lead the pathable from its starting position to the given destination coordinates following the given list of screen coordinates.
[ "Populate", "the", "path", "with", "the", "path", "nodes", "that", "lead", "the", "pathable", "from", "its", "starting", "position", "to", "the", "given", "destination", "coordinates", "following", "the", "given", "list", "of", "screen", "coordinates", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/LineSegmentPath.java#L318-L329
train
threerings/nenya
core/src/main/java/com/threerings/util/BrowserUtil.java
BrowserUtil.browseURL
public static void browseURL (URL url, ResultListener<Void> listener, String genagent) { String[] cmd; if (RunAnywhere.isWindows()) { // TODO: test this on Vinders 98 // cmd = new String[] { "rundll32", "url.dll,FileProtocolHandler", // url.toString() }; String osName = System.getProperty("os.name"); if (osName.indexOf("9") != -1 || osName.indexOf("Me") != -1) { cmd = new String[] { "command.com", "/c", "start", "\"" + url.toString() + "\"" }; } else { cmd = new String[] { "cmd.exe", "/c", "start", "\"\"", "\"" + url.toString() + "\"" }; } } else if (RunAnywhere.isMacOS()) { cmd = new String[] { "open", url.toString() }; } else { // Linux, Solaris, etc cmd = new String[] { genagent, url.toString() }; } // obscure any password information String logcmd = StringUtil.join(cmd, " "); logcmd = logcmd.replaceAll("password=[^&]*", "password=XXX"); log.info("Browsing URL [cmd=" + logcmd + "]."); try { Process process = Runtime.getRuntime().exec(cmd); BrowserTracker tracker = new BrowserTracker(process, url, listener); tracker.start(); } catch (Exception e) { log.warning("Failed to launch browser [url=" + url + ", error=" + e + "]."); listener.requestFailed(e); } }
java
public static void browseURL (URL url, ResultListener<Void> listener, String genagent) { String[] cmd; if (RunAnywhere.isWindows()) { // TODO: test this on Vinders 98 // cmd = new String[] { "rundll32", "url.dll,FileProtocolHandler", // url.toString() }; String osName = System.getProperty("os.name"); if (osName.indexOf("9") != -1 || osName.indexOf("Me") != -1) { cmd = new String[] { "command.com", "/c", "start", "\"" + url.toString() + "\"" }; } else { cmd = new String[] { "cmd.exe", "/c", "start", "\"\"", "\"" + url.toString() + "\"" }; } } else if (RunAnywhere.isMacOS()) { cmd = new String[] { "open", url.toString() }; } else { // Linux, Solaris, etc cmd = new String[] { genagent, url.toString() }; } // obscure any password information String logcmd = StringUtil.join(cmd, " "); logcmd = logcmd.replaceAll("password=[^&]*", "password=XXX"); log.info("Browsing URL [cmd=" + logcmd + "]."); try { Process process = Runtime.getRuntime().exec(cmd); BrowserTracker tracker = new BrowserTracker(process, url, listener); tracker.start(); } catch (Exception e) { log.warning("Failed to launch browser [url=" + url + ", error=" + e + "]."); listener.requestFailed(e); } }
[ "public", "static", "void", "browseURL", "(", "URL", "url", ",", "ResultListener", "<", "Void", ">", "listener", ",", "String", "genagent", ")", "{", "String", "[", "]", "cmd", ";", "if", "(", "RunAnywhere", ".", "isWindows", "(", ")", ")", "{", "// TO...
Opens the user's web browser with the specified URL. @param url the URL to display in an external browser. @param listener a listener to be notified if we failed to launch the browser. <em>Note:</em> it will not be notified of success. @param genagent the path to the browser to execute on non-Windows, non-MacOS.
[ "Opens", "the", "user", "s", "web", "browser", "with", "the", "specified", "URL", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/BrowserUtil.java#L57-L94
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setPosition
public void setPosition (float x, float y, float z) { if (_px != x || _py != y || _pz != z) { AL10.alSource3f(_id, AL10.AL_POSITION, _px = x, _py = y, _pz = z); } }
java
public void setPosition (float x, float y, float z) { if (_px != x || _py != y || _pz != z) { AL10.alSource3f(_id, AL10.AL_POSITION, _px = x, _py = y, _pz = z); } }
[ "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "_px", "!=", "x", "||", "_py", "!=", "y", "||", "_pz", "!=", "z", ")", "{", "AL10", ".", "alSource3f", "(", "_id", ",", "AL10", ".", ...
Sets the position of the source.
[ "Sets", "the", "position", "of", "the", "source", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L59-L64
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setVelocity
public void setVelocity (float x, float y, float z) { if (_vx != x || _vy != y || _vz != z) { AL10.alSource3f(_id, AL10.AL_VELOCITY, _vx = x, _vy = y, _vz = z); } }
java
public void setVelocity (float x, float y, float z) { if (_vx != x || _vy != y || _vz != z) { AL10.alSource3f(_id, AL10.AL_VELOCITY, _vx = x, _vy = y, _vz = z); } }
[ "public", "void", "setVelocity", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "_vx", "!=", "x", "||", "_vy", "!=", "y", "||", "_vz", "!=", "z", ")", "{", "AL10", ".", "alSource3f", "(", "_id", ",", "AL10", ".", ...
Sets the velocity of the source.
[ "Sets", "the", "velocity", "of", "the", "source", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L69-L74
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setGain
public void setGain (float gain) { if (_gain != gain) { AL10.alSourcef(_id, AL10.AL_GAIN, _gain = gain); } }
java
public void setGain (float gain) { if (_gain != gain) { AL10.alSourcef(_id, AL10.AL_GAIN, _gain = gain); } }
[ "public", "void", "setGain", "(", "float", "gain", ")", "{", "if", "(", "_gain", "!=", "gain", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_GAIN", ",", "_gain", "=", "gain", ")", ";", "}", "}" ]
Sets the gain of the source.
[ "Sets", "the", "gain", "of", "the", "source", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L79-L84
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setSourceRelative
public void setSourceRelative (boolean relative) { if (_sourceRelative != relative) { _sourceRelative = relative; AL10.alSourcei(_id, AL10.AL_SOURCE_RELATIVE, relative ? AL10.AL_TRUE : AL10.AL_FALSE); } }
java
public void setSourceRelative (boolean relative) { if (_sourceRelative != relative) { _sourceRelative = relative; AL10.alSourcei(_id, AL10.AL_SOURCE_RELATIVE, relative ? AL10.AL_TRUE : AL10.AL_FALSE); } }
[ "public", "void", "setSourceRelative", "(", "boolean", "relative", ")", "{", "if", "(", "_sourceRelative", "!=", "relative", ")", "{", "_sourceRelative", "=", "relative", ";", "AL10", ".", "alSourcei", "(", "_id", ",", "AL10", ".", "AL_SOURCE_RELATIVE", ",", ...
Sets whether or not the position, velocity, etc., of the source are relative to the listener.
[ "Sets", "whether", "or", "not", "the", "position", "velocity", "etc", ".", "of", "the", "source", "are", "relative", "to", "the", "listener", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L90-L96
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setLooping
public void setLooping (boolean looping) { if (_looping != looping) { _looping = looping; AL10.alSourcei(_id, AL10.AL_LOOPING, looping ? AL10.AL_TRUE : AL10.AL_FALSE); } }
java
public void setLooping (boolean looping) { if (_looping != looping) { _looping = looping; AL10.alSourcei(_id, AL10.AL_LOOPING, looping ? AL10.AL_TRUE : AL10.AL_FALSE); } }
[ "public", "void", "setLooping", "(", "boolean", "looping", ")", "{", "if", "(", "_looping", "!=", "looping", ")", "{", "_looping", "=", "looping", ";", "AL10", ".", "alSourcei", "(", "_id", ",", "AL10", ".", "AL_LOOPING", ",", "looping", "?", "AL10", "...
Sets whether or not the source is looping.
[ "Sets", "whether", "or", "not", "the", "source", "is", "looping", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L101-L107
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setMinGain
public void setMinGain (float gain) { if (_minGain != gain) { AL10.alSourcef(_id, AL10.AL_MIN_GAIN, _minGain = gain); } }
java
public void setMinGain (float gain) { if (_minGain != gain) { AL10.alSourcef(_id, AL10.AL_MIN_GAIN, _minGain = gain); } }
[ "public", "void", "setMinGain", "(", "float", "gain", ")", "{", "if", "(", "_minGain", "!=", "gain", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_MIN_GAIN", ",", "_minGain", "=", "gain", ")", ";", "}", "}" ]
Sets the minimum gain.
[ "Sets", "the", "minimum", "gain", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L112-L117
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setMaxGain
public void setMaxGain (float gain) { if (_maxGain != gain) { AL10.alSourcef(_id, AL10.AL_MAX_GAIN, _maxGain = gain); } }
java
public void setMaxGain (float gain) { if (_maxGain != gain) { AL10.alSourcef(_id, AL10.AL_MAX_GAIN, _maxGain = gain); } }
[ "public", "void", "setMaxGain", "(", "float", "gain", ")", "{", "if", "(", "_maxGain", "!=", "gain", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_MAX_GAIN", ",", "_maxGain", "=", "gain", ")", ";", "}", "}" ]
Sets the maximum gain.
[ "Sets", "the", "maximum", "gain", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L122-L127
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setReferenceDistance
public void setReferenceDistance (float distance) { if (_referenceDistance != distance) { AL10.alSourcef(_id, AL10.AL_REFERENCE_DISTANCE, _referenceDistance = distance); } }
java
public void setReferenceDistance (float distance) { if (_referenceDistance != distance) { AL10.alSourcef(_id, AL10.AL_REFERENCE_DISTANCE, _referenceDistance = distance); } }
[ "public", "void", "setReferenceDistance", "(", "float", "distance", ")", "{", "if", "(", "_referenceDistance", "!=", "distance", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_REFERENCE_DISTANCE", ",", "_referenceDistance", "=", "distance"...
Sets the reference distance for attenuation.
[ "Sets", "the", "reference", "distance", "for", "attenuation", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L132-L137
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setRolloffFactor
public void setRolloffFactor (float rolloff) { if (_rolloffFactor != rolloff) { AL10.alSourcef(_id, AL10.AL_ROLLOFF_FACTOR, _rolloffFactor = rolloff); } }
java
public void setRolloffFactor (float rolloff) { if (_rolloffFactor != rolloff) { AL10.alSourcef(_id, AL10.AL_ROLLOFF_FACTOR, _rolloffFactor = rolloff); } }
[ "public", "void", "setRolloffFactor", "(", "float", "rolloff", ")", "{", "if", "(", "_rolloffFactor", "!=", "rolloff", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_ROLLOFF_FACTOR", ",", "_rolloffFactor", "=", "rolloff", ")", ";", "...
Sets the rolloff factor for attenuation.
[ "Sets", "the", "rolloff", "factor", "for", "attenuation", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L142-L147
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setMaxDistance
public void setMaxDistance (float distance) { if (_maxDistance != distance) { AL10.alSourcef(_id, AL10.AL_MAX_DISTANCE, _maxDistance = distance); } }
java
public void setMaxDistance (float distance) { if (_maxDistance != distance) { AL10.alSourcef(_id, AL10.AL_MAX_DISTANCE, _maxDistance = distance); } }
[ "public", "void", "setMaxDistance", "(", "float", "distance", ")", "{", "if", "(", "_maxDistance", "!=", "distance", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_MAX_DISTANCE", ",", "_maxDistance", "=", "distance", ")", ";", "}", ...
Sets the maximum distance for attenuation.
[ "Sets", "the", "maximum", "distance", "for", "attenuation", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L152-L157
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setPitch
public void setPitch (float pitch) { if (_pitch != pitch) { AL10.alSourcef(_id, AL10.AL_PITCH, _pitch = pitch); } }
java
public void setPitch (float pitch) { if (_pitch != pitch) { AL10.alSourcef(_id, AL10.AL_PITCH, _pitch = pitch); } }
[ "public", "void", "setPitch", "(", "float", "pitch", ")", "{", "if", "(", "_pitch", "!=", "pitch", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_PITCH", ",", "_pitch", "=", "pitch", ")", ";", "}", "}" ]
Sets the pitch multiplier.
[ "Sets", "the", "pitch", "multiplier", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L162-L167
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setDirection
public void setDirection (float x, float y, float z) { if (_dx != x || _dy != y || _dz != z) { AL10.alSource3f(_id, AL10.AL_DIRECTION, _dx = x, _dy = y, _dz = z); } }
java
public void setDirection (float x, float y, float z) { if (_dx != x || _dy != y || _dz != z) { AL10.alSource3f(_id, AL10.AL_DIRECTION, _dx = x, _dy = y, _dz = z); } }
[ "public", "void", "setDirection", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "_dx", "!=", "x", "||", "_dy", "!=", "y", "||", "_dz", "!=", "z", ")", "{", "AL10", ".", "alSource3f", "(", "_id", ",", "AL10", ".",...
Sets the direction of the source.
[ "Sets", "the", "direction", "of", "the", "source", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L172-L177
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setConeInnerAngle
public void setConeInnerAngle (float angle) { if (_coneInnerAngle != angle) { AL10.alSourcef(_id, AL10.AL_CONE_INNER_ANGLE, _coneInnerAngle = angle); } }
java
public void setConeInnerAngle (float angle) { if (_coneInnerAngle != angle) { AL10.alSourcef(_id, AL10.AL_CONE_INNER_ANGLE, _coneInnerAngle = angle); } }
[ "public", "void", "setConeInnerAngle", "(", "float", "angle", ")", "{", "if", "(", "_coneInnerAngle", "!=", "angle", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_CONE_INNER_ANGLE", ",", "_coneInnerAngle", "=", "angle", ")", ";", "}...
Sets the inside angle of the sound cone.
[ "Sets", "the", "inside", "angle", "of", "the", "sound", "cone", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L182-L187
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setConeOuterAngle
public void setConeOuterAngle (float angle) { if (_coneOuterAngle != angle) { AL10.alSourcef(_id, AL10.AL_CONE_OUTER_ANGLE, _coneOuterAngle = angle); } }
java
public void setConeOuterAngle (float angle) { if (_coneOuterAngle != angle) { AL10.alSourcef(_id, AL10.AL_CONE_OUTER_ANGLE, _coneOuterAngle = angle); } }
[ "public", "void", "setConeOuterAngle", "(", "float", "angle", ")", "{", "if", "(", "_coneOuterAngle", "!=", "angle", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_CONE_OUTER_ANGLE", ",", "_coneOuterAngle", "=", "angle", ")", ";", "}...
Sets the outside angle of the sound cone.
[ "Sets", "the", "outside", "angle", "of", "the", "sound", "cone", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L192-L197
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setConeOuterGain
public void setConeOuterGain (float gain) { if (_coneOuterGain != gain) { AL10.alSourcef(_id, AL10.AL_CONE_OUTER_GAIN, _coneOuterGain = gain); } }
java
public void setConeOuterGain (float gain) { if (_coneOuterGain != gain) { AL10.alSourcef(_id, AL10.AL_CONE_OUTER_GAIN, _coneOuterGain = gain); } }
[ "public", "void", "setConeOuterGain", "(", "float", "gain", ")", "{", "if", "(", "_coneOuterGain", "!=", "gain", ")", "{", "AL10", ".", "alSourcef", "(", "_id", ",", "AL10", ".", "AL_CONE_OUTER_GAIN", ",", "_coneOuterGain", "=", "gain", ")", ";", "}", "}...
Sets the gain outside of the sound cone.
[ "Sets", "the", "gain", "outside", "of", "the", "sound", "cone", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L202-L207
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.setBuffer
public void setBuffer (Buffer buffer) { _queue.clear(); if (buffer != null) { _queue.add(buffer); } AL10.alSourcei(_id, AL10.AL_BUFFER, buffer == null ? AL10.AL_NONE : buffer.getId()); }
java
public void setBuffer (Buffer buffer) { _queue.clear(); if (buffer != null) { _queue.add(buffer); } AL10.alSourcei(_id, AL10.AL_BUFFER, buffer == null ? AL10.AL_NONE : buffer.getId()); }
[ "public", "void", "setBuffer", "(", "Buffer", "buffer", ")", "{", "_queue", ".", "clear", "(", ")", ";", "if", "(", "buffer", "!=", "null", ")", "{", "_queue", ".", "add", "(", "buffer", ")", ";", "}", "AL10", ".", "alSourcei", "(", "_id", ",", "...
Sets the source buffer. Equivalent to unqueueing all buffers, then queuing the provided buffer. Cannot be called when the source is playing or paused. @param buffer the buffer to set, or <code>null</code> to clear.
[ "Sets", "the", "source", "buffer", ".", "Equivalent", "to", "unqueueing", "all", "buffers", "then", "queuing", "the", "provided", "buffer", ".", "Cannot", "be", "called", "when", "the", "source", "is", "playing", "or", "paused", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L215-L222
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.queueBuffers
public void queueBuffers (Buffer... buffers) { IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length); for (int ii = 0; ii < buffers.length; ii++) { Buffer buffer = buffers[ii]; _queue.add(buffer); idbuf.put(ii, buffer.getId()); } AL10.alSourceQueueBuffers(_id, idbuf); }
java
public void queueBuffers (Buffer... buffers) { IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length); for (int ii = 0; ii < buffers.length; ii++) { Buffer buffer = buffers[ii]; _queue.add(buffer); idbuf.put(ii, buffer.getId()); } AL10.alSourceQueueBuffers(_id, idbuf); }
[ "public", "void", "queueBuffers", "(", "Buffer", "...", "buffers", ")", "{", "IntBuffer", "idbuf", "=", "BufferUtils", ".", "createIntBuffer", "(", "buffers", ".", "length", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "buffers", ".", "...
Enqueues the specified buffers.
[ "Enqueues", "the", "specified", "buffers", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L227-L236
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.unqueueBuffers
public void unqueueBuffers (Buffer... buffers) { IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length); for (int ii = 0; ii < buffers.length; ii++) { Buffer buffer = buffers[ii]; _queue.remove(buffer); idbuf.put(ii, buffer.getId()); } AL10.alSourceUnqueueBuffers(_id, idbuf); }
java
public void unqueueBuffers (Buffer... buffers) { IntBuffer idbuf = BufferUtils.createIntBuffer(buffers.length); for (int ii = 0; ii < buffers.length; ii++) { Buffer buffer = buffers[ii]; _queue.remove(buffer); idbuf.put(ii, buffer.getId()); } AL10.alSourceUnqueueBuffers(_id, idbuf); }
[ "public", "void", "unqueueBuffers", "(", "Buffer", "...", "buffers", ")", "{", "IntBuffer", "idbuf", "=", "BufferUtils", ".", "createIntBuffer", "(", "buffers", ".", "length", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "buffers", ".", ...
Removes the specified buffers from the queue.
[ "Removes", "the", "specified", "buffers", "from", "the", "queue", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L241-L250
train
threerings/nenya
core/src/main/java/com/threerings/openal/Source.java
Source.delete
public void delete () { IntBuffer idbuf = BufferUtils.createIntBuffer(1); idbuf.put(_id).rewind(); AL10.alDeleteSources(idbuf); _id = 0; _queue.clear(); }
java
public void delete () { IntBuffer idbuf = BufferUtils.createIntBuffer(1); idbuf.put(_id).rewind(); AL10.alDeleteSources(idbuf); _id = 0; _queue.clear(); }
[ "public", "void", "delete", "(", ")", "{", "IntBuffer", "idbuf", "=", "BufferUtils", ".", "createIntBuffer", "(", "1", ")", ";", "idbuf", ".", "put", "(", "_id", ")", ".", "rewind", "(", ")", ";", "AL10", ".", "alDeleteSources", "(", "idbuf", ")", ";...
Deletes this source, rendering it unusable.
[ "Deletes", "this", "source", "rendering", "it", "unusable", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Source.java#L352-L359
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/TileManager.java
TileManager.loadTileSet
public UniformTileSet loadTileSet (String imgPath, int width, int height) { return loadCachedTileSet("", imgPath, width, height); }
java
public UniformTileSet loadTileSet (String imgPath, int width, int height) { return loadCachedTileSet("", imgPath, width, height); }
[ "public", "UniformTileSet", "loadTileSet", "(", "String", "imgPath", ",", "int", "width", ",", "int", "height", ")", "{", "return", "loadCachedTileSet", "(", "\"\"", ",", "imgPath", ",", "width", ",", "height", ")", ";", "}" ]
Loads up a tileset from the specified image with the specified metadata parameters.
[ "Loads", "up", "a", "tileset", "from", "the", "specified", "image", "with", "the", "specified", "metadata", "parameters", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileManager.java#L64-L67
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/TileManager.java
TileManager.getTileSet
public TileSet getTileSet (String name) throws NoSuchTileSetException { // make sure we have a repository configured if (_setrep == null) { throw new NoSuchTileSetException(name); } try { return _setrep.getTileSet(name); } catch (PersistenceException pe) { log.warning("Failure loading tileset", "name", name, "error", pe); throw new NoSuchTileSetException(name); } }
java
public TileSet getTileSet (String name) throws NoSuchTileSetException { // make sure we have a repository configured if (_setrep == null) { throw new NoSuchTileSetException(name); } try { return _setrep.getTileSet(name); } catch (PersistenceException pe) { log.warning("Failure loading tileset", "name", name, "error", pe); throw new NoSuchTileSetException(name); } }
[ "public", "TileSet", "getTileSet", "(", "String", "name", ")", "throws", "NoSuchTileSetException", "{", "// make sure we have a repository configured", "if", "(", "_setrep", "==", "null", ")", "{", "throw", "new", "NoSuchTileSetException", "(", "name", ")", ";", "}"...
Returns the tileset with the specified name. @throws NoSuchTileSetException if no tileset with the specified name is available via our configured tile set repository.
[ "Returns", "the", "tileset", "with", "the", "specified", "name", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileManager.java#L172-L186
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.getProperties
public Map<String, Object> getProperties() { // Shallow copy entries to a newly instantiated HashMap. Map<String, Object> clone = new HashMap<String, Object>(); Set<Entry<String, Object>> set = _properties.entrySet(); for (Entry<String, Object> entry : set) { // There wouldn't be any entry with a null value. clone.put(entry.getKey(), entry.getValue()); } return clone; }
java
public Map<String, Object> getProperties() { // Shallow copy entries to a newly instantiated HashMap. Map<String, Object> clone = new HashMap<String, Object>(); Set<Entry<String, Object>> set = _properties.entrySet(); for (Entry<String, Object> entry : set) { // There wouldn't be any entry with a null value. clone.put(entry.getKey(), entry.getValue()); } return clone; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getProperties", "(", ")", "{", "// Shallow copy entries to a newly instantiated HashMap.", "Map", "<", "String", ",", "Object", ">", "clone", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")...
Returns a clone of the properties HashMap by shallow copying the values. @return HashMap with the name-value pairs
[ "Returns", "a", "clone", "of", "the", "properties", "HashMap", "by", "shallow", "copying", "the", "values", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L267-L278
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setAppId
public void setAppId(String appId) { if (appId == null) { _properties.remove(AMQP_PROP_APP_ID); return; } _properties.put(AMQP_PROP_APP_ID, appId); }
java
public void setAppId(String appId) { if (appId == null) { _properties.remove(AMQP_PROP_APP_ID); return; } _properties.put(AMQP_PROP_APP_ID, appId); }
[ "public", "void", "setAppId", "(", "String", "appId", ")", "{", "if", "(", "appId", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_APP_ID", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_APP_ID", ",", "app...
Sets the value of "appId" property. If a null value is passed in, it indicates that the property is not set. @param appId value of "appId" property
[ "Sets", "the", "value", "of", "appId", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L326-L332
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setContentType
public void setContentType(String contentType) { if (contentType == null) { _properties.remove(AMQP_PROP_CONTENT_TYPE); return; } _properties.put(AMQP_PROP_CONTENT_TYPE, contentType); }
java
public void setContentType(String contentType) { if (contentType == null) { _properties.remove(AMQP_PROP_CONTENT_TYPE); return; } _properties.put(AMQP_PROP_CONTENT_TYPE, contentType); }
[ "public", "void", "setContentType", "(", "String", "contentType", ")", "{", "if", "(", "contentType", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_CONTENT_TYPE", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PRO...
Sets the value of "contentType" property. If a null value is passed in, it indicates that the property is not set. @param contentType value of "contentType" property
[ "Sets", "the", "value", "of", "contentType", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L340-L347
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setContentEncoding
public void setContentEncoding(String encoding) { if (encoding == null) { _properties.remove(AMQP_PROP_CONTENT_ENCODING); return; } _properties.put(AMQP_PROP_CONTENT_ENCODING, encoding); }
java
public void setContentEncoding(String encoding) { if (encoding == null) { _properties.remove(AMQP_PROP_CONTENT_ENCODING); return; } _properties.put(AMQP_PROP_CONTENT_ENCODING, encoding); }
[ "public", "void", "setContentEncoding", "(", "String", "encoding", ")", "{", "if", "(", "encoding", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_CONTENT_ENCODING", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_P...
Sets the value of "contentEncoding" property. If a null value is passed in, it indicates that the property is not set. @param encoding value of "contentEncoding" property
[ "Sets", "the", "value", "of", "contentEncoding", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L355-L362
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setCorrelationId
public void setCorrelationId(String correlationId) { if (correlationId == null) { _properties.remove(AMQP_PROP_CORRELATION_ID); return; } _properties.put(AMQP_PROP_CORRELATION_ID, correlationId); }
java
public void setCorrelationId(String correlationId) { if (correlationId == null) { _properties.remove(AMQP_PROP_CORRELATION_ID); return; } _properties.put(AMQP_PROP_CORRELATION_ID, correlationId); }
[ "public", "void", "setCorrelationId", "(", "String", "correlationId", ")", "{", "if", "(", "correlationId", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_CORRELATION_ID", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "...
Sets the value of "correlationId" property. If a null value is passed in, it indicates that the property is not set. @param correlationId value of "correlationId" property
[ "Sets", "the", "value", "of", "correlationId", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L370-L377
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setDeliveryMode
public void setDeliveryMode(Integer deliveryMode) { if (deliveryMode == null) { _properties.remove(AMQP_PROP_DELIVERY_MODE); return; } // Perhaps, we could do an enum for deliveryMode. But, it will require // some major changes in encoding and decoding and we don't have much // time to do it across all the clients. int value = deliveryMode.intValue(); if ((value != 1) && (value != 2)) { String s = "AMQP 0-9-1 spec mandates 'deliveryMode' value to be " + "either 1(for non-persistent) or 2(for persistent)"; throw new IllegalStateException(s); } _properties.put(AMQP_PROP_DELIVERY_MODE, deliveryMode); }
java
public void setDeliveryMode(Integer deliveryMode) { if (deliveryMode == null) { _properties.remove(AMQP_PROP_DELIVERY_MODE); return; } // Perhaps, we could do an enum for deliveryMode. But, it will require // some major changes in encoding and decoding and we don't have much // time to do it across all the clients. int value = deliveryMode.intValue(); if ((value != 1) && (value != 2)) { String s = "AMQP 0-9-1 spec mandates 'deliveryMode' value to be " + "either 1(for non-persistent) or 2(for persistent)"; throw new IllegalStateException(s); } _properties.put(AMQP_PROP_DELIVERY_MODE, deliveryMode); }
[ "public", "void", "setDeliveryMode", "(", "Integer", "deliveryMode", ")", "{", "if", "(", "deliveryMode", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_DELIVERY_MODE", ")", ";", "return", ";", "}", "// Perhaps, we could do an enum for deliver...
Sets the value of "deliveryMode" property. If a null value is passed in, it indicates that the property is not set. @param deliveryMode value of "deliveryMode" property
[ "Sets", "the", "value", "of", "deliveryMode", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L385-L402
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setExpiration
public void setExpiration(String expiration) { if (expiration == null) { _properties.remove(AMQP_PROP_EXPIRATION); return; } _properties.put(AMQP_PROP_EXPIRATION, expiration); }
java
public void setExpiration(String expiration) { if (expiration == null) { _properties.remove(AMQP_PROP_EXPIRATION); return; } _properties.put(AMQP_PROP_EXPIRATION, expiration); }
[ "public", "void", "setExpiration", "(", "String", "expiration", ")", "{", "if", "(", "expiration", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_EXPIRATION", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_EXP...
Sets the value of "expiration" property. If a null value is passed in, it indicates that the property is not set. @param expiration value of "expiration" property
[ "Sets", "the", "value", "of", "expiration", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L410-L417
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setHeaders
public void setHeaders(AmqpArguments headers) { if (headers == null) { _properties.remove(AMQP_PROP_HEADERS); return; } _properties.put(AMQP_PROP_HEADERS, headers); }
java
public void setHeaders(AmqpArguments headers) { if (headers == null) { _properties.remove(AMQP_PROP_HEADERS); return; } _properties.put(AMQP_PROP_HEADERS, headers); }
[ "public", "void", "setHeaders", "(", "AmqpArguments", "headers", ")", "{", "if", "(", "headers", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_HEADERS", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_HEADERS"...
Sets the value of "headers" property. If a null value is passed in, it indicates that the property is not set. @param headers value of "headers" property
[ "Sets", "the", "value", "of", "headers", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L425-L432
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setMessageId
public void setMessageId(String messageId) { if (messageId == null) { _properties.remove(AMQP_PROP_MESSAGE_ID); return; } _properties.put(AMQP_PROP_MESSAGE_ID, messageId); }
java
public void setMessageId(String messageId) { if (messageId == null) { _properties.remove(AMQP_PROP_MESSAGE_ID); return; } _properties.put(AMQP_PROP_MESSAGE_ID, messageId); }
[ "public", "void", "setMessageId", "(", "String", "messageId", ")", "{", "if", "(", "messageId", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_MESSAGE_ID", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_MESSAG...
Sets the value of "messageId" property. If a null value is passed in, it indicates that the property is not set. @param messageId value of "messageId" property
[ "Sets", "the", "value", "of", "messageId", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L440-L447
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setPriority
public void setPriority(Integer priority) { if (priority == null) { _properties.remove(AMQP_PROP_PRIORITY); return; } int priorityValue = priority.intValue(); if ((priorityValue < 0) || (priorityValue > 9)) { String s = "AMQP 0-9-1 spec mandates 'priority' value to be between 0 and 9"; throw new IllegalStateException(s); } _properties.put(AMQP_PROP_PRIORITY, priority); }
java
public void setPriority(Integer priority) { if (priority == null) { _properties.remove(AMQP_PROP_PRIORITY); return; } int priorityValue = priority.intValue(); if ((priorityValue < 0) || (priorityValue > 9)) { String s = "AMQP 0-9-1 spec mandates 'priority' value to be between 0 and 9"; throw new IllegalStateException(s); } _properties.put(AMQP_PROP_PRIORITY, priority); }
[ "public", "void", "setPriority", "(", "Integer", "priority", ")", "{", "if", "(", "priority", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_PRIORITY", ")", ";", "return", ";", "}", "int", "priorityValue", "=", "priority", ".", "intV...
Sets the value of "priority" property. If a null value is passed in, it indicates that the property is not set. @param priority value of "priority" property
[ "Sets", "the", "value", "of", "priority", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L455-L468
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setReplyTo
public void setReplyTo(String replyTo) { if (replyTo == null) { _properties.remove(AMQP_PROP_REPLY_TO); return; } _properties.put(AMQP_PROP_REPLY_TO, replyTo); }
java
public void setReplyTo(String replyTo) { if (replyTo == null) { _properties.remove(AMQP_PROP_REPLY_TO); return; } _properties.put(AMQP_PROP_REPLY_TO, replyTo); }
[ "public", "void", "setReplyTo", "(", "String", "replyTo", ")", "{", "if", "(", "replyTo", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_REPLY_TO", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_REPLY_TO", "...
Sets the value of "replyTo" property. If a null value is passed in, it indicates that the property is not set. @param replyTo value of "replyTo" property
[ "Sets", "the", "value", "of", "replyTo", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L476-L483
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setTimestamp
public void setTimestamp(Timestamp timestamp) { if (timestamp == null) { _properties.remove(AMQP_PROP_TIMESTAMP); return; } _properties.put(AMQP_PROP_TIMESTAMP, timestamp); }
java
public void setTimestamp(Timestamp timestamp) { if (timestamp == null) { _properties.remove(AMQP_PROP_TIMESTAMP); return; } _properties.put(AMQP_PROP_TIMESTAMP, timestamp); }
[ "public", "void", "setTimestamp", "(", "Timestamp", "timestamp", ")", "{", "if", "(", "timestamp", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_TIMESTAMP", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_TIME...
Sets the value of "timestamp" property. If a null value is passed in, it indicates that the property is not set. @param timestamp value of "timestamp" property
[ "Sets", "the", "value", "of", "timestamp", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L491-L498
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setType
public void setType(String type) { if (type == null) { _properties.remove(AMQP_PROP_TYPE); return; } _properties.put(AMQP_PROP_TYPE, type); }
java
public void setType(String type) { if (type == null) { _properties.remove(AMQP_PROP_TYPE); return; } _properties.put(AMQP_PROP_TYPE, type); }
[ "public", "void", "setType", "(", "String", "type", ")", "{", "if", "(", "type", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_TYPE", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_TYPE", ",", "type", "...
Sets the value of "type" property. If a null value is passed in, it indicates that the property is not set. @param type value of "type" property
[ "Sets", "the", "value", "of", "type", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L506-L513
train
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java
AmqpProperties.setUserId
public void setUserId(String userId) { if (userId == null) { _properties.remove(AMQP_PROP_USER_ID); return; } _properties.put(AMQP_PROP_USER_ID, userId); }
java
public void setUserId(String userId) { if (userId == null) { _properties.remove(AMQP_PROP_USER_ID); return; } _properties.put(AMQP_PROP_USER_ID, userId); }
[ "public", "void", "setUserId", "(", "String", "userId", ")", "{", "if", "(", "userId", "==", "null", ")", "{", "_properties", ".", "remove", "(", "AMQP_PROP_USER_ID", ")", ";", "return", ";", "}", "_properties", ".", "put", "(", "AMQP_PROP_USER_ID", ",", ...
Sets the value of "userId" property. If a null value is passed in, it indicates that the property is not set. @param userId value of "userId" property
[ "Sets", "the", "value", "of", "userId", "property", ".", "If", "a", "null", "value", "is", "passed", "in", "it", "indicates", "that", "the", "property", "is", "not", "set", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpProperties.java#L521-L528
train
threerings/nenya
tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java
TileSetBundler.createBundle
public boolean createBundle ( File target, TileSetBundle bundle, ImageProvider improv, String imageBase, long newestMod) throws IOException { return createBundleJar(target, bundle, improv, imageBase, _keepRawPngs, _uncompressed); }
java
public boolean createBundle ( File target, TileSetBundle bundle, ImageProvider improv, String imageBase, long newestMod) throws IOException { return createBundleJar(target, bundle, improv, imageBase, _keepRawPngs, _uncompressed); }
[ "public", "boolean", "createBundle", "(", "File", "target", ",", "TileSetBundle", "bundle", ",", "ImageProvider", "improv", ",", "String", "imageBase", ",", "long", "newestMod", ")", "throws", "IOException", "{", "return", "createBundleJar", "(", "target", ",", ...
Finish the creation of a tileset bundle jar file. @param target the tileset bundle file that will be created. @param bundle contains the tilesets we'd like to save out to the bundle. @param improv the image provider. @param imageBase the base directory for getting images for non @param newestMod the most recent modification to any part of the bundle. By default we ignore this since we normally duck out if we're up to date. ObjectTileSet tilesets.
[ "Finish", "the", "creation", "of", "a", "tileset", "bundle", "jar", "file", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java#L349-L354
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java
BundledTileSetRepository.initBundles
protected void initBundles (ResourceManager rmgr, String name) { // first we obtain the resource set from which we will load up our // tileset bundles ResourceBundle[] rbundles = rmgr.getResourceSet(name); // sanity check if (rbundles == null) { log.warning("Unable to fetch tileset resource set " + "[name=" + name + "]. Perhaps it's not defined " + "in the resource manager config?"); return; } HashIntMap<TileSet> idmap = new HashIntMap<TileSet>(); HashMap<String, Integer> namemap = Maps.newHashMap(); // iterate over the resource bundles in the set, loading up the // tileset bundles in each resource bundle for (ResourceBundle rbundle : rbundles) { addBundle(idmap, namemap, rbundle); } // fill in our bundles array and wake up any waiters synchronized (this) { _idmap = idmap; _namemap = namemap; notifyAll(); } }
java
protected void initBundles (ResourceManager rmgr, String name) { // first we obtain the resource set from which we will load up our // tileset bundles ResourceBundle[] rbundles = rmgr.getResourceSet(name); // sanity check if (rbundles == null) { log.warning("Unable to fetch tileset resource set " + "[name=" + name + "]. Perhaps it's not defined " + "in the resource manager config?"); return; } HashIntMap<TileSet> idmap = new HashIntMap<TileSet>(); HashMap<String, Integer> namemap = Maps.newHashMap(); // iterate over the resource bundles in the set, loading up the // tileset bundles in each resource bundle for (ResourceBundle rbundle : rbundles) { addBundle(idmap, namemap, rbundle); } // fill in our bundles array and wake up any waiters synchronized (this) { _idmap = idmap; _namemap = namemap; notifyAll(); } }
[ "protected", "void", "initBundles", "(", "ResourceManager", "rmgr", ",", "String", "name", ")", "{", "// first we obtain the resource set from which we will load up our", "// tileset bundles", "ResourceBundle", "[", "]", "rbundles", "=", "rmgr", ".", "getResourceSet", "(", ...
Initializes our bundles,
[ "Initializes", "our", "bundles" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java#L79-L108
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java
BundledTileSetRepository.addBundle
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap, ResourceBundle bundle) { try { TileSetBundle tsb = BundleUtil.extractBundle(bundle); // initialize it and add it to the list tsb.init(bundle); addBundle(idmap, namemap, tsb); } catch (Exception e) { log.warning("Unable to load tileset bundle '" + BundleUtil.METADATA_PATH + "' from resource bundle [rbundle=" + bundle + "].", e); } }
java
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap, ResourceBundle bundle) { try { TileSetBundle tsb = BundleUtil.extractBundle(bundle); // initialize it and add it to the list tsb.init(bundle); addBundle(idmap, namemap, tsb); } catch (Exception e) { log.warning("Unable to load tileset bundle '" + BundleUtil.METADATA_PATH + "' from resource bundle [rbundle=" + bundle + "].", e); } }
[ "protected", "void", "addBundle", "(", "HashIntMap", "<", "TileSet", ">", "idmap", ",", "HashMap", "<", "String", ",", "Integer", ">", "namemap", ",", "ResourceBundle", "bundle", ")", "{", "try", "{", "TileSetBundle", "tsb", "=", "BundleUtil", ".", "extractB...
Extracts the tileset bundle from the supplied resource bundle and registers it.
[ "Extracts", "the", "tileset", "bundle", "from", "the", "supplied", "resource", "bundle", "and", "registers", "it", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java#L123-L136
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java
BundledTileSetRepository.addBundle
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap, TileSetBundle bundle) { IMImageProvider improv = (_imgr == null) ? null : new IMImageProvider(_imgr, bundle); // map all of the tilesets in this bundle for (IntMap.IntEntry<TileSet> entry : bundle.intEntrySet()) { Integer tsid = entry.getKey(); TileSet tset = entry.getValue(); tset.setImageProvider(improv); idmap.put(tsid.intValue(), tset); namemap.put(tset.getName(), tsid); } }
java
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap, TileSetBundle bundle) { IMImageProvider improv = (_imgr == null) ? null : new IMImageProvider(_imgr, bundle); // map all of the tilesets in this bundle for (IntMap.IntEntry<TileSet> entry : bundle.intEntrySet()) { Integer tsid = entry.getKey(); TileSet tset = entry.getValue(); tset.setImageProvider(improv); idmap.put(tsid.intValue(), tset); namemap.put(tset.getName(), tsid); } }
[ "protected", "void", "addBundle", "(", "HashIntMap", "<", "TileSet", ">", "idmap", ",", "HashMap", "<", "String", ",", "Integer", ">", "namemap", ",", "TileSetBundle", "bundle", ")", "{", "IMImageProvider", "improv", "=", "(", "_imgr", "==", "null", ")", "...
Adds the tilesets in the supplied bundle to our tileset mapping tables. Any tilesets with the same name or id will be overwritten.
[ "Adds", "the", "tilesets", "in", "the", "supplied", "bundle", "to", "our", "tileset", "mapping", "tables", ".", "Any", "tilesets", "with", "the", "same", "name", "or", "id", "will", "be", "overwritten", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java#L142-L156
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/ObjectActionHandler.java
ObjectActionHandler.createIndicator
public SceneObjectIndicator createIndicator (MisoScenePanel panel, String text, Icon icon) { return new SceneObjectTip(text, icon); }
java
public SceneObjectIndicator createIndicator (MisoScenePanel panel, String text, Icon icon) { return new SceneObjectTip(text, icon); }
[ "public", "SceneObjectIndicator", "createIndicator", "(", "MisoScenePanel", "panel", ",", "String", "text", ",", "Icon", "icon", ")", "{", "return", "new", "SceneObjectTip", "(", "text", ",", "icon", ")", ";", "}" ]
Creates an indicator for this type of object action.
[ "Creates", "an", "indicator", "for", "this", "type", "of", "object", "action", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/ObjectActionHandler.java#L116-L119
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/ObjectActionHandler.java
ObjectActionHandler.register
public static void register (String prefix, ObjectActionHandler handler) { // make sure we know about potential funny business if (_oahandlers.containsKey(prefix)) { log.warning("Warning! Overwriting previous object action handler registration, all " + "hell could shortly break loose", "prefix", prefix, "handler", handler); } _oahandlers.put(prefix, handler); }
java
public static void register (String prefix, ObjectActionHandler handler) { // make sure we know about potential funny business if (_oahandlers.containsKey(prefix)) { log.warning("Warning! Overwriting previous object action handler registration, all " + "hell could shortly break loose", "prefix", prefix, "handler", handler); } _oahandlers.put(prefix, handler); }
[ "public", "static", "void", "register", "(", "String", "prefix", ",", "ObjectActionHandler", "handler", ")", "{", "// make sure we know about potential funny business", "if", "(", "_oahandlers", ".", "containsKey", "(", "prefix", ")", ")", "{", "log", ".", "warning"...
Registers an object action handler which will be called when a user clicks on an object in a scene that has an associated action.
[ "Registers", "an", "object", "action", "handler", "which", "will", "be", "called", "when", "a", "user", "clicks", "on", "an", "object", "in", "a", "scene", "that", "has", "an", "associated", "action", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/ObjectActionHandler.java#L133-L141
train
threerings/nenya
core/src/main/java/com/threerings/media/util/MathUtil.java
MathUtil.bound
public static int bound (int low, int value, int high) { return Math.min(high, Math.max(low, value)); }
java
public static int bound (int low, int value, int high) { return Math.min(high, Math.max(low, value)); }
[ "public", "static", "int", "bound", "(", "int", "low", ",", "int", "value", ",", "int", "high", ")", "{", "return", "Math", ".", "min", "(", "high", ",", "Math", ".", "max", "(", "low", ",", "value", ")", ")", ";", "}" ]
Bounds the supplied value within the specified range. @return low if {@code value < low}, high if {@code value > high} and value otherwise.
[ "Bounds", "the", "supplied", "value", "within", "the", "specified", "range", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/MathUtil.java#L34-L37
train
threerings/nenya
core/src/main/java/com/threerings/media/util/MathUtil.java
MathUtil.distanceSq
public static int distanceSq (int x0, int y0, int x1, int y1) { return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0)); }
java
public static int distanceSq (int x0, int y0, int x1, int y1) { return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0)); }
[ "public", "static", "int", "distanceSq", "(", "int", "x0", ",", "int", "y0", ",", "int", "x1", ",", "int", "y1", ")", "{", "return", "(", "(", "x1", "-", "x0", ")", "*", "(", "x1", "-", "x0", ")", ")", "+", "(", "(", "y1", "-", "y0", ")", ...
Return the squared distance between the given points.
[ "Return", "the", "squared", "distance", "between", "the", "given", "points", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/MathUtil.java#L42-L45
train
threerings/nenya
core/src/main/java/com/threerings/media/util/MathUtil.java
MathUtil.stddev
public static float[] stddev (int[] values, int start, int length) { // first we need the mean float mean = 0f; for (int ii = start, end = start + length; ii < end; ii++) { mean += values[ii]; } mean /= length; // next we compute the variance float variance = 0f; for (int ii = start, end = start + length; ii < end; ii++) { float value = values[ii] - mean; variance += value * value; } variance /= (length - 1); // the standard deviation is the square root of the variance return new float[] { mean, variance, (float)Math.sqrt(variance) }; }
java
public static float[] stddev (int[] values, int start, int length) { // first we need the mean float mean = 0f; for (int ii = start, end = start + length; ii < end; ii++) { mean += values[ii]; } mean /= length; // next we compute the variance float variance = 0f; for (int ii = start, end = start + length; ii < end; ii++) { float value = values[ii] - mean; variance += value * value; } variance /= (length - 1); // the standard deviation is the square root of the variance return new float[] { mean, variance, (float)Math.sqrt(variance) }; }
[ "public", "static", "float", "[", "]", "stddev", "(", "int", "[", "]", "values", ",", "int", "start", ",", "int", "length", ")", "{", "// first we need the mean", "float", "mean", "=", "0f", ";", "for", "(", "int", "ii", "=", "start", ",", "end", "="...
Computes the standard deviation of the supplied values. @return an array of three values: the mean, variance and standard deviation, in that order.
[ "Computes", "the", "standard", "deviation", "of", "the", "supplied", "values", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/MathUtil.java#L121-L140
train
HotelsDotCom/corc
corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java
OrcFile.validateNamesUnique
private void validateNamesUnique(List<String> names) { List<String> seenNames = new ArrayList<>(names.size()); for (int i = 0; i < names.size(); i++) { String lowerCaseName = names.get(i).toLowerCase(); int index = seenNames.indexOf(lowerCaseName); if (index != -1) { throw new IllegalArgumentException("Duplicate field: " + lowerCaseName + " found at positions " + i + "and" + index + ". Field names are case insensitive and must be unique."); } seenNames.add(lowerCaseName); } }
java
private void validateNamesUnique(List<String> names) { List<String> seenNames = new ArrayList<>(names.size()); for (int i = 0; i < names.size(); i++) { String lowerCaseName = names.get(i).toLowerCase(); int index = seenNames.indexOf(lowerCaseName); if (index != -1) { throw new IllegalArgumentException("Duplicate field: " + lowerCaseName + " found at positions " + i + "and" + index + ". Field names are case insensitive and must be unique."); } seenNames.add(lowerCaseName); } }
[ "private", "void", "validateNamesUnique", "(", "List", "<", "String", ">", "names", ")", "{", "List", "<", "String", ">", "seenNames", "=", "new", "ArrayList", "<>", "(", "names", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", "...
For full ORC compatibility, field names should be unique when lowercased.
[ "For", "full", "ORC", "compatibility", "field", "names", "should", "be", "unique", "when", "lowercased", "." ]
37ecb5966315e4cf630a878ffcbada61c50bdcd3
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java#L128-L139
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/ObjectTile.java
ObjectTile.setSpot
public void setSpot (int x, int y, byte orient) { _spot = new Point(x, y); _sorient = orient; }
java
public void setSpot (int x, int y, byte orient) { _spot = new Point(x, y); _sorient = orient; }
[ "public", "void", "setSpot", "(", "int", "x", ",", "int", "y", ",", "byte", "orient", ")", "{", "_spot", "=", "new", "Point", "(", "x", ",", "y", ")", ";", "_sorient", "=", "orient", ";", "}" ]
Configures the "spot" associated with this object.
[ "Configures", "the", "spot", "associated", "with", "this", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/ObjectTile.java#L122-L126
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/ObjectTile.java
ObjectTile.hasConstraint
public boolean hasConstraint (String constraint) { return (_constraints == null) ? false : ListUtil.contains(_constraints, constraint); }
java
public boolean hasConstraint (String constraint) { return (_constraints == null) ? false : ListUtil.contains(_constraints, constraint); }
[ "public", "boolean", "hasConstraint", "(", "String", "constraint", ")", "{", "return", "(", "_constraints", "==", "null", ")", "?", "false", ":", "ListUtil", ".", "contains", "(", "_constraints", ",", "constraint", ")", ";", "}" ]
Checks whether this object has the given constraint.
[ "Checks", "whether", "this", "object", "has", "the", "given", "constraint", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/ObjectTile.java#L172-L176
train
jdillon/gshell
gshell-util/src/main/java/com/planet57/gshell/util/cli2/OptionDescriptor.java
OptionDescriptor.getSyntax
public String getSyntax() { if (name != null && longName != null) { return String.format("-%s (--%s)", name, longName); } else if (name != null) { return String.format("-%s", name); } else if (longName != null) { return String.format("--%s", longName); } throw new Error(); }
java
public String getSyntax() { if (name != null && longName != null) { return String.format("-%s (--%s)", name, longName); } else if (name != null) { return String.format("-%s", name); } else if (longName != null) { return String.format("--%s", longName); } throw new Error(); }
[ "public", "String", "getSyntax", "(", ")", "{", "if", "(", "name", "!=", "null", "&&", "longName", "!=", "null", ")", "{", "return", "String", ".", "format", "(", "\"-%s (--%s)\"", ",", "name", ",", "longName", ")", ";", "}", "else", "if", "(", "name...
Returns the option syntax, sans optional token if option takes an argument.
[ "Returns", "the", "option", "syntax", "sans", "optional", "token", "if", "option", "takes", "an", "argument", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-util/src/main/java/com/planet57/gshell/util/cli2/OptionDescriptor.java#L109-L120
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.setLocalePrefix
public void setLocalePrefix (final String prefix) { setLocaleHandler( new LocaleHandler() { public String getLocalePath (String path) { return PathUtil.appendPath(prefix, path); } }); }
java
public void setLocalePrefix (final String prefix) { setLocaleHandler( new LocaleHandler() { public String getLocalePath (String path) { return PathUtil.appendPath(prefix, path); } }); }
[ "public", "void", "setLocalePrefix", "(", "final", "String", "prefix", ")", "{", "setLocaleHandler", "(", "new", "LocaleHandler", "(", ")", "{", "public", "String", "getLocalePath", "(", "String", "path", ")", "{", "return", "PathUtil", ".", "appendPath", "(",...
Configure a default LocaleHandler with the specified prefix.
[ "Configure", "a", "default", "LocaleHandler", "with", "the", "specified", "prefix", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L258-L266
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.initBundles
public void initBundles (String resourceDir, String configPath, InitObserver initObs) throws IOException { // reinitialize our resource dir if it was specified if (resourceDir != null) { initResourceDir(resourceDir); } // load up our configuration Properties config = loadConfig(configPath); // resolve the configured resource sets List<ResourceBundle> dlist = Lists.newArrayList(); Enumeration<?> names = config.propertyNames(); while (names.hasMoreElements()) { String key = (String)names.nextElement(); if (!key.startsWith(RESOURCE_SET_PREFIX)) { continue; } String setName = key.substring(RESOURCE_SET_PREFIX.length()); String resourceSetType = config.getProperty(RESOURCE_SET_TYPE_PREFIX + setName, FILE_SET_TYPE); resolveResourceSet(setName, config.getProperty(key), resourceSetType, dlist); } // if an observer was passed in, then we do not need to block the caller final boolean[] shouldWait = new boolean[] { false }; if (initObs == null) { // if there's no observer, we'll need to block the caller shouldWait[0] = true; initObs = new InitObserver() { public void progress (int percent, long remaining) { if (percent >= 100) { synchronized (this) { // turn off shouldWait, in case we reached 100% progress before the // calling thread even gets a chance to get to the blocking code, below shouldWait[0] = false; notify(); } } } public void initializationFailed (Exception e) { synchronized (this) { shouldWait[0] = false; notify(); } } }; } // start a thread to unpack our bundles Unpacker unpack = new Unpacker(dlist, initObs); unpack.start(); if (shouldWait[0]) { synchronized (initObs) { if (shouldWait[0]) { try { initObs.wait(); } catch (InterruptedException ie) { log.warning("Interrupted while waiting for bundles to unpack."); } } } } }
java
public void initBundles (String resourceDir, String configPath, InitObserver initObs) throws IOException { // reinitialize our resource dir if it was specified if (resourceDir != null) { initResourceDir(resourceDir); } // load up our configuration Properties config = loadConfig(configPath); // resolve the configured resource sets List<ResourceBundle> dlist = Lists.newArrayList(); Enumeration<?> names = config.propertyNames(); while (names.hasMoreElements()) { String key = (String)names.nextElement(); if (!key.startsWith(RESOURCE_SET_PREFIX)) { continue; } String setName = key.substring(RESOURCE_SET_PREFIX.length()); String resourceSetType = config.getProperty(RESOURCE_SET_TYPE_PREFIX + setName, FILE_SET_TYPE); resolveResourceSet(setName, config.getProperty(key), resourceSetType, dlist); } // if an observer was passed in, then we do not need to block the caller final boolean[] shouldWait = new boolean[] { false }; if (initObs == null) { // if there's no observer, we'll need to block the caller shouldWait[0] = true; initObs = new InitObserver() { public void progress (int percent, long remaining) { if (percent >= 100) { synchronized (this) { // turn off shouldWait, in case we reached 100% progress before the // calling thread even gets a chance to get to the blocking code, below shouldWait[0] = false; notify(); } } } public void initializationFailed (Exception e) { synchronized (this) { shouldWait[0] = false; notify(); } } }; } // start a thread to unpack our bundles Unpacker unpack = new Unpacker(dlist, initObs); unpack.start(); if (shouldWait[0]) { synchronized (initObs) { if (shouldWait[0]) { try { initObs.wait(); } catch (InterruptedException ie) { log.warning("Interrupted while waiting for bundles to unpack."); } } } } }
[ "public", "void", "initBundles", "(", "String", "resourceDir", ",", "String", "configPath", ",", "InitObserver", "initObs", ")", "throws", "IOException", "{", "// reinitialize our resource dir if it was specified", "if", "(", "resourceDir", "!=", "null", ")", "{", "in...
Initializes the bundle sets to be made available by this resource manager. Applications that wish to make use of resource bundles should call this method after constructing the resource manager. @param resourceDir the base directory to which the paths in the supplied configuration file are relative. If this is null, the system property <code>resource_dir</code> will be used, if available. @param configPath the path (relative to the resource dir) of the resource definition file. @param initObs a bundle initialization observer to notify of unpacking progress and success or failure, or <code>null</code> if the caller doesn't care to be informed; note that in the latter case, the calling thread will block until bundle unpacking is complete. @exception IOException thrown if we are unable to read our resource manager configuration.
[ "Initializes", "the", "bundle", "sets", "to", "be", "made", "available", "by", "this", "resource", "manager", ".", "Applications", "that", "wish", "to", "make", "use", "of", "resource", "bundles", "should", "call", "this", "method", "after", "constructing", "t...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L301-L366
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.checkBundle
public boolean checkBundle (String path) { File bfile = getResourceFile(path); return (bfile == null) ? false : new FileResourceBundle(bfile, true, _unpack).isUnpacked(); }
java
public boolean checkBundle (String path) { File bfile = getResourceFile(path); return (bfile == null) ? false : new FileResourceBundle(bfile, true, _unpack).isUnpacked(); }
[ "public", "boolean", "checkBundle", "(", "String", "path", ")", "{", "File", "bfile", "=", "getResourceFile", "(", "path", ")", ";", "return", "(", "bfile", "==", "null", ")", "?", "false", ":", "new", "FileResourceBundle", "(", "bfile", ",", "true", ","...
Checks to see if the specified bundle exists, is unpacked and is ready to be used.
[ "Checks", "to", "see", "if", "the", "specified", "bundle", "exists", "is", "unpacked", "and", "is", "ready", "to", "be", "used", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L458-L462
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.getResource
public InputStream getResource (String path) throws IOException { String localePath = getLocalePath(path); InputStream in; // first look for this resource in our default resource bundle for (ResourceBundle bundle : _default) { // Try a localized version first. if (localePath != null) { in = bundle.getResource(localePath); if (in != null) { return in; } } // If that didn't work, try generic. in = bundle.getResource(path); if (in != null) { return in; } } // fallback next to an unpacked resource file File file = getResourceFile(path); if (file != null && file.exists()) { return new FileInputStream(file); } // if we still didn't find anything, try the classloader; first try a locale-specific file if (localePath != null) { in = getInputStreamFromClasspath(PathUtil.appendPath(_rootPath, localePath)); if (in != null) { return in; } } // if we didn't find that, try locale-neutral in = getInputStreamFromClasspath(PathUtil.appendPath(_rootPath, path)); if (in != null) { return in; } // if we still haven't found it, we throw an exception throw new FileNotFoundException("Unable to locate resource [path=" + path + "]"); }
java
public InputStream getResource (String path) throws IOException { String localePath = getLocalePath(path); InputStream in; // first look for this resource in our default resource bundle for (ResourceBundle bundle : _default) { // Try a localized version first. if (localePath != null) { in = bundle.getResource(localePath); if (in != null) { return in; } } // If that didn't work, try generic. in = bundle.getResource(path); if (in != null) { return in; } } // fallback next to an unpacked resource file File file = getResourceFile(path); if (file != null && file.exists()) { return new FileInputStream(file); } // if we still didn't find anything, try the classloader; first try a locale-specific file if (localePath != null) { in = getInputStreamFromClasspath(PathUtil.appendPath(_rootPath, localePath)); if (in != null) { return in; } } // if we didn't find that, try locale-neutral in = getInputStreamFromClasspath(PathUtil.appendPath(_rootPath, path)); if (in != null) { return in; } // if we still haven't found it, we throw an exception throw new FileNotFoundException("Unable to locate resource [path=" + path + "]"); }
[ "public", "InputStream", "getResource", "(", "String", "path", ")", "throws", "IOException", "{", "String", "localePath", "=", "getLocalePath", "(", "path", ")", ";", "InputStream", "in", ";", "// first look for this resource in our default resource bundle", "for", "(",...
Fetches a resource from the local repository. @param path the path to the resource (ie. "config/miso.properties"). This should not begin with a slash. @exception IOException thrown if a problem occurs locating or reading the resource.
[ "Fetches", "a", "resource", "from", "the", "local", "repository", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L533-L577
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.addModificationObserver
public void addModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource == null) { File file = getResourceFile(path); if (file == null) { return; // only resource files will ever be modified } _observed.put(path, resource = new ObservedResource(file)); } resource.observers.add(obs); }
java
public void addModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource == null) { File file = getResourceFile(path); if (file == null) { return; // only resource files will ever be modified } _observed.put(path, resource = new ObservedResource(file)); } resource.observers.add(obs); }
[ "public", "void", "addModificationObserver", "(", "String", "path", ",", "ModificationObserver", "obs", ")", "{", "ObservedResource", "resource", "=", "_observed", ".", "get", "(", "path", ")", ";", "if", "(", "resource", "==", "null", ")", "{", "File", "fil...
Adds a modification observer for the specified resource. Note that only a weak reference to the observer will be retained, and thus this will not prevent the observer from being garbage-collected.
[ "Adds", "a", "modification", "observer", "for", "the", "specified", "resource", ".", "Note", "that", "only", "a", "weak", "reference", "to", "the", "observer", "will", "be", "retained", "and", "thus", "this", "will", "not", "prevent", "the", "observer", "fro...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L727-L738
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.removeModificationObserver
public void removeModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource != null) { resource.observers.remove(obs); } }
java
public void removeModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource != null) { resource.observers.remove(obs); } }
[ "public", "void", "removeModificationObserver", "(", "String", "path", ",", "ModificationObserver", "obs", ")", "{", "ObservedResource", "resource", "=", "_observed", ".", "get", "(", "path", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "resource",...
Removes a modification observer from the list maintained for the specified resource.
[ "Removes", "a", "modification", "observer", "from", "the", "list", "maintained", "for", "the", "specified", "resource", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L743-L749
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.loadConfig
protected Properties loadConfig (String configPath) throws IOException { Properties config = new Properties(); try { config.load(new FileInputStream(new File(_rdir, configPath))); } catch (Exception e) { String errmsg = "Unable to load resource manager config [rdir=" + _rdir + ", cpath=" + configPath + "]"; log.warning(errmsg + ".", e); throw new IOException(errmsg); } return config; }
java
protected Properties loadConfig (String configPath) throws IOException { Properties config = new Properties(); try { config.load(new FileInputStream(new File(_rdir, configPath))); } catch (Exception e) { String errmsg = "Unable to load resource manager config [rdir=" + _rdir + ", cpath=" + configPath + "]"; log.warning(errmsg + ".", e); throw new IOException(errmsg); } return config; }
[ "protected", "Properties", "loadConfig", "(", "String", "configPath", ")", "throws", "IOException", "{", "Properties", "config", "=", "new", "Properties", "(", ")", ";", "try", "{", "config", ".", "load", "(", "new", "FileInputStream", "(", "new", "File", "(...
Loads the configuration properties for our resource sets.
[ "Loads", "the", "configuration", "properties", "for", "our", "resource", "sets", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L771-L784
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.resolveResourceSet
protected void resolveResourceSet ( String setName, String definition, String setType, List<ResourceBundle> dlist) { List<ResourceBundle> set = Lists.newArrayList(); StringTokenizer tok = new StringTokenizer(definition, ":"); while (tok.hasMoreTokens()) { set.add(createResourceBundle(setType, tok.nextToken().trim(), dlist)); } // convert our array list into an array and stick it in the table ResourceBundle[] setvec = set.toArray(new ResourceBundle[set.size()]); _sets.put(setName, setvec); // if this is our default resource bundle, keep a reference to it if (DEFAULT_RESOURCE_SET.equals(setName)) { _default = setvec; } }
java
protected void resolveResourceSet ( String setName, String definition, String setType, List<ResourceBundle> dlist) { List<ResourceBundle> set = Lists.newArrayList(); StringTokenizer tok = new StringTokenizer(definition, ":"); while (tok.hasMoreTokens()) { set.add(createResourceBundle(setType, tok.nextToken().trim(), dlist)); } // convert our array list into an array and stick it in the table ResourceBundle[] setvec = set.toArray(new ResourceBundle[set.size()]); _sets.put(setName, setvec); // if this is our default resource bundle, keep a reference to it if (DEFAULT_RESOURCE_SET.equals(setName)) { _default = setvec; } }
[ "protected", "void", "resolveResourceSet", "(", "String", "setName", ",", "String", "definition", ",", "String", "setType", ",", "List", "<", "ResourceBundle", ">", "dlist", ")", "{", "List", "<", "ResourceBundle", ">", "set", "=", "Lists", ".", "newArrayList"...
Loads up a resource set based on the supplied definition information.
[ "Loads", "up", "a", "resource", "set", "based", "on", "the", "supplied", "definition", "information", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L799-L816
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.createResourceBundle
protected ResourceBundle createResourceBundle (String setType, String path, List<ResourceBundle> dlist) { if (setType.equals(FILE_SET_TYPE)) { FileResourceBundle bundle = createFileResourceBundle(getResourceFile(path), true, _unpack); if (!bundle.isUnpacked() || !bundle.sourceIsReady()) { dlist.add(bundle); } return bundle; } else if (setType.equals(NETWORK_SET_TYPE)) { return createNetworkResourceBundle(_networkRootPath, path, getResourceList()); } else { throw new IllegalArgumentException("Unknown set type: " + setType); } }
java
protected ResourceBundle createResourceBundle (String setType, String path, List<ResourceBundle> dlist) { if (setType.equals(FILE_SET_TYPE)) { FileResourceBundle bundle = createFileResourceBundle(getResourceFile(path), true, _unpack); if (!bundle.isUnpacked() || !bundle.sourceIsReady()) { dlist.add(bundle); } return bundle; } else if (setType.equals(NETWORK_SET_TYPE)) { return createNetworkResourceBundle(_networkRootPath, path, getResourceList()); } else { throw new IllegalArgumentException("Unknown set type: " + setType); } }
[ "protected", "ResourceBundle", "createResourceBundle", "(", "String", "setType", ",", "String", "path", ",", "List", "<", "ResourceBundle", ">", "dlist", ")", "{", "if", "(", "setType", ".", "equals", "(", "FILE_SET_TYPE", ")", ")", "{", "FileResourceBundle", ...
Creates a ResourceBundle based on the supplied definition information.
[ "Creates", "a", "ResourceBundle", "based", "on", "the", "supplied", "definition", "information", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L821-L836
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.createFileResourceBundle
protected FileResourceBundle createFileResourceBundle ( File source, boolean delay, boolean unpack) { return new FileResourceBundle(source, delay, unpack); }
java
protected FileResourceBundle createFileResourceBundle ( File source, boolean delay, boolean unpack) { return new FileResourceBundle(source, delay, unpack); }
[ "protected", "FileResourceBundle", "createFileResourceBundle", "(", "File", "source", ",", "boolean", "delay", ",", "boolean", "unpack", ")", "{", "return", "new", "FileResourceBundle", "(", "source", ",", "delay", ",", "unpack", ")", ";", "}" ]
Creates an appropriate bundle for fetching resources from files.
[ "Creates", "an", "appropriate", "bundle", "for", "fetching", "resources", "from", "files", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L841-L845
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.createNetworkResourceBundle
protected ResourceBundle createNetworkResourceBundle ( String root, String path, Set<String> rsrcList) { return new NetworkResourceBundle(root, path, rsrcList); }
java
protected ResourceBundle createNetworkResourceBundle ( String root, String path, Set<String> rsrcList) { return new NetworkResourceBundle(root, path, rsrcList); }
[ "protected", "ResourceBundle", "createNetworkResourceBundle", "(", "String", "root", ",", "String", "path", ",", "Set", "<", "String", ">", "rsrcList", ")", "{", "return", "new", "NetworkResourceBundle", "(", "root", ",", "path", ",", "rsrcList", ")", ";", "}"...
Creates an appropriate bundle for fetching resources from the network.
[ "Creates", "an", "appropriate", "bundle", "for", "fetching", "resources", "from", "the", "network", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L850-L854
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.getInputStreamFromClasspath
protected InputStream getInputStreamFromClasspath (final String fullyQualifiedPath) { return AccessController.doPrivileged(new PrivilegedAction<InputStream>() { public InputStream run () { return _loader.getResourceAsStream(fullyQualifiedPath); } }); }
java
protected InputStream getInputStreamFromClasspath (final String fullyQualifiedPath) { return AccessController.doPrivileged(new PrivilegedAction<InputStream>() { public InputStream run () { return _loader.getResourceAsStream(fullyQualifiedPath); } }); }
[ "protected", "InputStream", "getInputStreamFromClasspath", "(", "final", "String", "fullyQualifiedPath", ")", "{", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "InputStream", ">", "(", ")", "{", "public", "InputStream", "run"...
Returns an InputStream from this manager's classloader for the given path.
[ "Returns", "an", "InputStream", "from", "this", "manager", "s", "classloader", "for", "the", "given", "path", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L859-L866
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.getLocalePath
protected String getLocalePath (String path) { return (_localeHandler == null) ? null : _localeHandler.getLocalePath(path); }
java
protected String getLocalePath (String path) { return (_localeHandler == null) ? null : _localeHandler.getLocalePath(path); }
[ "protected", "String", "getLocalePath", "(", "String", "path", ")", "{", "return", "(", "_localeHandler", "==", "null", ")", "?", "null", ":", "_localeHandler", ".", "getLocalePath", "(", "path", ")", ";", "}" ]
Transform the path into a locale-specific one, or return null.
[ "Transform", "the", "path", "into", "a", "locale", "-", "specific", "one", "or", "return", "null", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L871-L874
train
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.getNumericJavaVersion
protected static int getNumericJavaVersion (String verstr) { Matcher m = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?.*").matcher(verstr); if (!m.matches()) { // if we can't parse the java version we're in weird land and should probably just try // our luck with what we've got rather than try to download a new jvm log.warning("Unable to parse VM version, hoping for the best [version=" + verstr + "]"); return 0; } int one = Integer.parseInt(m.group(1)); // will there ever be a two? int major = Integer.parseInt(m.group(2)); int minor = Integer.parseInt(m.group(3)); int patch = m.group(4) == null ? 0 : Integer.parseInt(m.group(4).substring(1)); return patch + 100 * (minor + 100 * (major + 100 * one)); }
java
protected static int getNumericJavaVersion (String verstr) { Matcher m = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?.*").matcher(verstr); if (!m.matches()) { // if we can't parse the java version we're in weird land and should probably just try // our luck with what we've got rather than try to download a new jvm log.warning("Unable to parse VM version, hoping for the best [version=" + verstr + "]"); return 0; } int one = Integer.parseInt(m.group(1)); // will there ever be a two? int major = Integer.parseInt(m.group(2)); int minor = Integer.parseInt(m.group(3)); int patch = m.group(4) == null ? 0 : Integer.parseInt(m.group(4).substring(1)); return patch + 100 * (minor + 100 * (major + 100 * one)); }
[ "protected", "static", "int", "getNumericJavaVersion", "(", "String", "verstr", ")", "{", "Matcher", "m", "=", "Pattern", ".", "compile", "(", "\"(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)(_\\\\d+)?.*\"", ")", ".", "matcher", "(", "verstr", ")", ";", "if", "(", "!", "m"...
Converts the java version string to a more comparable numeric version number.
[ "Converts", "the", "java", "version", "string", "to", "a", "more", "comparable", "numeric", "version", "number", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L946-L961
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/bundle/TileSetBundle.java
TileSetBundle.writeObject
private void writeObject (ObjectOutputStream out) throws IOException { out.writeInt(size()); for (IntEntry<TileSet> entry : intEntrySet()) { out.writeInt(entry.getIntKey()); out.writeObject(entry.getValue()); } }
java
private void writeObject (ObjectOutputStream out) throws IOException { out.writeInt(size()); for (IntEntry<TileSet> entry : intEntrySet()) { out.writeInt(entry.getIntKey()); out.writeObject(entry.getValue()); } }
[ "private", "void", "writeObject", "(", "ObjectOutputStream", "out", ")", "throws", "IOException", "{", "out", ".", "writeInt", "(", "size", "(", ")", ")", ";", "for", "(", "IntEntry", "<", "TileSet", ">", "entry", ":", "intEntrySet", "(", ")", ")", "{", ...
custom serialization process
[ "custom", "serialization", "process" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/TileSetBundle.java#L99-L108
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/bundle/TileSetBundle.java
TileSetBundle.readObject
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException { int count = in.readInt(); for (int ii = 0; ii < count; ii++) { int tileSetId = in.readInt(); TileSet set = (TileSet)in.readObject(); put(tileSetId, set); } }
java
private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException { int count = in.readInt(); for (int ii = 0; ii < count; ii++) { int tileSetId = in.readInt(); TileSet set = (TileSet)in.readObject(); put(tileSetId, set); } }
[ "private", "void", "readObject", "(", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "int", "count", "=", "in", ".", "readInt", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "count", ";", ...
custom unserialization process
[ "custom", "unserialization", "process" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/TileSetBundle.java#L111-L121
train
groupon/monsoon
verify/src/main/java/com/groupon/lex/metrics/Verify.java
Verify.run
public void run() { boolean validation_fail = false; boolean arg_seen = true; for (String file : files) { final Report v = new Report(new File(file).getAbsoluteFile(), recursive); if (v.hasErrors()) validation_fail = true; if (arg_seen) { arg_seen = false; } else { System.out.println(Stream.generate(() -> "-").limit(72).collect(Collectors.joining())); } System.out.print(v.configString() .filter((x) -> print) .orElseGet(() -> v.toString())); } if (validation_fail) System.exit(EX_TEMPFAIL); }
java
public void run() { boolean validation_fail = false; boolean arg_seen = true; for (String file : files) { final Report v = new Report(new File(file).getAbsoluteFile(), recursive); if (v.hasErrors()) validation_fail = true; if (arg_seen) { arg_seen = false; } else { System.out.println(Stream.generate(() -> "-").limit(72).collect(Collectors.joining())); } System.out.print(v.configString() .filter((x) -> print) .orElseGet(() -> v.toString())); } if (validation_fail) System.exit(EX_TEMPFAIL); }
[ "public", "void", "run", "(", ")", "{", "boolean", "validation_fail", "=", "false", ";", "boolean", "arg_seen", "=", "true", ";", "for", "(", "String", "file", ":", "files", ")", "{", "final", "Report", "v", "=", "new", "Report", "(", "new", "File", ...
Perform validation. Prints to stdout.
[ "Perform", "validation", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/verify/src/main/java/com/groupon/lex/metrics/Verify.java#L100-L117
train
groupon/monsoon
collectors/jmx/src/main/java/com/groupon/lex/metrics/jmx/MetricListener.java
MetricListener.onNewMbean
private synchronized void onNewMbean(ObjectName obj) { if (detected_groups_.keySet().contains(obj)) { LOG.log(Level.WARNING, "skipping registration of {0}: already present", obj); return; } MBeanGroup instance = new MBeanGroup(obj, resolvedMap); detected_groups_.put(obj, instance); LOG.log(Level.FINE, "registered metrics for {0}: {1}", new Object[]{obj, instance}); }
java
private synchronized void onNewMbean(ObjectName obj) { if (detected_groups_.keySet().contains(obj)) { LOG.log(Level.WARNING, "skipping registration of {0}: already present", obj); return; } MBeanGroup instance = new MBeanGroup(obj, resolvedMap); detected_groups_.put(obj, instance); LOG.log(Level.FINE, "registered metrics for {0}: {1}", new Object[]{obj, instance}); }
[ "private", "synchronized", "void", "onNewMbean", "(", "ObjectName", "obj", ")", "{", "if", "(", "detected_groups_", ".", "keySet", "(", ")", ".", "contains", "(", "obj", ")", ")", "{", "LOG", ".", "log", "(", "Level", ".", "WARNING", ",", "\"skipping reg...
Respond to MBeans being added. @param obj The name of the MBean being added.
[ "Respond", "to", "MBeans", "being", "added", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/collectors/jmx/src/main/java/com/groupon/lex/metrics/jmx/MetricListener.java#L141-L150
train
groupon/monsoon
collectors/jmx/src/main/java/com/groupon/lex/metrics/jmx/MetricListener.java
MetricListener.onRemovedMbean
private synchronized void onRemovedMbean(ObjectName obj) { if (!detected_groups_.keySet().contains(obj)) { LOG.log(Level.WARNING, "skipping de-registration of {0}: not present", obj); return; } MBeanGroup instance = detected_groups_.get(obj); detected_groups_.remove(obj); LOG.log(Level.FINE, "de-registered metrics for {0}: {1}", new Object[]{obj, instance}); }
java
private synchronized void onRemovedMbean(ObjectName obj) { if (!detected_groups_.keySet().contains(obj)) { LOG.log(Level.WARNING, "skipping de-registration of {0}: not present", obj); return; } MBeanGroup instance = detected_groups_.get(obj); detected_groups_.remove(obj); LOG.log(Level.FINE, "de-registered metrics for {0}: {1}", new Object[]{obj, instance}); }
[ "private", "synchronized", "void", "onRemovedMbean", "(", "ObjectName", "obj", ")", "{", "if", "(", "!", "detected_groups_", ".", "keySet", "(", ")", ".", "contains", "(", "obj", ")", ")", "{", "LOG", ".", "log", "(", "Level", ".", "WARNING", ",", "\"s...
Respond to MBeans being removed. @param obj The name of the MBean being removed.
[ "Respond", "to", "MBeans", "being", "removed", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/collectors/jmx/src/main/java/com/groupon/lex/metrics/jmx/MetricListener.java#L157-L166
train
jdillon/gshell
gshell-api/src/main/java/com/planet57/gshell/help/HelpPageUtil.java
HelpPageUtil.renderIndex
public static void renderIndex(final PrintWriter out, final Collection<? extends HelpPage> pages) { checkNotNull(out); checkNotNull(pages); checkArgument(!pages.isEmpty(), "No help pages to render index"); // construct a printf format with sizing for showing columns int max = pages.stream().mapToInt(page -> page.getName().length()).max().orElse(0); String nameFormat = "%-" + max + 's'; for (HelpPage page : pages) { String formattedName = String.format(nameFormat, page.getName()); out.format(" @{bold %s}", formattedName); String description = page.getDescription(); if (description != null) { out.printf(" %s%n", description); } else { out.println(); } } }
java
public static void renderIndex(final PrintWriter out, final Collection<? extends HelpPage> pages) { checkNotNull(out); checkNotNull(pages); checkArgument(!pages.isEmpty(), "No help pages to render index"); // construct a printf format with sizing for showing columns int max = pages.stream().mapToInt(page -> page.getName().length()).max().orElse(0); String nameFormat = "%-" + max + 's'; for (HelpPage page : pages) { String formattedName = String.format(nameFormat, page.getName()); out.format(" @{bold %s}", formattedName); String description = page.getDescription(); if (description != null) { out.printf(" %s%n", description); } else { out.println(); } } }
[ "public", "static", "void", "renderIndex", "(", "final", "PrintWriter", "out", ",", "final", "Collection", "<", "?", "extends", "HelpPage", ">", "pages", ")", "{", "checkNotNull", "(", "out", ")", ";", "checkNotNull", "(", "pages", ")", ";", "checkArgument",...
Render a column-formatted index of help pages.
[ "Render", "a", "column", "-", "formatted", "index", "of", "help", "pages", "." ]
b587c1a4672d2e4905871462fa3b38a1f7b94e90
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-api/src/main/java/com/planet57/gshell/help/HelpPageUtil.java#L41-L63
train
threerings/nenya
core/src/main/java/com/threerings/media/MediaOverlay.java
MediaOverlay.addDirtyRegion
public void addDirtyRegion (Rectangle rect) { // Only add dirty regions where rect intersects our actual media as the set region will // propagate out to the repaint manager. for (AbstractMedia media : _metamgr) { Rectangle intersection = media.getBounds().intersection(rect); if (!intersection.isEmpty()) { _metamgr.getRegionManager().addDirtyRegion(intersection); } } }
java
public void addDirtyRegion (Rectangle rect) { // Only add dirty regions where rect intersects our actual media as the set region will // propagate out to the repaint manager. for (AbstractMedia media : _metamgr) { Rectangle intersection = media.getBounds().intersection(rect); if (!intersection.isEmpty()) { _metamgr.getRegionManager().addDirtyRegion(intersection); } } }
[ "public", "void", "addDirtyRegion", "(", "Rectangle", "rect", ")", "{", "// Only add dirty regions where rect intersects our actual media as the set region will", "// propagate out to the repaint manager.", "for", "(", "AbstractMedia", "media", ":", "_metamgr", ")", "{", "Rectang...
Adds a dirty region to this overlay.
[ "Adds", "a", "dirty", "region", "to", "this", "overlay", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MediaOverlay.java#L127-L137
train
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/comm/BaseCommunicator.java
BaseCommunicator.runEvictor
private void runEvictor(ConnectionEvictor evictor2) { final Thread evictorThread = new Thread(evictor2); evictorThread.setDaemon(true); evictorThread .setName("Redmine communicator connection eviction thread"); evictorThread.start(); }
java
private void runEvictor(ConnectionEvictor evictor2) { final Thread evictorThread = new Thread(evictor2); evictorThread.setDaemon(true); evictorThread .setName("Redmine communicator connection eviction thread"); evictorThread.start(); }
[ "private", "void", "runEvictor", "(", "ConnectionEvictor", "evictor2", ")", "{", "final", "Thread", "evictorThread", "=", "new", "Thread", "(", "evictor2", ")", ";", "evictorThread", ".", "setDaemon", "(", "true", ")", ";", "evictorThread", ".", "setName", "("...
Runs an evictor thread.
[ "Runs", "an", "evictor", "thread", "." ]
7e5270c84aba32d74a506260ec47ff86ab6c9d84
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/comm/BaseCommunicator.java#L56-L62
train
groupon/monsoon
remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java
Client.addAll
@Override public boolean addAll(Collection<? extends TimeSeriesCollection> c) { try { final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_TCP); try { final list_of_timeseries_collection enc_c = encodeTSCCollection(c); return BlockingWrapper.execute(() -> client.addTSData_1(enc_c)); } finally { client.close(); } } catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) { LOG.log(Level.SEVERE, "addAll RPC call failed", ex); throw new RuntimeException("RPC call failed", ex); } }
java
@Override public boolean addAll(Collection<? extends TimeSeriesCollection> c) { try { final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_TCP); try { final list_of_timeseries_collection enc_c = encodeTSCCollection(c); return BlockingWrapper.execute(() -> client.addTSData_1(enc_c)); } finally { client.close(); } } catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) { LOG.log(Level.SEVERE, "addAll RPC call failed", ex); throw new RuntimeException("RPC call failed", ex); } }
[ "@", "Override", "public", "boolean", "addAll", "(", "Collection", "<", "?", "extends", "TimeSeriesCollection", ">", "c", ")", "{", "try", "{", "final", "rh_protoClient", "client", "=", "getRpcClient", "(", "OncRpcProtocols", ".", "ONCRPC_TCP", ")", ";", "try"...
Add multiple TimeSeriesCollections to the history.
[ "Add", "multiple", "TimeSeriesCollections", "to", "the", "history", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java#L131-L145
train
groupon/monsoon
remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java
Client.getEnd
@Override public DateTime getEnd() { try { final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP); try { return decodeTimestamp(BlockingWrapper.execute(() -> client.getEnd_1())); } finally { client.close(); } } catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) { LOG.log(Level.SEVERE, "getEnd RPC call failed", ex); throw new RuntimeException("RPC call failed", ex); } }
java
@Override public DateTime getEnd() { try { final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP); try { return decodeTimestamp(BlockingWrapper.execute(() -> client.getEnd_1())); } finally { client.close(); } } catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) { LOG.log(Level.SEVERE, "getEnd RPC call failed", ex); throw new RuntimeException("RPC call failed", ex); } }
[ "@", "Override", "public", "DateTime", "getEnd", "(", ")", "{", "try", "{", "final", "rh_protoClient", "client", "=", "getRpcClient", "(", "OncRpcProtocols", ".", "ONCRPC_UDP", ")", ";", "try", "{", "return", "decodeTimestamp", "(", "BlockingWrapper", ".", "ex...
Return the highest timestamp in the stored metrics. @return The highest timestamp in the stored metrics.
[ "Return", "the", "highest", "timestamp", "in", "the", "stored", "metrics", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java#L172-L185
train
groupon/monsoon
history/src/main/java/com/groupon/lex/metrics/history/v2/tables/RTFMetricTable.java
RTFMetricTable.getAll
public MetricValue[] getAll(int startInclusive, int endExclusive) { return IntStream.range(startInclusive, endExclusive) .mapToObj(this::getOrNull) .toArray(MetricValue[]::new); }
java
public MetricValue[] getAll(int startInclusive, int endExclusive) { return IntStream.range(startInclusive, endExclusive) .mapToObj(this::getOrNull) .toArray(MetricValue[]::new); }
[ "public", "MetricValue", "[", "]", "getAll", "(", "int", "startInclusive", ",", "int", "endExclusive", ")", "{", "return", "IntStream", ".", "range", "(", "startInclusive", ",", "endExclusive", ")", ".", "mapToObj", "(", "this", "::", "getOrNull", ")", ".", ...
Returns metric values at the given range. Absence of a value is represented by a null value in the array. @param startInclusive The first index of the range. @param endExclusive The past-the-end index of the range. @return An array of metric values, with null values representing absence of the metric.
[ "Returns", "metric", "values", "at", "the", "given", "range", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/v2/tables/RTFMetricTable.java#L137-L141
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/net/impl/auth/DefaultDispatchChallengeHandler.java
DefaultDispatchChallengeHandler.lookup
public List<ChallengeHandler> lookup(String location) { List<ChallengeHandler> result = Collections.emptyList(); if (location != null) { Node<ChallengeHandler, UriElement> resultNode = findBestMatchingNode(location); if (resultNode != null) { return resultNode.getValues(); } } return result; }
java
public List<ChallengeHandler> lookup(String location) { List<ChallengeHandler> result = Collections.emptyList(); if (location != null) { Node<ChallengeHandler, UriElement> resultNode = findBestMatchingNode(location); if (resultNode != null) { return resultNode.getValues(); } } return result; }
[ "public", "List", "<", "ChallengeHandler", ">", "lookup", "(", "String", "location", ")", "{", "List", "<", "ChallengeHandler", ">", "result", "=", "Collections", ".", "emptyList", "(", ")", ";", "if", "(", "location", "!=", "null", ")", "{", "Node", "<"...
Locate all challenge handlers to serve the given location. @param location a location @return a collection of {@link ChallengeHandler}s if found registered at a matching location or an empty list if none are found.
[ "Locate", "all", "challenge", "handlers", "to", "serve", "the", "given", "location", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/net/impl/auth/DefaultDispatchChallengeHandler.java#L145-L154
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/net/impl/auth/DefaultDispatchChallengeHandler.java
DefaultDispatchChallengeHandler.lookup
ChallengeHandler lookup(ChallengeRequest challengeRequest) { ChallengeHandler result = null; String location = challengeRequest.getLocation(); if (location != null) { Node<ChallengeHandler,UriElement> resultNode = findBestMatchingNode(location); // // If we found an exact or wildcard match, try to find a handler // for the requested challenge. // if (resultNode != null) { List<ChallengeHandler> handlers = resultNode.getValues(); if (handlers != null) { for (ChallengeHandler challengeHandler : handlers) { if (challengeHandler.canHandle(challengeRequest)) { result = challengeHandler; break; } } } } } return result; }
java
ChallengeHandler lookup(ChallengeRequest challengeRequest) { ChallengeHandler result = null; String location = challengeRequest.getLocation(); if (location != null) { Node<ChallengeHandler,UriElement> resultNode = findBestMatchingNode(location); // // If we found an exact or wildcard match, try to find a handler // for the requested challenge. // if (resultNode != null) { List<ChallengeHandler> handlers = resultNode.getValues(); if (handlers != null) { for (ChallengeHandler challengeHandler : handlers) { if (challengeHandler.canHandle(challengeRequest)) { result = challengeHandler; break; } } } } } return result; }
[ "ChallengeHandler", "lookup", "(", "ChallengeRequest", "challengeRequest", ")", "{", "ChallengeHandler", "result", "=", "null", ";", "String", "location", "=", "challengeRequest", ".", "getLocation", "(", ")", ";", "if", "(", "location", "!=", "null", ")", "{", ...
Locate a challenge handler factory to serve the given location and challenge type. @param challengeRequest A challenge string from the server. @return a challenge handler registered to handle the challenge at the location, or <code>null</code> if none could be found.
[ "Locate", "a", "challenge", "handler", "factory", "to", "serve", "the", "given", "location", "and", "challenge", "type", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/net/impl/auth/DefaultDispatchChallengeHandler.java#L164-L187
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java
CachingResolver.refresh
private void refresh() { try { // Invoke underlying getTuples unsynchronized. // This way it won't block tuple access, in case it is a long // running or expensive function. final CompletableFuture<? extends Collection<ResolverTuple>> fut = underlying.getTuples(); // Publish future, needs synchronization, so close() method can cancel properly. synchronized(this) { // We create the whenCompleteAsync continuation with synchronization locked, // because the update code will want to clear the currentFut member-variable. // We must ensure it is set before. currentFut = fut.whenCompleteAsync(this::update, SCHEDULER); if (closed) // Close may have set close bit while we were creating future. fut.cancel(false); } } catch (Exception ex) { synchronized(this) { exception = ex; } reschedule(FAILURE_RESCHEDULE_DELAY); } }
java
private void refresh() { try { // Invoke underlying getTuples unsynchronized. // This way it won't block tuple access, in case it is a long // running or expensive function. final CompletableFuture<? extends Collection<ResolverTuple>> fut = underlying.getTuples(); // Publish future, needs synchronization, so close() method can cancel properly. synchronized(this) { // We create the whenCompleteAsync continuation with synchronization locked, // because the update code will want to clear the currentFut member-variable. // We must ensure it is set before. currentFut = fut.whenCompleteAsync(this::update, SCHEDULER); if (closed) // Close may have set close bit while we were creating future. fut.cancel(false); } } catch (Exception ex) { synchronized(this) { exception = ex; } reschedule(FAILURE_RESCHEDULE_DELAY); } }
[ "private", "void", "refresh", "(", ")", "{", "try", "{", "// Invoke underlying getTuples unsynchronized.", "// This way it won't block tuple access, in case it is a long", "// running or expensive function.", "final", "CompletableFuture", "<", "?", "extends", "Collection", "<", "...
Attempt to refresh the resolver result. @return a boolean, with true indicating success and false indicating failure.
[ "Attempt", "to", "refresh", "the", "resolver", "result", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java#L161-L184
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java
CachingResolver.update
private void update(Collection<ResolverTuple> underlyingTuples, Throwable t) { if (t != null) applyException(t); else if (underlyingTuples != null) applyUpdate(underlyingTuples); else applyException(null); }
java
private void update(Collection<ResolverTuple> underlyingTuples, Throwable t) { if (t != null) applyException(t); else if (underlyingTuples != null) applyUpdate(underlyingTuples); else applyException(null); }
[ "private", "void", "update", "(", "Collection", "<", "ResolverTuple", ">", "underlyingTuples", ",", "Throwable", "t", ")", "{", "if", "(", "t", "!=", "null", ")", "applyException", "(", "t", ")", ";", "else", "if", "(", "underlyingTuples", "!=", "null", ...
Update callback, called when the completable future completes.
[ "Update", "callback", "called", "when", "the", "completable", "future", "completes", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java#L187-L194
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java
CachingResolver.applyUpdate
private synchronized void applyUpdate(Collection<ResolverTuple> underlyingTuples) { lastRefresh = DateTime.now(); tuples = underlyingTuples; exception = null; reschedule(minAge.getMillis()); }
java
private synchronized void applyUpdate(Collection<ResolverTuple> underlyingTuples) { lastRefresh = DateTime.now(); tuples = underlyingTuples; exception = null; reschedule(minAge.getMillis()); }
[ "private", "synchronized", "void", "applyUpdate", "(", "Collection", "<", "ResolverTuple", ">", "underlyingTuples", ")", "{", "lastRefresh", "=", "DateTime", ".", "now", "(", ")", ";", "tuples", "=", "underlyingTuples", ";", "exception", "=", "null", ";", "res...
Apply updated tuple collection.
[ "Apply", "updated", "tuple", "collection", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java#L197-L202
train
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java
CachingResolver.reschedule
private synchronized void reschedule(long millis) { currentFut = null; // Remove current future. if (!closed) { SCHEDULER.schedule(this::refresh, millis, TimeUnit.MILLISECONDS); } else { try { underlying.close(); } catch (Exception ex) { LOG.log(Level.WARNING, "failed to close resolver " + underlying.configString(), ex); } } }
java
private synchronized void reschedule(long millis) { currentFut = null; // Remove current future. if (!closed) { SCHEDULER.schedule(this::refresh, millis, TimeUnit.MILLISECONDS); } else { try { underlying.close(); } catch (Exception ex) { LOG.log(Level.WARNING, "failed to close resolver " + underlying.configString(), ex); } } }
[ "private", "synchronized", "void", "reschedule", "(", "long", "millis", ")", "{", "currentFut", "=", "null", ";", "// Remove current future.", "if", "(", "!", "closed", ")", "{", "SCHEDULER", ".", "schedule", "(", "this", "::", "refresh", ",", "millis", ",",...
Schedule next invocation of the update task.
[ "Schedule", "next", "invocation", "of", "the", "update", "task", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/resolver/CachingResolver.java#L214-L226
train
threerings/nenya
tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundlerUtil.java
ComponentBundlerUtil.parseActionTileSets
public static Map<String, TileSet> parseActionTileSets (File file) throws IOException, SAXException { return parseActionTileSets(new BufferedInputStream(new FileInputStream(file))); }
java
public static Map<String, TileSet> parseActionTileSets (File file) throws IOException, SAXException { return parseActionTileSets(new BufferedInputStream(new FileInputStream(file))); }
[ "public", "static", "Map", "<", "String", ",", "TileSet", ">", "parseActionTileSets", "(", "File", "file", ")", "throws", "IOException", ",", "SAXException", "{", "return", "parseActionTileSets", "(", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(...
Parses the action tileset definitions in the supplied file and puts them into a hash map, keyed on action name.
[ "Parses", "the", "action", "tileset", "definitions", "in", "the", "supplied", "file", "and", "puts", "them", "into", "a", "hash", "map", "keyed", "on", "action", "name", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundlerUtil.java#L49-L53
train
threerings/nenya
tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundlerUtil.java
ComponentBundlerUtil.parseActionTileSets
public static Map<String, TileSet> parseActionTileSets (InputStream in) throws IOException, SAXException { Digester digester = new Digester(); digester.addSetProperties("actions" + ActionRuleSet.ACTION_PATH); addTileSetRuleSet(digester, new SwissArmyTileSetRuleSet()); addTileSetRuleSet(digester, new UniformTileSetRuleSet("/uniformTileset")); Map<String, TileSet> actsets = new ActionMap(); digester.push(actsets); digester.parse(in); return actsets; }
java
public static Map<String, TileSet> parseActionTileSets (InputStream in) throws IOException, SAXException { Digester digester = new Digester(); digester.addSetProperties("actions" + ActionRuleSet.ACTION_PATH); addTileSetRuleSet(digester, new SwissArmyTileSetRuleSet()); addTileSetRuleSet(digester, new UniformTileSetRuleSet("/uniformTileset")); Map<String, TileSet> actsets = new ActionMap(); digester.push(actsets); digester.parse(in); return actsets; }
[ "public", "static", "Map", "<", "String", ",", "TileSet", ">", "parseActionTileSets", "(", "InputStream", "in", ")", "throws", "IOException", ",", "SAXException", "{", "Digester", "digester", "=", "new", "Digester", "(", ")", ";", "digester", ".", "addSetPrope...
Parses the action tileset definitions in the supplied input stream, and puts them into a hash map, keyed on action name.
[ "Parses", "the", "action", "tileset", "definitions", "in", "the", "supplied", "input", "stream", "and", "puts", "them", "into", "a", "hash", "map", "keyed", "on", "action", "name", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundlerUtil.java#L59-L71
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/bundle/BundleUtil.java
BundleUtil.extractBundle
public static TileSetBundle extractBundle (ResourceBundle bundle) throws IOException, ClassNotFoundException { // unserialize the tileset bundles array InputStream tbin = null; try { tbin = bundle.getResource(METADATA_PATH); ObjectInputStream oin = new ObjectInputStream( new BufferedInputStream(tbin)); TileSetBundle tsb = (TileSetBundle)oin.readObject(); return tsb; } finally { StreamUtil.close(tbin); } }
java
public static TileSetBundle extractBundle (ResourceBundle bundle) throws IOException, ClassNotFoundException { // unserialize the tileset bundles array InputStream tbin = null; try { tbin = bundle.getResource(METADATA_PATH); ObjectInputStream oin = new ObjectInputStream( new BufferedInputStream(tbin)); TileSetBundle tsb = (TileSetBundle)oin.readObject(); return tsb; } finally { StreamUtil.close(tbin); } }
[ "public", "static", "TileSetBundle", "extractBundle", "(", "ResourceBundle", "bundle", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "// unserialize the tileset bundles array", "InputStream", "tbin", "=", "null", ";", "try", "{", "tbin", "=", "bundle...
Extracts, but does not initialize, a serialized tileset bundle instance from the supplied resource bundle.
[ "Extracts", "but", "does", "not", "initialize", "a", "serialized", "tileset", "bundle", "instance", "from", "the", "supplied", "resource", "bundle", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/BundleUtil.java#L46-L60
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/bundle/BundleUtil.java
BundleUtil.extractBundle
public static TileSetBundle extractBundle (File file) throws IOException, ClassNotFoundException { // unserialize the tileset bundles array FileInputStream fin = new FileInputStream(file); try { ObjectInputStream oin = new ObjectInputStream( new BufferedInputStream(fin)); TileSetBundle tsb = (TileSetBundle)oin.readObject(); return tsb; } finally { StreamUtil.close(fin); } }
java
public static TileSetBundle extractBundle (File file) throws IOException, ClassNotFoundException { // unserialize the tileset bundles array FileInputStream fin = new FileInputStream(file); try { ObjectInputStream oin = new ObjectInputStream( new BufferedInputStream(fin)); TileSetBundle tsb = (TileSetBundle)oin.readObject(); return tsb; } finally { StreamUtil.close(fin); } }
[ "public", "static", "TileSetBundle", "extractBundle", "(", "File", "file", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "// unserialize the tileset bundles array", "FileInputStream", "fin", "=", "new", "FileInputStream", "(", "file", ")", ";", "try"...
Extracts, but does not initialize, a serialized tileset bundle instance from the supplied file.
[ "Extracts", "but", "does", "not", "initialize", "a", "serialized", "tileset", "bundle", "instance", "from", "the", "supplied", "file", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/bundle/BundleUtil.java#L66-L79
train
groupon/monsoon
history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java
FileUtil.createTempFile
public static FileChannel createTempFile(Path dir, String prefix, String suffix) throws IOException { return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW, DELETE_ON_CLOSE}).getFileChannel(); }
java
public static FileChannel createTempFile(Path dir, String prefix, String suffix) throws IOException { return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW, DELETE_ON_CLOSE}).getFileChannel(); }
[ "public", "static", "FileChannel", "createTempFile", "(", "Path", "dir", ",", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "return", "createNewFileImpl", "(", "dir", ",", "prefix", ",", "suffix", ",", "new", "OpenOption", "["...
Create a temporary file that will be removed when it is closed.
[ "Create", "a", "temporary", "file", "that", "will", "be", "removed", "when", "it", "is", "closed", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java#L58-L60
train
groupon/monsoon
history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java
FileUtil.createTempFile
public static FileChannel createTempFile(String prefix, String suffix) throws IOException { return createTempFile(TMPDIR, prefix, suffix); }
java
public static FileChannel createTempFile(String prefix, String suffix) throws IOException { return createTempFile(TMPDIR, prefix, suffix); }
[ "public", "static", "FileChannel", "createTempFile", "(", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "return", "createTempFile", "(", "TMPDIR", ",", "prefix", ",", "suffix", ")", ";", "}" ]
Create a temporary file that will be removed when it is closed, in the tmpdir location.
[ "Create", "a", "temporary", "file", "that", "will", "be", "removed", "when", "it", "is", "closed", "in", "the", "tmpdir", "location", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java#L66-L68
train
groupon/monsoon
history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java
FileUtil.createNewFile
public static NamedFileChannel createNewFile(Path dir, String prefix, String suffix) throws IOException { return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW}); }
java
public static NamedFileChannel createNewFile(Path dir, String prefix, String suffix) throws IOException { return createNewFileImpl(dir, prefix, suffix, new OpenOption[]{READ, WRITE, CREATE_NEW}); }
[ "public", "static", "NamedFileChannel", "createNewFile", "(", "Path", "dir", ",", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "return", "createNewFileImpl", "(", "dir", ",", "prefix", ",", "suffix", ",", "new", "OpenOption", ...
Creates a new file and opens it for reading and writing.
[ "Creates", "a", "new", "file", "and", "opens", "it", "for", "reading", "and", "writing", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/xdr/support/FileUtil.java#L73-L75
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObject.java
SceneObject.paint
public void paint (Graphics2D gfx) { // if we're rendering footprints, paint that boolean footpaint = _fprintDebug.getValue(); if (footpaint) { gfx.setColor(Color.black); gfx.draw(_footprint); if (_hideObjects.getValue()) { // We're in footprints but no objects mode, so let's also fill it in so we can // see things better/tell if we have overlapping ones Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); gfx.fill(_footprint); gfx.setComposite(ocomp); } } if (_hideObjects.getValue()) { return; } // if we have a warning, render an alpha'd red rectangle over our bounds if (_warning) { Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); gfx.fill(bounds); gfx.setComposite(ocomp); } // paint our tile tile.paint(gfx, bounds.x, bounds.y); // and possibly paint the object's spot if (footpaint && _sspot != null) { // translate the origin to center on the portal gfx.translate(_sspot.x, _sspot.y); // rotate to reflect the spot orientation double rot = (Math.PI / 4.0f) * tile.getSpotOrient(); gfx.rotate(rot); // draw the spot triangle gfx.setColor(Color.green); gfx.fill(_spotTri); // outline the triangle in black gfx.setColor(Color.black); gfx.draw(_spotTri); // restore the original transform gfx.rotate(-rot); gfx.translate(-_sspot.x, -_sspot.y); } }
java
public void paint (Graphics2D gfx) { // if we're rendering footprints, paint that boolean footpaint = _fprintDebug.getValue(); if (footpaint) { gfx.setColor(Color.black); gfx.draw(_footprint); if (_hideObjects.getValue()) { // We're in footprints but no objects mode, so let's also fill it in so we can // see things better/tell if we have overlapping ones Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); gfx.fill(_footprint); gfx.setComposite(ocomp); } } if (_hideObjects.getValue()) { return; } // if we have a warning, render an alpha'd red rectangle over our bounds if (_warning) { Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); gfx.fill(bounds); gfx.setComposite(ocomp); } // paint our tile tile.paint(gfx, bounds.x, bounds.y); // and possibly paint the object's spot if (footpaint && _sspot != null) { // translate the origin to center on the portal gfx.translate(_sspot.x, _sspot.y); // rotate to reflect the spot orientation double rot = (Math.PI / 4.0f) * tile.getSpotOrient(); gfx.rotate(rot); // draw the spot triangle gfx.setColor(Color.green); gfx.fill(_spotTri); // outline the triangle in black gfx.setColor(Color.black); gfx.draw(_spotTri); // restore the original transform gfx.rotate(-rot); gfx.translate(-_sspot.x, -_sspot.y); } }
[ "public", "void", "paint", "(", "Graphics2D", "gfx", ")", "{", "// if we're rendering footprints, paint that", "boolean", "footpaint", "=", "_fprintDebug", ".", "getValue", "(", ")", ";", "if", "(", "footpaint", ")", "{", "gfx", ".", "setColor", "(", "Color", ...
Requests that this scene object render itself.
[ "Requests", "that", "this", "scene", "object", "render", "itself", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObject.java#L111-L165
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObject.java
SceneObject.setPriority
public void setPriority (byte priority) { info.priority = (byte)Math.max( Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, priority)); }
java
public void setPriority (byte priority) { info.priority = (byte)Math.max( Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, priority)); }
[ "public", "void", "setPriority", "(", "byte", "priority", ")", "{", "info", ".", "priority", "=", "(", "byte", ")", "Math", ".", "max", "(", "Byte", ".", "MIN_VALUE", ",", "Math", ".", "min", "(", "Byte", ".", "MAX_VALUE", ",", "priority", ")", ")", ...
Overrides the render priority of this object.
[ "Overrides", "the", "render", "priority", "of", "this", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObject.java#L228-L232
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObject.java
SceneObject.relocateObject
public void relocateObject (MisoSceneMetrics metrics, int tx, int ty) { // Log.info("Relocating object " + this + " to " + // StringUtil.coordsToString(tx, ty)); info.x = tx; info.y = ty; computeInfo(metrics); }
java
public void relocateObject (MisoSceneMetrics metrics, int tx, int ty) { // Log.info("Relocating object " + this + " to " + // StringUtil.coordsToString(tx, ty)); info.x = tx; info.y = ty; computeInfo(metrics); }
[ "public", "void", "relocateObject", "(", "MisoSceneMetrics", "metrics", ",", "int", "tx", ",", "int", "ty", ")", "{", "// Log.info(\"Relocating object \" + this + \" to \" +", "// StringUtil.coordsToString(tx, ty));", "info", ".", "x", "=", "tx", ";...
Updates this object's origin tile coordinate. Its bounds and other cached screen coordinate information are updated.
[ "Updates", "this", "object", "s", "origin", "tile", "coordinate", ".", "Its", "bounds", "and", "other", "cached", "screen", "coordinate", "information", "are", "updated", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObject.java#L248-L255
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObject.java
SceneObject.computeInfo
protected void computeInfo (MisoSceneMetrics metrics) { // start with the screen coordinates of our origin tile Point tpos = MisoUtil.tileToScreen( metrics, info.x, info.y, new Point()); // if the tile has an origin coordinate, use that, otherwise // compute it from the tile footprint int tox = tile.getOriginX(), toy = tile.getOriginY(); if (tox == Integer.MIN_VALUE) { tox = tile.getBaseWidth() * metrics.tilehwid; } if (toy == Integer.MIN_VALUE) { toy = tile.getHeight(); } bounds = new Rectangle(tpos.x + metrics.tilehwid - tox, tpos.y + metrics.tilehei - toy, tile.getWidth(), tile.getHeight()); // compute our object footprint as well _frect = new Rectangle(info.x - tile.getBaseWidth() + 1, info.y - tile.getBaseHeight() + 1, tile.getBaseWidth(), tile.getBaseHeight()); _footprint = MisoUtil.getFootprintPolygon( metrics, _frect.x, _frect.y, _frect.width, _frect.height); // compute our object spot if we've got one if (tile.hasSpot()) { _fspot = MisoUtil.tilePlusFineToFull( metrics, info.x, info.y, tile.getSpotX(), tile.getSpotY(), new Point()); _sspot = MisoUtil.fullToScreen( metrics, _fspot.x, _fspot.y, new Point()); } // Log.info("Computed object metrics " + // "[tpos=" + StringUtil.coordsToString(tx, ty) + // ", info=" + info + // ", sbounds=" + StringUtil.toString(bounds) + "]."); }
java
protected void computeInfo (MisoSceneMetrics metrics) { // start with the screen coordinates of our origin tile Point tpos = MisoUtil.tileToScreen( metrics, info.x, info.y, new Point()); // if the tile has an origin coordinate, use that, otherwise // compute it from the tile footprint int tox = tile.getOriginX(), toy = tile.getOriginY(); if (tox == Integer.MIN_VALUE) { tox = tile.getBaseWidth() * metrics.tilehwid; } if (toy == Integer.MIN_VALUE) { toy = tile.getHeight(); } bounds = new Rectangle(tpos.x + metrics.tilehwid - tox, tpos.y + metrics.tilehei - toy, tile.getWidth(), tile.getHeight()); // compute our object footprint as well _frect = new Rectangle(info.x - tile.getBaseWidth() + 1, info.y - tile.getBaseHeight() + 1, tile.getBaseWidth(), tile.getBaseHeight()); _footprint = MisoUtil.getFootprintPolygon( metrics, _frect.x, _frect.y, _frect.width, _frect.height); // compute our object spot if we've got one if (tile.hasSpot()) { _fspot = MisoUtil.tilePlusFineToFull( metrics, info.x, info.y, tile.getSpotX(), tile.getSpotY(), new Point()); _sspot = MisoUtil.fullToScreen( metrics, _fspot.x, _fspot.y, new Point()); } // Log.info("Computed object metrics " + // "[tpos=" + StringUtil.coordsToString(tx, ty) + // ", info=" + info + // ", sbounds=" + StringUtil.toString(bounds) + "]."); }
[ "protected", "void", "computeInfo", "(", "MisoSceneMetrics", "metrics", ")", "{", "// start with the screen coordinates of our origin tile", "Point", "tpos", "=", "MisoUtil", ".", "tileToScreen", "(", "metrics", ",", "info", ".", "x", ",", "info", ".", "y", ",", "...
Computes our screen bounds, tile footprint and other useful cached metrics.
[ "Computes", "our", "screen", "bounds", "tile", "footprint", "and", "other", "useful", "cached", "metrics", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObject.java#L291-L331
train
tonilopezmr/Android-EasySQLite
app/src/main/java/com/tonilopezmr/sample/domain/interactor/GetSubjectListUseCaseImp.java
GetSubjectListUseCaseImp.run
@Override public void run() { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } subjectRepository.getSubjectsCollection(new SubjectRepository.SubjectListCallback() { @Override public void onSubjectListLoader(final Collection<Subject> subjects) { mainThread.post(new Runnable() { @Override public void run() { callback.onSubjectListLoaded(subjects); } }); } @Override public void onError(final SubjectException exception) { mainThread.post(new Runnable() { @Override public void run() { callback.onError(exception); Log.i(getClass().toString(), "Error!"); } }); } }); }
java
@Override public void run() { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } subjectRepository.getSubjectsCollection(new SubjectRepository.SubjectListCallback() { @Override public void onSubjectListLoader(final Collection<Subject> subjects) { mainThread.post(new Runnable() { @Override public void run() { callback.onSubjectListLoaded(subjects); } }); } @Override public void onError(final SubjectException exception) { mainThread.post(new Runnable() { @Override public void run() { callback.onError(exception); Log.i(getClass().toString(), "Error!"); } }); } }); }
[ "@", "Override", "public", "void", "run", "(", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "3000", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "subjectRepository", ".", "...
Interactor User case
[ "Interactor", "User", "case" ]
bb991a43c9fa11522e5367570ee2335b99bca7c0
https://github.com/tonilopezmr/Android-EasySQLite/blob/bb991a43c9fa11522e5367570ee2335b99bca7c0/app/src/main/java/com/tonilopezmr/sample/domain/interactor/GetSubjectListUseCaseImp.java#L43-L73
train
groupon/monsoon
history/src/main/java/com/groupon/lex/metrics/history/xdr/support/TmpFileBasedColumnMajorTSData.java
Builder.fixBacklog
private void fixBacklog() throws IOException { try { writers.values().parallelStream() .forEach(groupWriter -> { try { groupWriter.fixBacklog(timestamps.size()); } catch (IOException ex) { throw new RuntimeIOException(ex); } }); } catch (RuntimeIOException ex) { throw ex.getEx(); } }
java
private void fixBacklog() throws IOException { try { writers.values().parallelStream() .forEach(groupWriter -> { try { groupWriter.fixBacklog(timestamps.size()); } catch (IOException ex) { throw new RuntimeIOException(ex); } }); } catch (RuntimeIOException ex) { throw ex.getEx(); } }
[ "private", "void", "fixBacklog", "(", ")", "throws", "IOException", "{", "try", "{", "writers", ".", "values", "(", ")", ".", "parallelStream", "(", ")", ".", "forEach", "(", "groupWriter", "->", "{", "try", "{", "groupWriter", ".", "fixBacklog", "(", "t...
Pad all groups with empty maps, to ensure it's the same size as timestamps list. We want to keep all the Group instances to have the same number of maps as the timestamps list, so we can zip the two together.
[ "Pad", "all", "groups", "with", "empty", "maps", "to", "ensure", "it", "s", "the", "same", "size", "as", "timestamps", "list", "." ]
eb68d72ba4c01fe018dc981097dbee033908f5c7
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/xdr/support/TmpFileBasedColumnMajorTSData.java#L114-L127
train
threerings/nenya
core/src/main/java/com/threerings/media/MetaMediaManager.java
MetaMediaManager.setPaused
public void setPaused (boolean paused) { // sanity check if ((paused && (_pauseTime != 0)) || (!paused && (_pauseTime == 0))) { log.warning("Requested to pause when paused or vice-versa", "paused", paused); return; } _paused = paused; if (_paused) { // make a note of our pause time _pauseTime = _framemgr.getTimeStamp(); } else { // let the animation and sprite managers know that we just warped into the future long delta = _framemgr.getTimeStamp() - _pauseTime; _animmgr.fastForward(delta); _spritemgr.fastForward(delta); // clear out our pause time _pauseTime = 0; } }
java
public void setPaused (boolean paused) { // sanity check if ((paused && (_pauseTime != 0)) || (!paused && (_pauseTime == 0))) { log.warning("Requested to pause when paused or vice-versa", "paused", paused); return; } _paused = paused; if (_paused) { // make a note of our pause time _pauseTime = _framemgr.getTimeStamp(); } else { // let the animation and sprite managers know that we just warped into the future long delta = _framemgr.getTimeStamp() - _pauseTime; _animmgr.fastForward(delta); _spritemgr.fastForward(delta); // clear out our pause time _pauseTime = 0; } }
[ "public", "void", "setPaused", "(", "boolean", "paused", ")", "{", "// sanity check", "if", "(", "(", "paused", "&&", "(", "_pauseTime", "!=", "0", ")", ")", "||", "(", "!", "paused", "&&", "(", "_pauseTime", "==", "0", ")", ")", ")", "{", "log", "...
Pauses the sprites and animations that are currently active on this media panel. Also stops listening to the frame tick while paused.
[ "Pauses", "the", "sprites", "and", "animations", "that", "are", "currently", "active", "on", "this", "media", "panel", ".", "Also", "stops", "listening", "to", "the", "frame", "tick", "while", "paused", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MetaMediaManager.java#L110-L132
train
threerings/nenya
core/src/main/java/com/threerings/media/MetaMediaManager.java
MetaMediaManager.paintMedia
public void paintMedia (Graphics2D gfx, int layer, Rectangle dirty) { if (layer == FRONT) { _spritemgr.paint(gfx, layer, dirty); _animmgr.paint(gfx, layer, dirty); } else { _animmgr.paint(gfx, layer, dirty); _spritemgr.paint(gfx, layer, dirty); } }
java
public void paintMedia (Graphics2D gfx, int layer, Rectangle dirty) { if (layer == FRONT) { _spritemgr.paint(gfx, layer, dirty); _animmgr.paint(gfx, layer, dirty); } else { _animmgr.paint(gfx, layer, dirty); _spritemgr.paint(gfx, layer, dirty); } }
[ "public", "void", "paintMedia", "(", "Graphics2D", "gfx", ",", "int", "layer", ",", "Rectangle", "dirty", ")", "{", "if", "(", "layer", "==", "FRONT", ")", "{", "_spritemgr", ".", "paint", "(", "gfx", ",", "layer", ",", "dirty", ")", ";", "_animmgr", ...
Renders the sprites and animations that intersect the supplied dirty region in the specified layer.
[ "Renders", "the", "sprites", "and", "animations", "that", "intersect", "the", "supplied", "dirty", "region", "in", "the", "specified", "layer", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MetaMediaManager.java#L300-L309
train
threerings/nenya
core/src/main/java/com/threerings/media/MetaMediaManager.java
MetaMediaManager.paintPerf
public void paintPerf (Graphics2D gfx) { if (_perfRect != null && FrameManager._perfDebug.getValue()) { gfx.setClip(null); _perfLabel.render(gfx, _perfRect.x, _perfRect.y); } }
java
public void paintPerf (Graphics2D gfx) { if (_perfRect != null && FrameManager._perfDebug.getValue()) { gfx.setClip(null); _perfLabel.render(gfx, _perfRect.x, _perfRect.y); } }
[ "public", "void", "paintPerf", "(", "Graphics2D", "gfx", ")", "{", "if", "(", "_perfRect", "!=", "null", "&&", "FrameManager", ".", "_perfDebug", ".", "getValue", "(", ")", ")", "{", "gfx", ".", "setClip", "(", "null", ")", ";", "_perfLabel", ".", "ren...
Renders our performance debugging information if enabled.
[ "Renders", "our", "performance", "debugging", "information", "if", "enabled", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MetaMediaManager.java#L314-L320
train
threerings/nenya
core/src/main/java/com/threerings/media/MetaMediaManager.java
MetaMediaManager.viewLocationDidChange
public void viewLocationDidChange (int dx, int dy) { if (_perfRect != null) { Rectangle sdirty = new Rectangle(_perfRect); sdirty.translate(-dx, -dy); _remgr.addDirtyRegion(sdirty); } // let our sprites and animations know what's up _animmgr.viewLocationDidChange(dx, dy); _spritemgr.viewLocationDidChange(dx, dy); }
java
public void viewLocationDidChange (int dx, int dy) { if (_perfRect != null) { Rectangle sdirty = new Rectangle(_perfRect); sdirty.translate(-dx, -dy); _remgr.addDirtyRegion(sdirty); } // let our sprites and animations know what's up _animmgr.viewLocationDidChange(dx, dy); _spritemgr.viewLocationDidChange(dx, dy); }
[ "public", "void", "viewLocationDidChange", "(", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "_perfRect", "!=", "null", ")", "{", "Rectangle", "sdirty", "=", "new", "Rectangle", "(", "_perfRect", ")", ";", "sdirty", ".", "translate", "(", "-", "...
If our host supports scrolling around in a virtual view, it should call this method when the view origin changes.
[ "If", "our", "host", "supports", "scrolling", "around", "in", "a", "virtual", "view", "it", "should", "call", "this", "method", "when", "the", "view", "origin", "changes", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MetaMediaManager.java#L326-L337
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/Tile.java
Tile.setImage
public void setImage (Mirage image) { if (_mirage != null) { _totalTileMemory -= _mirage.getEstimatedMemoryUsage(); } _mirage = image; if (_mirage != null) { _totalTileMemory += _mirage.getEstimatedMemoryUsage(); } }
java
public void setImage (Mirage image) { if (_mirage != null) { _totalTileMemory -= _mirage.getEstimatedMemoryUsage(); } _mirage = image; if (_mirage != null) { _totalTileMemory += _mirage.getEstimatedMemoryUsage(); } }
[ "public", "void", "setImage", "(", "Mirage", "image", ")", "{", "if", "(", "_mirage", "!=", "null", ")", "{", "_totalTileMemory", "-=", "_mirage", ".", "getEstimatedMemoryUsage", "(", ")", ";", "}", "_mirage", "=", "image", ";", "if", "(", "_mirage", "!=...
Configures this tile with its tile image.
[ "Configures", "this", "tile", "with", "its", "tile", "image", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/Tile.java#L80-L89
train
threerings/nenya
core/src/main/java/com/threerings/media/tile/Tile.java
Tile.paint
public void paint (Graphics2D gfx, int x, int y) { _mirage.paint(gfx, x, y); }
java
public void paint (Graphics2D gfx, int x, int y) { _mirage.paint(gfx, x, y); }
[ "public", "void", "paint", "(", "Graphics2D", "gfx", ",", "int", "x", ",", "int", "y", ")", "{", "_mirage", ".", "paint", "(", "gfx", ",", "x", ",", "y", ")", ";", "}" ]
Render the tile image at the specified position in the given graphics context.
[ "Render", "the", "tile", "image", "at", "the", "specified", "position", "in", "the", "given", "graphics", "context", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/Tile.java#L119-L122
train