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/sound/SoundLoader.java
SoundLoader.getSound
public InputStream getSound (String bundle, String path) throws IOException { InputStream rsrc; try { rsrc = _rmgr.getResource(bundle, path); } catch (FileNotFoundException notFound) { // try from the classpath try { rsrc = _rmgr.getResource(path); } catch (FileNotFoundException notFoundAgain) { throw notFound; } } return rsrc; }
java
public InputStream getSound (String bundle, String path) throws IOException { InputStream rsrc; try { rsrc = _rmgr.getResource(bundle, path); } catch (FileNotFoundException notFound) { // try from the classpath try { rsrc = _rmgr.getResource(path); } catch (FileNotFoundException notFoundAgain) { throw notFound; } } return rsrc; }
[ "public", "InputStream", "getSound", "(", "String", "bundle", ",", "String", "path", ")", "throws", "IOException", "{", "InputStream", "rsrc", ";", "try", "{", "rsrc", "=", "_rmgr", ".", "getResource", "(", "bundle", ",", "path", ")", ";", "}", "catch", ...
Attempts to load a sound stream from the given path from the given bundle and from the classpath. If nothing is found, a FileNotFoundException is thrown.
[ "Attempts", "to", "load", "a", "sound", "stream", "from", "the", "given", "path", "from", "the", "given", "bundle", "and", "from", "the", "classpath", ".", "If", "nothing", "is", "found", "a", "FileNotFoundException", "is", "thrown", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sound/SoundLoader.java#L92-L107
train
threerings/nenya
core/src/main/java/com/threerings/media/sound/SoundLoader.java
SoundLoader.getConfig
protected Config getConfig (String packagePath) { Config c = _configs.get(packagePath); if (c == null) { Properties props = new Properties(); String propFilename = packagePath + Sounds.PROP_NAME + ".properties"; try { props = ConfigUtil.loadInheritedProperties(propFilename, _rmgr.getClassLoader()); } catch (IOException ioe) { log.warning("Failed to load sound properties", "filename", propFilename, ioe); } c = new Config(props); _configs.put(packagePath, c); } return c; }
java
protected Config getConfig (String packagePath) { Config c = _configs.get(packagePath); if (c == null) { Properties props = new Properties(); String propFilename = packagePath + Sounds.PROP_NAME + ".properties"; try { props = ConfigUtil.loadInheritedProperties(propFilename, _rmgr.getClassLoader()); } catch (IOException ioe) { log.warning("Failed to load sound properties", "filename", propFilename, ioe); } c = new Config(props); _configs.put(packagePath, c); } return c; }
[ "protected", "Config", "getConfig", "(", "String", "packagePath", ")", "{", "Config", "c", "=", "_configs", ".", "get", "(", "packagePath", ")", ";", "if", "(", "c", "==", "null", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";"...
Get the cached Config.
[ "Get", "the", "cached", "Config", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sound/SoundLoader.java#L117-L132
train
threerings/nenya
core/src/main/java/com/threerings/media/sound/SoundLoader.java
SoundLoader.loadClipData
protected byte[] loadClipData (String bundle, String path) throws IOException { InputStream clipin = null; try { clipin = getSound(bundle, path); } catch (FileNotFoundException fnfe) { // only play the default sound if we have verbose sound debugging turned on. if (JavaSoundPlayer._verbose.getValue()) { log.warning("Could not locate sound data", "bundle", bundle, "path", path); if (_defaultClipPath != null) { try { clipin = _rmgr.getResource(_defaultClipBundle, _defaultClipPath); } catch (FileNotFoundException fnfe3) { try { clipin = _rmgr.getResource(_defaultClipPath); } catch (FileNotFoundException fnfe4) { log.warning( "Additionally, the default fallback sound could not be located", "bundle", _defaultClipBundle, "path", _defaultClipPath); } } } else { log.warning("No fallback default sound specified!"); } } // if we couldn't load the default, rethrow if (clipin == null) { throw fnfe; } } return StreamUtil.toByteArray(clipin); }
java
protected byte[] loadClipData (String bundle, String path) throws IOException { InputStream clipin = null; try { clipin = getSound(bundle, path); } catch (FileNotFoundException fnfe) { // only play the default sound if we have verbose sound debugging turned on. if (JavaSoundPlayer._verbose.getValue()) { log.warning("Could not locate sound data", "bundle", bundle, "path", path); if (_defaultClipPath != null) { try { clipin = _rmgr.getResource(_defaultClipBundle, _defaultClipPath); } catch (FileNotFoundException fnfe3) { try { clipin = _rmgr.getResource(_defaultClipPath); } catch (FileNotFoundException fnfe4) { log.warning( "Additionally, the default fallback sound could not be located", "bundle", _defaultClipBundle, "path", _defaultClipPath); } } } else { log.warning("No fallback default sound specified!"); } } // if we couldn't load the default, rethrow if (clipin == null) { throw fnfe; } } return StreamUtil.toByteArray(clipin); }
[ "protected", "byte", "[", "]", "loadClipData", "(", "String", "bundle", ",", "String", "path", ")", "throws", "IOException", "{", "InputStream", "clipin", "=", "null", ";", "try", "{", "clipin", "=", "getSound", "(", "bundle", ",", "path", ")", ";", "}",...
Read the data from the resource manager.
[ "Read", "the", "data", "from", "the", "resource", "manager", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sound/SoundLoader.java#L137-L170
train
threerings/nenya
core/src/main/java/com/threerings/media/timer/CalibratingTimer.java
CalibratingTimer.init
protected void init (long milliDivider, long microDivider) { _milliDivider = milliDivider; _microDivider = microDivider; reset(); log.info("Using " + getClass() + " timer", "mfreq", _milliDivider, "ufreq", _microDivider, "start", _startStamp); }
java
protected void init (long milliDivider, long microDivider) { _milliDivider = milliDivider; _microDivider = microDivider; reset(); log.info("Using " + getClass() + " timer", "mfreq", _milliDivider, "ufreq", _microDivider, "start", _startStamp); }
[ "protected", "void", "init", "(", "long", "milliDivider", ",", "long", "microDivider", ")", "{", "_milliDivider", "=", "milliDivider", ";", "_microDivider", "=", "microDivider", ";", "reset", "(", ")", ";", "log", ".", "info", "(", "\"Using \"", "+", "getCla...
Initializes this timer. Must be called before the timer is used. @param milliDivider - value by which current() must be divided to get milliseconds @param microDivider - value by which current() must be divided to get microseconds
[ "Initializes", "this", "timer", ".", "Must", "be", "called", "before", "the", "timer", "is", "used", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/timer/CalibratingTimer.java#L43-L50
train
threerings/nenya
core/src/main/java/com/threerings/media/timer/CalibratingTimer.java
CalibratingTimer.calibrate
protected void calibrate () { long currentTimer = current(); long currentMillis = System.currentTimeMillis(); long elapsedTimer = currentTimer - _driftTimerStamp; float elapsedMillis = currentMillis - _driftMilliStamp; float drift = elapsedMillis / (elapsedTimer / _milliDivider); if (_debugCalibrate.getValue()) { log.warning("Calibrating", "timer", elapsedTimer, "millis", elapsedMillis, "drift", drift, "timerstamp", _driftTimerStamp, "millistamp", _driftMilliStamp, "current", currentTimer); } if (elapsedTimer < 0) { log.warning("The timer has decided to live in the past, resetting drift" , "previousTimer", _driftTimerStamp, "currentTimer", currentTimer, "previousMillis", _driftMilliStamp, "currentMillis", currentMillis); _driftRatio = 1.0F; } else if (drift > MAX_ALLOWED_DRIFT_RATIO || drift < MIN_ALLOWED_DRIFT_RATIO) { log.warning("Calibrating", "drift", drift); // Ignore the drift if it's hugely out of range. That indicates general clock insanity, // and we just want to stay out of the way. if (drift < 100 * MAX_ALLOWED_DRIFT_RATIO && drift > MIN_ALLOWED_DRIFT_RATIO / 100) { _driftRatio = drift; } else { _driftRatio = 1.0F; } if (Math.abs(drift - 1.0) > Math.abs(_maxDriftRatio - 1.0)) { _maxDriftRatio = drift; } } else if (_driftRatio != 1.0) { log.warning("Calibrating", "drift", drift); // If we're within bounds now but we weren't before, reset _driftFactor and log it _driftRatio = 1.0F; } _driftMilliStamp = currentMillis; _driftTimerStamp = currentTimer; }
java
protected void calibrate () { long currentTimer = current(); long currentMillis = System.currentTimeMillis(); long elapsedTimer = currentTimer - _driftTimerStamp; float elapsedMillis = currentMillis - _driftMilliStamp; float drift = elapsedMillis / (elapsedTimer / _milliDivider); if (_debugCalibrate.getValue()) { log.warning("Calibrating", "timer", elapsedTimer, "millis", elapsedMillis, "drift", drift, "timerstamp", _driftTimerStamp, "millistamp", _driftMilliStamp, "current", currentTimer); } if (elapsedTimer < 0) { log.warning("The timer has decided to live in the past, resetting drift" , "previousTimer", _driftTimerStamp, "currentTimer", currentTimer, "previousMillis", _driftMilliStamp, "currentMillis", currentMillis); _driftRatio = 1.0F; } else if (drift > MAX_ALLOWED_DRIFT_RATIO || drift < MIN_ALLOWED_DRIFT_RATIO) { log.warning("Calibrating", "drift", drift); // Ignore the drift if it's hugely out of range. That indicates general clock insanity, // and we just want to stay out of the way. if (drift < 100 * MAX_ALLOWED_DRIFT_RATIO && drift > MIN_ALLOWED_DRIFT_RATIO / 100) { _driftRatio = drift; } else { _driftRatio = 1.0F; } if (Math.abs(drift - 1.0) > Math.abs(_maxDriftRatio - 1.0)) { _maxDriftRatio = drift; } } else if (_driftRatio != 1.0) { log.warning("Calibrating", "drift", drift); // If we're within bounds now but we weren't before, reset _driftFactor and log it _driftRatio = 1.0F; } _driftMilliStamp = currentMillis; _driftTimerStamp = currentTimer; }
[ "protected", "void", "calibrate", "(", ")", "{", "long", "currentTimer", "=", "current", "(", ")", ";", "long", "currentMillis", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "elapsedTimer", "=", "currentTimer", "-", "_driftTimerStamp", ";", ...
Calculates the drift factor from the time elapsed from the last calibrate call.
[ "Calculates", "the", "drift", "factor", "from", "the", "time", "elapsed", "from", "the", "last", "calibrate", "call", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/timer/CalibratingTimer.java#L121-L160
train
threerings/nenya
tools/src/main/java/com/threerings/cast/tools/xml/ClassRuleSet.java
ClassRuleSet.addRuleInstances
@Override public void addRuleInstances (Digester digester) { // this creates the appropriate instance when we encounter a // <class> tag digester.addObjectCreate(_prefix + CLASS_PATH, ComponentClass.class.getName()); // grab the attributes from the <class> tag SetPropertyFieldsRule rule = new SetPropertyFieldsRule(); rule.addFieldParser("shadowColor", new FieldParser() { public Object parse (String text) { int[] values = StringUtil.parseIntArray(text); return new Color(values[0], values[1], values[2], values[3]); } }); digester.addRule(_prefix + CLASS_PATH, rule); // parse render priority overrides String opath = _prefix + CLASS_PATH + "/override"; digester.addObjectCreate(opath, PriorityOverride.class.getName()); rule = new SetPropertyFieldsRule(); rule.addFieldParser("orients", new FieldParser() { public Object parse (String text) { String[] orients = StringUtil.parseStringArray(text); ArrayIntSet oset = new ArrayIntSet(); for (String orient : orients) { oset.add(DirectionUtil.fromShortString(orient)); } return oset; } }); digester.addRule(opath, rule); digester.addSetNext(opath, "addPriorityOverride", PriorityOverride.class.getName()); }
java
@Override public void addRuleInstances (Digester digester) { // this creates the appropriate instance when we encounter a // <class> tag digester.addObjectCreate(_prefix + CLASS_PATH, ComponentClass.class.getName()); // grab the attributes from the <class> tag SetPropertyFieldsRule rule = new SetPropertyFieldsRule(); rule.addFieldParser("shadowColor", new FieldParser() { public Object parse (String text) { int[] values = StringUtil.parseIntArray(text); return new Color(values[0], values[1], values[2], values[3]); } }); digester.addRule(_prefix + CLASS_PATH, rule); // parse render priority overrides String opath = _prefix + CLASS_PATH + "/override"; digester.addObjectCreate(opath, PriorityOverride.class.getName()); rule = new SetPropertyFieldsRule(); rule.addFieldParser("orients", new FieldParser() { public Object parse (String text) { String[] orients = StringUtil.parseStringArray(text); ArrayIntSet oset = new ArrayIntSet(); for (String orient : orients) { oset.add(DirectionUtil.fromShortString(orient)); } return oset; } }); digester.addRule(opath, rule); digester.addSetNext(opath, "addPriorityOverride", PriorityOverride.class.getName()); }
[ "@", "Override", "public", "void", "addRuleInstances", "(", "Digester", "digester", ")", "{", "// this creates the appropriate instance when we encounter a", "// <class> tag", "digester", ".", "addObjectCreate", "(", "_prefix", "+", "CLASS_PATH", ",", "ComponentClass", ".",...
Adds the necessary rules to the digester to parse our classes.
[ "Adds", "the", "necessary", "rules", "to", "the", "digester", "to", "parse", "our", "classes", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/tools/xml/ClassRuleSet.java#L70-L106
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/ObjectSet.java
ObjectSet.insert
public boolean insert (ObjectInfo info) { // bail if it's already in the set int ipos = indexOf(info); if (ipos >= 0) { // log a warning because the caller shouldn't be doing this log.warning("Requested to add an object to a set that already " + "contains such an object [ninfo=" + info + ", oinfo=" + _objs[ipos] + "].", new Exception()); return false; } // otherwise insert it ipos = -(ipos+1); _objs = ListUtil.insert(_objs, ipos, info); _size++; return true; }
java
public boolean insert (ObjectInfo info) { // bail if it's already in the set int ipos = indexOf(info); if (ipos >= 0) { // log a warning because the caller shouldn't be doing this log.warning("Requested to add an object to a set that already " + "contains such an object [ninfo=" + info + ", oinfo=" + _objs[ipos] + "].", new Exception()); return false; } // otherwise insert it ipos = -(ipos+1); _objs = ListUtil.insert(_objs, ipos, info); _size++; return true; }
[ "public", "boolean", "insert", "(", "ObjectInfo", "info", ")", "{", "// bail if it's already in the set", "int", "ipos", "=", "indexOf", "(", "info", ")", ";", "if", "(", "ipos", ">=", "0", ")", "{", "// log a warning because the caller shouldn't be doing this", "lo...
Inserts the supplied object into the set. @return true if it was inserted, false if the object was already in the set.
[ "Inserts", "the", "supplied", "object", "into", "the", "set", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/ObjectSet.java#L44-L61
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/ObjectSet.java
ObjectSet.remove
public boolean remove (ObjectInfo info) { int opos = indexOf(info); if (opos >= 0) { remove(opos); return true; } else { return false; } }
java
public boolean remove (ObjectInfo info) { int opos = indexOf(info); if (opos >= 0) { remove(opos); return true; } else { return false; } }
[ "public", "boolean", "remove", "(", "ObjectInfo", "info", ")", "{", "int", "opos", "=", "indexOf", "(", "info", ")", ";", "if", "(", "opos", ">=", "0", ")", "{", "remove", "(", "opos", ")", ";", "return", "true", ";", "}", "else", "{", "return", ...
Removes the specified object from the set. @return true if it was removed, false if it was not in the set.
[ "Removes", "the", "specified", "object", "from", "the", "set", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/ObjectSet.java#L103-L112
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/ObjectSet.java
ObjectSet.toArray
public ObjectInfo[] toArray () { ObjectInfo[] info = new ObjectInfo[_size]; System.arraycopy(_objs, 0, info, 0, _size); return info; }
java
public ObjectInfo[] toArray () { ObjectInfo[] info = new ObjectInfo[_size]; System.arraycopy(_objs, 0, info, 0, _size); return info; }
[ "public", "ObjectInfo", "[", "]", "toArray", "(", ")", "{", "ObjectInfo", "[", "]", "info", "=", "new", "ObjectInfo", "[", "_size", "]", ";", "System", ".", "arraycopy", "(", "_objs", ",", "0", ",", "info", ",", "0", ",", "_size", ")", ";", "return...
Converts the contents of this object set to an array.
[ "Converts", "the", "contents", "of", "this", "object", "set", "to", "an", "array", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/ObjectSet.java#L126-L131
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.getBaseTile
public BaseTile getBaseTile (int tx, int ty) { BaseTile tile = _base[index(tx, ty)]; if (tile == null && _defset != null) { tile = (BaseTile)_defset.getTile( TileUtil.getTileHash(tx, ty) % _defset.getTileCount()); } return tile; }
java
public BaseTile getBaseTile (int tx, int ty) { BaseTile tile = _base[index(tx, ty)]; if (tile == null && _defset != null) { tile = (BaseTile)_defset.getTile( TileUtil.getTileHash(tx, ty) % _defset.getTileCount()); } return tile; }
[ "public", "BaseTile", "getBaseTile", "(", "int", "tx", ",", "int", "ty", ")", "{", "BaseTile", "tile", "=", "_base", "[", "index", "(", "tx", ",", "ty", ")", "]", ";", "if", "(", "tile", "==", "null", "&&", "_defset", "!=", "null", ")", "{", "til...
Returns the base tile at the specified coordinates or null if there's no tile at said coordinates.
[ "Returns", "the", "base", "tile", "at", "the", "specified", "coordinates", "or", "null", "if", "there", "s", "no", "tile", "at", "said", "coordinates", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L288-L296
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.updateBaseTile
public void updateBaseTile (int fqTileId, int tx, int ty) { String errmsg = null; int tidx = index(tx, ty); // this is a bit magical: we pass the fully qualified tile id to // the tile manager which loads up from the configured tileset // repository the appropriate tileset (which should be a // BaseTileSet) and then extracts the appropriate base tile (the // index of which is also in the fqTileId) try { if (fqTileId <= 0) { _base[tidx] = null; } else { _base[tidx] = (BaseTile)_tileMgr.getTile(fqTileId); } // clear out the fringe (it must be recomputed by the caller) _fringe[tidx] = null; } catch (ClassCastException cce) { errmsg = "Scene contains non-base tile in base layer"; } catch (NoSuchTileSetException nste) { errmsg = "Scene contains non-existent tileset"; } if (errmsg != null) { log.warning(errmsg + " [fqtid=" + fqTileId + ", x=" + tx + ", y=" + ty + "]."); } }
java
public void updateBaseTile (int fqTileId, int tx, int ty) { String errmsg = null; int tidx = index(tx, ty); // this is a bit magical: we pass the fully qualified tile id to // the tile manager which loads up from the configured tileset // repository the appropriate tileset (which should be a // BaseTileSet) and then extracts the appropriate base tile (the // index of which is also in the fqTileId) try { if (fqTileId <= 0) { _base[tidx] = null; } else { _base[tidx] = (BaseTile)_tileMgr.getTile(fqTileId); } // clear out the fringe (it must be recomputed by the caller) _fringe[tidx] = null; } catch (ClassCastException cce) { errmsg = "Scene contains non-base tile in base layer"; } catch (NoSuchTileSetException nste) { errmsg = "Scene contains non-existent tileset"; } if (errmsg != null) { log.warning(errmsg + " [fqtid=" + fqTileId + ", x=" + tx + ", y=" + ty + "]."); } }
[ "public", "void", "updateBaseTile", "(", "int", "fqTileId", ",", "int", "tx", ",", "int", "ty", ")", "{", "String", "errmsg", "=", "null", ";", "int", "tidx", "=", "index", "(", "tx", ",", "ty", ")", ";", "// this is a bit magical: we pass the fully qualifie...
Informs this scene block that the specified base tile has been changed.
[ "Informs", "this", "scene", "block", "that", "the", "specified", "base", "tile", "has", "been", "changed", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L311-L340
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.updateFringe
public void updateFringe (int tx, int ty) { int tidx = index(tx, ty); if (_base[tidx] != null) { _fringe[tidx] = computeFringeTile(tx, ty); } }
java
public void updateFringe (int tx, int ty) { int tidx = index(tx, ty); if (_base[tidx] != null) { _fringe[tidx] = computeFringeTile(tx, ty); } }
[ "public", "void", "updateFringe", "(", "int", "tx", ",", "int", "ty", ")", "{", "int", "tidx", "=", "index", "(", "tx", ",", "ty", ")", ";", "if", "(", "_base", "[", "tidx", "]", "!=", "null", ")", "{", "_fringe", "[", "tidx", "]", "=", "comput...
Instructs this block to recompute its fringe at the specified location.
[ "Instructs", "this", "block", "to", "recompute", "its", "fringe", "at", "the", "specified", "location", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L346-L352
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.computeMemoryUsage
public void computeMemoryUsage (Map<Tile.Key,BaseTile> bases, Set<BaseTile> fringes, Map<Tile.Key,ObjectTile> objects, long[] usage) { // account for our base tiles for (int yy = 0; yy < _bounds.height; yy++) { for (int xx = 0; xx < _bounds.width; xx++) { int x = _bounds.x + xx, y = _bounds.y + yy; int tidx = index(x, y); BaseTile base = _base[tidx]; if (base == null) { continue; } BaseTile sbase = bases.get(base.key); if (sbase == null) { bases.put(base.key, base); usage[0] += base.getEstimatedMemoryUsage(); } else if (base != _base[tidx]) { log.warning("Multiple instances of same base tile " + "[base=" + base + ", x=" + xx + ", y=" + yy + "]."); usage[0] += base.getEstimatedMemoryUsage(); } // now account for the fringe if (_fringe[tidx] == null) { continue; } else if (!fringes.contains(_fringe[tidx])) { fringes.add(_fringe[tidx]); usage[1] += _fringe[tidx].getEstimatedMemoryUsage(); } } } // now get the object tiles int ocount = (_objects == null) ? 0 : _objects.length; for (int ii = 0; ii < ocount; ii++) { SceneObject scobj = _objects[ii]; ObjectTile tile = objects.get(scobj.tile.key); if (tile == null) { objects.put(scobj.tile.key, scobj.tile); usage[2] += scobj.tile.getEstimatedMemoryUsage(); } else if (tile != scobj.tile) { log.warning("Multiple instances of same object tile: " + scobj.info + "."); usage[2] += scobj.tile.getEstimatedMemoryUsage(); } } }
java
public void computeMemoryUsage (Map<Tile.Key,BaseTile> bases, Set<BaseTile> fringes, Map<Tile.Key,ObjectTile> objects, long[] usage) { // account for our base tiles for (int yy = 0; yy < _bounds.height; yy++) { for (int xx = 0; xx < _bounds.width; xx++) { int x = _bounds.x + xx, y = _bounds.y + yy; int tidx = index(x, y); BaseTile base = _base[tidx]; if (base == null) { continue; } BaseTile sbase = bases.get(base.key); if (sbase == null) { bases.put(base.key, base); usage[0] += base.getEstimatedMemoryUsage(); } else if (base != _base[tidx]) { log.warning("Multiple instances of same base tile " + "[base=" + base + ", x=" + xx + ", y=" + yy + "]."); usage[0] += base.getEstimatedMemoryUsage(); } // now account for the fringe if (_fringe[tidx] == null) { continue; } else if (!fringes.contains(_fringe[tidx])) { fringes.add(_fringe[tidx]); usage[1] += _fringe[tidx].getEstimatedMemoryUsage(); } } } // now get the object tiles int ocount = (_objects == null) ? 0 : _objects.length; for (int ii = 0; ii < ocount; ii++) { SceneObject scobj = _objects[ii]; ObjectTile tile = objects.get(scobj.tile.key); if (tile == null) { objects.put(scobj.tile.key, scobj.tile); usage[2] += scobj.tile.getEstimatedMemoryUsage(); } else if (tile != scobj.tile) { log.warning("Multiple instances of same object tile: " + scobj.info + "."); usage[2] += scobj.tile.getEstimatedMemoryUsage(); } } }
[ "public", "void", "computeMemoryUsage", "(", "Map", "<", "Tile", ".", "Key", ",", "BaseTile", ">", "bases", ",", "Set", "<", "BaseTile", ">", "fringes", ",", "Map", "<", "Tile", ".", "Key", ",", "ObjectTile", ">", "objects", ",", "long", "[", "]", "u...
Computes the memory usage of the base and object tiles in this scene block; registering counted tiles in the hash map so that other blocks can be sure not to double count them. Base tile usage is placed into the zeroth array element, fringe tile usage into the first and object tile usage into the second.
[ "Computes", "the", "memory", "usage", "of", "the", "base", "and", "object", "tiles", "in", "this", "scene", "block", ";", "registering", "counted", "tiles", "in", "the", "hash", "map", "so", "that", "other", "blocks", "can", "be", "sure", "not", "to", "d...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L435-L483
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.index
protected final int index (int tx, int ty) { // if (!_bounds.contains(tx, ty)) { // String errmsg = "Coordinates out of bounds: +" + tx + "+" + ty + // " not in " + StringUtil.toString(_bounds); // throw new IllegalArgumentException(errmsg); // } return (ty-_bounds.y)*_bounds.width + (tx-_bounds.x); }
java
protected final int index (int tx, int ty) { // if (!_bounds.contains(tx, ty)) { // String errmsg = "Coordinates out of bounds: +" + tx + "+" + ty + // " not in " + StringUtil.toString(_bounds); // throw new IllegalArgumentException(errmsg); // } return (ty-_bounds.y)*_bounds.width + (tx-_bounds.x); }
[ "protected", "final", "int", "index", "(", "int", "tx", ",", "int", "ty", ")", "{", "// if (!_bounds.contains(tx, ty)) {", "// String errmsg = \"Coordinates out of bounds: +\" + tx + \"+\" + ty +", "// \" not in \" + StringUtil.toString(_bounds);", "...
Returns the index into our arrays of the specified tile.
[ "Returns", "the", "index", "into", "our", "arrays", "of", "the", "specified", "tile", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L499-L507
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.update
protected void update (Map<Integer, SceneBlock> blocks) { boolean recover = false; // link up to our neighbors for (int ii = 0; ii < DX.length; ii++) { SceneBlock neigh = blocks.get(neighborKey(DX[ii], DY[ii])); if (neigh != _neighbors[ii]) { _neighbors[ii] = neigh; // if we're linking up to a neighbor for the first time; // we need to recalculate our coverage recover = recover || (neigh != null); // Log.info(this + " was introduced to " + neigh + "."); } } // if we need to regenerate the set of tiles covered by our // objects, do so if (recover) { for (SceneObject _object : _objects) { setCovered(blocks, _object); } } }
java
protected void update (Map<Integer, SceneBlock> blocks) { boolean recover = false; // link up to our neighbors for (int ii = 0; ii < DX.length; ii++) { SceneBlock neigh = blocks.get(neighborKey(DX[ii], DY[ii])); if (neigh != _neighbors[ii]) { _neighbors[ii] = neigh; // if we're linking up to a neighbor for the first time; // we need to recalculate our coverage recover = recover || (neigh != null); // Log.info(this + " was introduced to " + neigh + "."); } } // if we need to regenerate the set of tiles covered by our // objects, do so if (recover) { for (SceneObject _object : _objects) { setCovered(blocks, _object); } } }
[ "protected", "void", "update", "(", "Map", "<", "Integer", ",", "SceneBlock", ">", "blocks", ")", "{", "boolean", "recover", "=", "false", ";", "// link up to our neighbors", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "DX", ".", "length", ";", ...
Links this block to its neighbors; informs neighboring blocks of object coverage.
[ "Links", "this", "block", "to", "its", "neighbors", ";", "informs", "neighboring", "blocks", "of", "object", "coverage", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L513-L536
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.neighborKey
protected final int neighborKey (int dx, int dy) { int nx = MathUtil.floorDiv(_bounds.x, _bounds.width)+dx; int ny = MathUtil.floorDiv(_bounds.y, _bounds.height)+dy; return MisoScenePanel.compose(nx, ny); }
java
protected final int neighborKey (int dx, int dy) { int nx = MathUtil.floorDiv(_bounds.x, _bounds.width)+dx; int ny = MathUtil.floorDiv(_bounds.y, _bounds.height)+dy; return MisoScenePanel.compose(nx, ny); }
[ "protected", "final", "int", "neighborKey", "(", "int", "dx", ",", "int", "dy", ")", "{", "int", "nx", "=", "MathUtil", ".", "floorDiv", "(", "_bounds", ".", "x", ",", "_bounds", ".", "width", ")", "+", "dx", ";", "int", "ny", "=", "MathUtil", ".",...
Computes the key of our neighbor.
[ "Computes", "the", "key", "of", "our", "neighbor", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L539-L544
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.blockKey
protected final int blockKey (int tx, int ty) { int bx = MathUtil.floorDiv(tx, _bounds.width); int by = MathUtil.floorDiv(ty, _bounds.height); return MisoScenePanel.compose(bx, by); }
java
protected final int blockKey (int tx, int ty) { int bx = MathUtil.floorDiv(tx, _bounds.width); int by = MathUtil.floorDiv(ty, _bounds.height); return MisoScenePanel.compose(bx, by); }
[ "protected", "final", "int", "blockKey", "(", "int", "tx", ",", "int", "ty", ")", "{", "int", "bx", "=", "MathUtil", ".", "floorDiv", "(", "tx", ",", "_bounds", ".", "width", ")", ";", "int", "by", "=", "MathUtil", ".", "floorDiv", "(", "ty", ",", ...
Computes the key for the block that holds the specified tile.
[ "Computes", "the", "key", "for", "the", "block", "that", "holds", "the", "specified", "tile", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L547-L552
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneBlock.java
SceneBlock.setCovered
protected void setCovered (Map<Integer, SceneBlock> blocks, SceneObject scobj) { int endx = scobj.info.x - scobj.tile.getBaseWidth() + 1; int endy = scobj.info.y - scobj.tile.getBaseHeight() + 1; for (int xx = scobj.info.x; xx >= endx; xx--) { for (int yy = scobj.info.y; yy >= endy; yy--) { SceneBlock block = blocks.get(blockKey(xx, yy)); if (block != null) { block.setCovered(xx, yy); } } } // Log.info("Updated coverage " + scobj.info + "."); }
java
protected void setCovered (Map<Integer, SceneBlock> blocks, SceneObject scobj) { int endx = scobj.info.x - scobj.tile.getBaseWidth() + 1; int endy = scobj.info.y - scobj.tile.getBaseHeight() + 1; for (int xx = scobj.info.x; xx >= endx; xx--) { for (int yy = scobj.info.y; yy >= endy; yy--) { SceneBlock block = blocks.get(blockKey(xx, yy)); if (block != null) { block.setCovered(xx, yy); } } } // Log.info("Updated coverage " + scobj.info + "."); }
[ "protected", "void", "setCovered", "(", "Map", "<", "Integer", ",", "SceneBlock", ">", "blocks", ",", "SceneObject", "scobj", ")", "{", "int", "endx", "=", "scobj", ".", "info", ".", "x", "-", "scobj", ".", "tile", ".", "getBaseWidth", "(", ")", "+", ...
Sets the footprint of this object tile
[ "Sets", "the", "footprint", "of", "this", "object", "tile" ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L557-L572
train
groupon/robo-remote
RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/Solo.java
Solo.clearEditText
public static void clearEditText(String editText) throws Exception{ Client.getInstance().map(Constants.ROBOTIUM_SOLO, "clearEditText", editText); }
java
public static void clearEditText(String editText) throws Exception{ Client.getInstance().map(Constants.ROBOTIUM_SOLO, "clearEditText", editText); }
[ "public", "static", "void", "clearEditText", "(", "String", "editText", ")", "throws", "Exception", "{", "Client", ".", "getInstance", "(", ")", ".", "map", "(", "Constants", ".", "ROBOTIUM_SOLO", ",", "\"clearEditText\"", ",", "editText", ")", ";", "}" ]
Clears edit text for the specified widget @param editText - Identifier for the correct widget(ex: android.widget.EditText@409af0b0) - Can be found using getViews
[ "Clears", "edit", "text", "for", "the", "specified", "widget" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/Solo.java#L59-L61
train
groupon/robo-remote
RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/Solo.java
Solo.getLocationOnScreen
public static int[] getLocationOnScreen(String view) throws Exception { int[] location = new int[2]; JSONArray results = Client.getInstance().map(Constants.ROBOTIUM_SOLO, "getLocationOnScreen", view); location[0] = results.getInt(0); location[1] = results.getInt(1); return location; }
java
public static int[] getLocationOnScreen(String view) throws Exception { int[] location = new int[2]; JSONArray results = Client.getInstance().map(Constants.ROBOTIUM_SOLO, "getLocationOnScreen", view); location[0] = results.getInt(0); location[1] = results.getInt(1); return location; }
[ "public", "static", "int", "[", "]", "getLocationOnScreen", "(", "String", "view", ")", "throws", "Exception", "{", "int", "[", "]", "location", "=", "new", "int", "[", "2", "]", ";", "JSONArray", "results", "=", "Client", ".", "getInstance", "(", ")", ...
Get the location of a view on the screen @param view - string reference to the view @return - int array(x, y) of the view location @throws Exception
[ "Get", "the", "location", "of", "a", "view", "on", "the", "screen" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/Solo.java#L813-L821
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/TileOpApplicator.java
TileOpApplicator.applyToTiles
public void applyToTiles (Rectangle region, TileOp op) { // determine which tiles intersect this region: this is going to // be nearly incomprehensible without some sort of diagram; i'll // do what i can to comment it, but you'll want to print out a // scene diagram (docs/miso/scene.ps) and start making notes if // you want to follow along // obtain our upper left tile Point tpos = MisoUtil.screenToTile(_metrics, region.x, region.y, new Point()); // determine which quadrant of the upper left tile we occupy Point spos = MisoUtil.tileToScreen(_metrics, tpos.x, tpos.y, new Point()); boolean left = (region.x - spos.x < _metrics.tilehwid); boolean top = (region.y - spos.y < _metrics.tilehhei); // set up our tile position counters int dx, dy; if (left) { dx = 0; dy = 1; } else { dx = 1; dy = 0; } // if we're in the top-half of the tile we need to move up a row, // either forward or back depending on whether we're in the left // or right half of the tile if (top) { if (left) { tpos.x -= 1; } else { tpos.y -= 1; } // we'll need to start zig-zagging the other way as well dx = 1 - dx; dy = 1 - dy; } // these will bound our loops int rightx = region.x + region.width, bottomy = region.y + region.height; // Log.info("Preparing to apply [tpos=" + StringUtil.toString(tpos) + // ", left=" + left + ", top=" + top + // ", bounds=" + StringUtil.toString(bounds) + // ", spos=" + StringUtil.toString(spos) + // "]."); // obtain the coordinates of the tile that starts the first row // and loop through, applying to the intersecting tiles MisoUtil.tileToScreen(_metrics, tpos.x, tpos.y, spos); while (spos.y < bottomy) { // set up our row counters int tx = tpos.x, ty = tpos.y; _tbounds.x = spos.x; _tbounds.y = spos.y; // Log.info("Applying to row [tx=" + tx + ", ty=" + ty + "]."); // apply to the tiles in this row while (_tbounds.x < rightx) { op.apply(tx, ty, _tbounds); // move one tile to the right tx += 1; ty -= 1; _tbounds.x += _metrics.tilewid; } // update our tile coordinates tpos.x += dx; dx = 1 - dx; tpos.y += dy; dy = 1 - dy; // obtain the screen coordinates of the next starting tile MisoUtil.tileToScreen(_metrics, tpos.x, tpos.y, spos); } }
java
public void applyToTiles (Rectangle region, TileOp op) { // determine which tiles intersect this region: this is going to // be nearly incomprehensible without some sort of diagram; i'll // do what i can to comment it, but you'll want to print out a // scene diagram (docs/miso/scene.ps) and start making notes if // you want to follow along // obtain our upper left tile Point tpos = MisoUtil.screenToTile(_metrics, region.x, region.y, new Point()); // determine which quadrant of the upper left tile we occupy Point spos = MisoUtil.tileToScreen(_metrics, tpos.x, tpos.y, new Point()); boolean left = (region.x - spos.x < _metrics.tilehwid); boolean top = (region.y - spos.y < _metrics.tilehhei); // set up our tile position counters int dx, dy; if (left) { dx = 0; dy = 1; } else { dx = 1; dy = 0; } // if we're in the top-half of the tile we need to move up a row, // either forward or back depending on whether we're in the left // or right half of the tile if (top) { if (left) { tpos.x -= 1; } else { tpos.y -= 1; } // we'll need to start zig-zagging the other way as well dx = 1 - dx; dy = 1 - dy; } // these will bound our loops int rightx = region.x + region.width, bottomy = region.y + region.height; // Log.info("Preparing to apply [tpos=" + StringUtil.toString(tpos) + // ", left=" + left + ", top=" + top + // ", bounds=" + StringUtil.toString(bounds) + // ", spos=" + StringUtil.toString(spos) + // "]."); // obtain the coordinates of the tile that starts the first row // and loop through, applying to the intersecting tiles MisoUtil.tileToScreen(_metrics, tpos.x, tpos.y, spos); while (spos.y < bottomy) { // set up our row counters int tx = tpos.x, ty = tpos.y; _tbounds.x = spos.x; _tbounds.y = spos.y; // Log.info("Applying to row [tx=" + tx + ", ty=" + ty + "]."); // apply to the tiles in this row while (_tbounds.x < rightx) { op.apply(tx, ty, _tbounds); // move one tile to the right tx += 1; ty -= 1; _tbounds.x += _metrics.tilewid; } // update our tile coordinates tpos.x += dx; dx = 1 - dx; tpos.y += dy; dy = 1 - dy; // obtain the screen coordinates of the next starting tile MisoUtil.tileToScreen(_metrics, tpos.x, tpos.y, spos); } }
[ "public", "void", "applyToTiles", "(", "Rectangle", "region", ",", "TileOp", "op", ")", "{", "// determine which tiles intersect this region: this is going to", "// be nearly incomprehensible without some sort of diagram; i'll", "// do what i can to comment it, but you'll want to print out...
Applies the supplied tile operation to all tiles that intersect the supplied screen rectangle.
[ "Applies", "the", "supplied", "tile", "operation", "to", "all", "tiles", "that", "intersect", "the", "supplied", "screen", "rectangle", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/TileOpApplicator.java#L44-L123
train
jboss/jboss-jsp-api_spec
src/main/java/javax/servlet/jsp/tagext/TagSupport.java
TagSupport.findAncestorWithClass
public static final Tag findAncestorWithClass(Tag from, Class klass) { boolean isInterface = false; if (from == null || klass == null || (!Tag.class.isAssignableFrom(klass) && !(isInterface = klass.isInterface()))) { return null; } for (;;) { Tag tag = from.getParent(); if (tag == null) { return null; } if ((isInterface && klass.isInstance(tag)) || klass.isAssignableFrom(tag.getClass())) return tag; else from = tag; } }
java
public static final Tag findAncestorWithClass(Tag from, Class klass) { boolean isInterface = false; if (from == null || klass == null || (!Tag.class.isAssignableFrom(klass) && !(isInterface = klass.isInterface()))) { return null; } for (;;) { Tag tag = from.getParent(); if (tag == null) { return null; } if ((isInterface && klass.isInstance(tag)) || klass.isAssignableFrom(tag.getClass())) return tag; else from = tag; } }
[ "public", "static", "final", "Tag", "findAncestorWithClass", "(", "Tag", "from", ",", "Class", "klass", ")", "{", "boolean", "isInterface", "=", "false", ";", "if", "(", "from", "==", "null", "||", "klass", "==", "null", "||", "(", "!", "Tag", ".", "cl...
Find the instance of a given class type that is closest to a given instance. This method uses the getParent method from the Tag interface. This method is used for coordination among cooperating tags. <p> The current version of the specification only provides one formal way of indicating the observable type of a tag handler: its tag handler implementation class, described in the tag-class subelement of the tag element. This is extended in an informal manner by allowing the tag library author to indicate in the description subelement an observable type. The type should be a subtype of the tag handler implementation class or void. This addititional constraint can be exploited by a specialized container that knows about that specific tag library, as in the case of the JSP standard tag library. <p> When a tag library author provides information on the observable type of a tag handler, client programmatic code should adhere to that constraint. Specifically, the Class passed to findAncestorWithClass should be a subtype of the observable type. @param from The instance from where to start looking. @param klass The subclass of Tag or interface to be matched @return the nearest ancestor that implements the interface or is an instance of the class specified
[ "Find", "the", "instance", "of", "a", "given", "class", "type", "that", "is", "closest", "to", "a", "given", "instance", ".", "This", "method", "uses", "the", "getParent", "method", "from", "the", "Tag", "interface", ".", "This", "method", "is", "used", ...
da53166619f33a5134dc3315a3264990cc1f541f
https://github.com/jboss/jboss-jsp-api_spec/blob/da53166619f33a5134dc3315a3264990cc1f541f/src/main/java/javax/servlet/jsp/tagext/TagSupport.java#L113-L136
train
jboss/jboss-jsp-api_spec
src/main/java/javax/servlet/jsp/tagext/TagSupport.java
TagSupport.release
public void release() { parent = null; id = null; if( values != null ) { values.clear(); } values = null; }
java
public void release() { parent = null; id = null; if( values != null ) { values.clear(); } values = null; }
[ "public", "void", "release", "(", ")", "{", "parent", "=", "null", ";", "id", "=", "null", ";", "if", "(", "values", "!=", "null", ")", "{", "values", ".", "clear", "(", ")", ";", "}", "values", "=", "null", ";", "}" ]
Release state. @see Tag#release()
[ "Release", "state", "." ]
da53166619f33a5134dc3315a3264990cc1f541f
https://github.com/jboss/jboss-jsp-api_spec/blob/da53166619f33a5134dc3315a3264990cc1f541f/src/main/java/javax/servlet/jsp/tagext/TagSupport.java#L198-L205
train
jboss/jboss-jsp-api_spec
src/main/java/javax/servlet/jsp/tagext/TagSupport.java
TagSupport.setValue
public void setValue(String k, Object o) { if (values == null) { values = new Hashtable<String, Object>(); } values.put(k, o); }
java
public void setValue(String k, Object o) { if (values == null) { values = new Hashtable<String, Object>(); } values.put(k, o); }
[ "public", "void", "setValue", "(", "String", "k", ",", "Object", "o", ")", "{", "if", "(", "values", "==", "null", ")", "{", "values", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "}", "values", ".", "put", "(", "k",...
Associate a value with a String key. @param k The key String. @param o The value to associate.
[ "Associate", "a", "value", "with", "a", "String", "key", "." ]
da53166619f33a5134dc3315a3264990cc1f541f
https://github.com/jboss/jboss-jsp-api_spec/blob/da53166619f33a5134dc3315a3264990cc1f541f/src/main/java/javax/servlet/jsp/tagext/TagSupport.java#L267-L272
train
jboss/jboss-jsp-api_spec
src/main/java/javax/servlet/jsp/tagext/TagSupport.java
TagSupport.getValue
public Object getValue(String k) { if (values == null) { return null; } else { return values.get(k); } }
java
public Object getValue(String k) { if (values == null) { return null; } else { return values.get(k); } }
[ "public", "Object", "getValue", "(", "String", "k", ")", "{", "if", "(", "values", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "values", ".", "get", "(", "k", ")", ";", "}", "}" ]
Get a the value associated with a key. @param k The string key. @return The value associated with the key, or null.
[ "Get", "a", "the", "value", "associated", "with", "a", "key", "." ]
da53166619f33a5134dc3315a3264990cc1f541f
https://github.com/jboss/jboss-jsp-api_spec/blob/da53166619f33a5134dc3315a3264990cc1f541f/src/main/java/javax/servlet/jsp/tagext/TagSupport.java#L281-L287
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.getDirection
public static int getDirection ( MisoSceneMetrics metrics, int ax, int ay, int bx, int by) { Point afpos = new Point(), bfpos = new Point(); // convert screen coordinates to full coordinates to get both // tile coordinates and fine coordinates screenToFull(metrics, ax, ay, afpos); screenToFull(metrics, bx, by, bfpos); // pull out the tile coordinates for each point int tax = fullToTile(afpos.x); int tay = fullToTile(afpos.y); int tbx = fullToTile(bfpos.x); int tby = fullToTile(bfpos.y); // compare tile coordinates to determine direction int dir = getIsoDirection(tax, tay, tbx, tby); if (dir != DirectionCodes.NONE) { return dir; } // destination point is in the same tile as the // origination point, so consider fine coordinates // pull out the fine coordinates for each point int fax = afpos.x - (tax * FULL_TILE_FACTOR); int fay = afpos.y - (tay * FULL_TILE_FACTOR); int fbx = bfpos.x - (tbx * FULL_TILE_FACTOR); int fby = bfpos.y - (tby * FULL_TILE_FACTOR); // compare fine coordinates to determine direction dir = getIsoDirection(fax, fay, fbx, fby); // arbitrarily return southwest if fine coords were also equivalent return (dir == -1) ? SOUTHWEST : dir; }
java
public static int getDirection ( MisoSceneMetrics metrics, int ax, int ay, int bx, int by) { Point afpos = new Point(), bfpos = new Point(); // convert screen coordinates to full coordinates to get both // tile coordinates and fine coordinates screenToFull(metrics, ax, ay, afpos); screenToFull(metrics, bx, by, bfpos); // pull out the tile coordinates for each point int tax = fullToTile(afpos.x); int tay = fullToTile(afpos.y); int tbx = fullToTile(bfpos.x); int tby = fullToTile(bfpos.y); // compare tile coordinates to determine direction int dir = getIsoDirection(tax, tay, tbx, tby); if (dir != DirectionCodes.NONE) { return dir; } // destination point is in the same tile as the // origination point, so consider fine coordinates // pull out the fine coordinates for each point int fax = afpos.x - (tax * FULL_TILE_FACTOR); int fay = afpos.y - (tay * FULL_TILE_FACTOR); int fbx = bfpos.x - (tbx * FULL_TILE_FACTOR); int fby = bfpos.y - (tby * FULL_TILE_FACTOR); // compare fine coordinates to determine direction dir = getIsoDirection(fax, fay, fbx, fby); // arbitrarily return southwest if fine coords were also equivalent return (dir == -1) ? SOUTHWEST : dir; }
[ "public", "static", "int", "getDirection", "(", "MisoSceneMetrics", "metrics", ",", "int", "ax", ",", "int", "ay", ",", "int", "bx", ",", "int", "by", ")", "{", "Point", "afpos", "=", "new", "Point", "(", ")", ",", "bfpos", "=", "new", "Point", "(", ...
Given two points in screen pixel coordinates, return the compass direction that point B lies in from point A from an isometric perspective. @param ax the x-position of point A. @param ay the y-position of point A. @param bx the x-position of point B. @param by the y-position of point B. @return the direction specified as one of the <code>Sprite</code> class's direction constants.
[ "Given", "two", "points", "in", "screen", "pixel", "coordinates", "return", "the", "compass", "direction", "that", "point", "B", "lies", "in", "from", "point", "A", "from", "an", "isometric", "perspective", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L51-L89
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.getProjectedIsoDirection
public static int getProjectedIsoDirection (int ax, int ay, int bx, int by) { return toIsoDirection(DirectionUtil.getDirection(ax, ay, bx, by)); }
java
public static int getProjectedIsoDirection (int ax, int ay, int bx, int by) { return toIsoDirection(DirectionUtil.getDirection(ax, ay, bx, by)); }
[ "public", "static", "int", "getProjectedIsoDirection", "(", "int", "ax", ",", "int", "ay", ",", "int", "bx", ",", "int", "by", ")", "{", "return", "toIsoDirection", "(", "DirectionUtil", ".", "getDirection", "(", "ax", ",", "ay", ",", "bx", ",", "by", ...
Given two points in screen coordinates, return the isometrically projected compass direction that point B lies in from point A. @param ax the x-position of point A. @param ay the y-position of point A. @param bx the x-position of point B. @param by the y-position of point B. @return the direction specified as one of the <code>Sprite</code> class's direction constants, or <code>DirectionCodes.NONE</code> if point B is equivalent to point A.
[ "Given", "two", "points", "in", "screen", "coordinates", "return", "the", "isometrically", "projected", "compass", "direction", "that", "point", "B", "lies", "in", "from", "point", "A", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L149-L152
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.screenToTile
public static Point screenToTile ( MisoSceneMetrics metrics, int sx, int sy, Point tpos) { // determine the upper-left of the quadrant that contains our point int zx = (int)Math.floor((float)sx / metrics.tilewid); int zy = (int)Math.floor((float)sy / metrics.tilehei); // these are the screen coordinates of the tile's top int ox = (zx * metrics.tilewid), oy = (zy * metrics.tilehei); // these are the tile coordinates tpos.x = zy + zx; tpos.y = zy - zx; // now determine which of the four tiles our point occupies int dx = sx - ox, dy = sy - oy; if (Math.round(metrics.slopeY * dx + metrics.tilehei) <= dy) { tpos.x += 1; } if (Math.round(metrics.slopeX * dx) > dy) { tpos.y -= 1; } // Log.info("Converted [sx=" + sx + ", sy=" + sy + // ", zx=" + zx + ", zy=" + zy + // ", ox=" + ox + ", oy=" + oy + // ", dx=" + dx + ", dy=" + dy + // ", tpos.x=" + tpos.x + ", tpos.y=" + tpos.y + "]."); return tpos; }
java
public static Point screenToTile ( MisoSceneMetrics metrics, int sx, int sy, Point tpos) { // determine the upper-left of the quadrant that contains our point int zx = (int)Math.floor((float)sx / metrics.tilewid); int zy = (int)Math.floor((float)sy / metrics.tilehei); // these are the screen coordinates of the tile's top int ox = (zx * metrics.tilewid), oy = (zy * metrics.tilehei); // these are the tile coordinates tpos.x = zy + zx; tpos.y = zy - zx; // now determine which of the four tiles our point occupies int dx = sx - ox, dy = sy - oy; if (Math.round(metrics.slopeY * dx + metrics.tilehei) <= dy) { tpos.x += 1; } if (Math.round(metrics.slopeX * dx) > dy) { tpos.y -= 1; } // Log.info("Converted [sx=" + sx + ", sy=" + sy + // ", zx=" + zx + ", zy=" + zy + // ", ox=" + ox + ", oy=" + oy + // ", dx=" + dx + ", dy=" + dy + // ", tpos.x=" + tpos.x + ", tpos.y=" + tpos.y + "]."); return tpos; }
[ "public", "static", "Point", "screenToTile", "(", "MisoSceneMetrics", "metrics", ",", "int", "sx", ",", "int", "sy", ",", "Point", "tpos", ")", "{", "// determine the upper-left of the quadrant that contains our point", "int", "zx", "=", "(", "int", ")", "Math", "...
Convert the given screen-based pixel coordinates to their corresponding tile-based coordinates. Converted coordinates are placed in the given point object. @param sx the screen x-position pixel coordinate. @param sy the screen y-position pixel coordinate. @param tpos the point object to place coordinates in. @return the point instance supplied via the <code>tpos</code> parameter.
[ "Convert", "the", "given", "screen", "-", "based", "pixel", "coordinates", "to", "their", "corresponding", "tile", "-", "based", "coordinates", ".", "Converted", "coordinates", "are", "placed", "in", "the", "given", "point", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L197-L227
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.tileToScreen
public static Point tileToScreen ( MisoSceneMetrics metrics, int x, int y, Point spos) { spos.x = (x - y - 1) * metrics.tilehwid; spos.y = (x + y) * metrics.tilehhei; return spos; }
java
public static Point tileToScreen ( MisoSceneMetrics metrics, int x, int y, Point spos) { spos.x = (x - y - 1) * metrics.tilehwid; spos.y = (x + y) * metrics.tilehhei; return spos; }
[ "public", "static", "Point", "tileToScreen", "(", "MisoSceneMetrics", "metrics", ",", "int", "x", ",", "int", "y", ",", "Point", "spos", ")", "{", "spos", ".", "x", "=", "(", "x", "-", "y", "-", "1", ")", "*", "metrics", ".", "tilehwid", ";", "spos...
Convert the given tile-based coordinates to their corresponding screen-based pixel coordinates. The screen coordinate for a tile is the upper-left coordinate of the rectangle that bounds the tile polygon. Converted coordinates are placed in the given point object. @param x the tile x-position coordinate. @param y the tile y-position coordinate. @param spos the point object to place coordinates in. @return the point instance supplied via the <code>spos</code> parameter.
[ "Convert", "the", "given", "tile", "-", "based", "coordinates", "to", "their", "corresponding", "screen", "-", "based", "pixel", "coordinates", ".", "The", "screen", "coordinate", "for", "a", "tile", "is", "the", "upper", "-", "left", "coordinate", "of", "th...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L243-L249
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.fineToPixel
public static void fineToPixel ( MisoSceneMetrics metrics, int x, int y, Point ppos) { ppos.x = metrics.tilehwid + ((x - y) * metrics.finehwid); ppos.y = (x + y) * metrics.finehhei; }
java
public static void fineToPixel ( MisoSceneMetrics metrics, int x, int y, Point ppos) { ppos.x = metrics.tilehwid + ((x - y) * metrics.finehwid); ppos.y = (x + y) * metrics.finehhei; }
[ "public", "static", "void", "fineToPixel", "(", "MisoSceneMetrics", "metrics", ",", "int", "x", ",", "int", "y", ",", "Point", "ppos", ")", "{", "ppos", ".", "x", "=", "metrics", ".", "tilehwid", "+", "(", "(", "x", "-", "y", ")", "*", "metrics", "...
Convert the given fine coordinates to pixel coordinates within the containing tile. Converted coordinates are placed in the given point object. @param x the x-position fine coordinate. @param y the y-position fine coordinate. @param ppos the point object to place coordinates in.
[ "Convert", "the", "given", "fine", "coordinates", "to", "pixel", "coordinates", "within", "the", "containing", "tile", ".", "Converted", "coordinates", "are", "placed", "in", "the", "given", "point", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L260-L265
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.pixelToFine
public static void pixelToFine ( MisoSceneMetrics metrics, int x, int y, Point fpos) { // calculate line parallel to the y-axis (from the given // x/y-pos to the x-axis) float bY = y - (metrics.fineSlopeY * x); // determine intersection of x- and y-axis lines int crossx = (int)((bY - metrics.fineBX) / (metrics.fineSlopeX - metrics.fineSlopeY)); int crossy = (int)((metrics.fineSlopeY * crossx) + bY); // TODO: final position should check distance between our // position and the surrounding fine coords and return the // actual closest fine coord, rather than just dividing. // determine distance along the x-axis float xdist = MathUtil.distance(metrics.tilehwid, 0, crossx, crossy); fpos.x = (int)(xdist / metrics.finelen); // determine distance along the y-axis float ydist = MathUtil.distance(x, y, crossx, crossy); fpos.y = (int)(ydist / metrics.finelen); // Log.info("Pixel to fine " + StringUtil.coordsToString(x, y) + // " -> " + StringUtil.toString(fpos) + "."); }
java
public static void pixelToFine ( MisoSceneMetrics metrics, int x, int y, Point fpos) { // calculate line parallel to the y-axis (from the given // x/y-pos to the x-axis) float bY = y - (metrics.fineSlopeY * x); // determine intersection of x- and y-axis lines int crossx = (int)((bY - metrics.fineBX) / (metrics.fineSlopeX - metrics.fineSlopeY)); int crossy = (int)((metrics.fineSlopeY * crossx) + bY); // TODO: final position should check distance between our // position and the surrounding fine coords and return the // actual closest fine coord, rather than just dividing. // determine distance along the x-axis float xdist = MathUtil.distance(metrics.tilehwid, 0, crossx, crossy); fpos.x = (int)(xdist / metrics.finelen); // determine distance along the y-axis float ydist = MathUtil.distance(x, y, crossx, crossy); fpos.y = (int)(ydist / metrics.finelen); // Log.info("Pixel to fine " + StringUtil.coordsToString(x, y) + // " -> " + StringUtil.toString(fpos) + "."); }
[ "public", "static", "void", "pixelToFine", "(", "MisoSceneMetrics", "metrics", ",", "int", "x", ",", "int", "y", ",", "Point", "fpos", ")", "{", "// calculate line parallel to the y-axis (from the given", "// x/y-pos to the x-axis)", "float", "bY", "=", "y", "-", "(...
Convert the given pixel coordinates, whose origin is at the top-left of a tile's containing rectangle, to fine coordinates within that tile. Converted coordinates are placed in the given point object. @param x the x-position pixel coordinate. @param y the y-position pixel coordinate. @param fpos the point object to place coordinates in.
[ "Convert", "the", "given", "pixel", "coordinates", "whose", "origin", "is", "at", "the", "top", "-", "left", "of", "a", "tile", "s", "containing", "rectangle", "to", "fine", "coordinates", "within", "that", "tile", ".", "Converted", "coordinates", "are", "pl...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L277-L303
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.screenToFull
public static Point screenToFull ( MisoSceneMetrics metrics, int sx, int sy, Point fpos) { // get the tile coordinates Point tpos = new Point(); screenToTile(metrics, sx, sy, tpos); // get the screen coordinates for the containing tile Point spos = tileToScreen(metrics, tpos.x, tpos.y, new Point()); // Log.info("Screen to full " + // "[screen=" + StringUtil.coordsToString(sx, sy) + // ", tpos=" + StringUtil.toString(tpos) + // ", spos=" + StringUtil.toString(spos) + // ", fpix=" + StringUtil.coordsToString( // sx-spos.x, sy-spos.y) + "]."); // get the fine coordinates within the containing tile pixelToFine(metrics, sx - spos.x, sy - spos.y, fpos); // toss in the tile coordinates for good measure fpos.x += (tpos.x * FULL_TILE_FACTOR); fpos.y += (tpos.y * FULL_TILE_FACTOR); return fpos; }
java
public static Point screenToFull ( MisoSceneMetrics metrics, int sx, int sy, Point fpos) { // get the tile coordinates Point tpos = new Point(); screenToTile(metrics, sx, sy, tpos); // get the screen coordinates for the containing tile Point spos = tileToScreen(metrics, tpos.x, tpos.y, new Point()); // Log.info("Screen to full " + // "[screen=" + StringUtil.coordsToString(sx, sy) + // ", tpos=" + StringUtil.toString(tpos) + // ", spos=" + StringUtil.toString(spos) + // ", fpix=" + StringUtil.coordsToString( // sx-spos.x, sy-spos.y) + "]."); // get the fine coordinates within the containing tile pixelToFine(metrics, sx - spos.x, sy - spos.y, fpos); // toss in the tile coordinates for good measure fpos.x += (tpos.x * FULL_TILE_FACTOR); fpos.y += (tpos.y * FULL_TILE_FACTOR); return fpos; }
[ "public", "static", "Point", "screenToFull", "(", "MisoSceneMetrics", "metrics", ",", "int", "sx", ",", "int", "sy", ",", "Point", "fpos", ")", "{", "// get the tile coordinates", "Point", "tpos", "=", "new", "Point", "(", ")", ";", "screenToTile", "(", "met...
Convert the given screen-based pixel coordinates to full scene-based coordinates that include both the tile coordinates and the fine coordinates in each dimension. Converted coordinates are placed in the given point object. @param sx the screen x-position pixel coordinate. @param sy the screen y-position pixel coordinate. @param fpos the point object to place coordinates in. @return the point passed in to receive the coordinates.
[ "Convert", "the", "given", "screen", "-", "based", "pixel", "coordinates", "to", "full", "scene", "-", "based", "coordinates", "that", "include", "both", "the", "tile", "coordinates", "and", "the", "fine", "coordinates", "in", "each", "dimension", ".", "Conver...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L317-L342
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.fullToScreen
public static Point fullToScreen ( MisoSceneMetrics metrics, int x, int y, Point spos) { // get the tile screen position int tx = fullToTile(x), ty = fullToTile(y); Point tspos = tileToScreen(metrics, tx, ty, new Point()); // get the pixel position of the fine coords within the tile Point ppos = new Point(); int fx = x - (tx * FULL_TILE_FACTOR), fy = y - (ty * FULL_TILE_FACTOR); fineToPixel(metrics, fx, fy, ppos); // final position is tile position offset by fine position spos.x = tspos.x + ppos.x; spos.y = tspos.y + ppos.y; return spos; }
java
public static Point fullToScreen ( MisoSceneMetrics metrics, int x, int y, Point spos) { // get the tile screen position int tx = fullToTile(x), ty = fullToTile(y); Point tspos = tileToScreen(metrics, tx, ty, new Point()); // get the pixel position of the fine coords within the tile Point ppos = new Point(); int fx = x - (tx * FULL_TILE_FACTOR), fy = y - (ty * FULL_TILE_FACTOR); fineToPixel(metrics, fx, fy, ppos); // final position is tile position offset by fine position spos.x = tspos.x + ppos.x; spos.y = tspos.y + ppos.y; return spos; }
[ "public", "static", "Point", "fullToScreen", "(", "MisoSceneMetrics", "metrics", ",", "int", "x", ",", "int", "y", ",", "Point", "spos", ")", "{", "// get the tile screen position", "int", "tx", "=", "fullToTile", "(", "x", ")", ",", "ty", "=", "fullToTile",...
Convert the given full coordinates to screen-based pixel coordinates. Converted coordinates are placed in the given point object. @param x the x-position full coordinate. @param y the y-position full coordinate. @param spos the point object to place coordinates in. @return the point passed in to receive the coordinates.
[ "Convert", "the", "given", "full", "coordinates", "to", "screen", "-", "based", "pixel", "coordinates", ".", "Converted", "coordinates", "are", "placed", "in", "the", "given", "point", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L355-L372
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.getTilePolygon
public static Polygon getTilePolygon ( MisoSceneMetrics metrics, int x, int y) { return getFootprintPolygon(metrics, x, y, 1, 1); }
java
public static Polygon getTilePolygon ( MisoSceneMetrics metrics, int x, int y) { return getFootprintPolygon(metrics, x, y, 1, 1); }
[ "public", "static", "Polygon", "getTilePolygon", "(", "MisoSceneMetrics", "metrics", ",", "int", "x", ",", "int", "y", ")", "{", "return", "getFootprintPolygon", "(", "metrics", ",", "x", ",", "y", ",", "1", ",", "1", ")", ";", "}" ]
Return a polygon framing the specified tile. @param x the tile x-position coordinate. @param y the tile y-position coordinate.
[ "Return", "a", "polygon", "framing", "the", "specified", "tile", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L407-L411
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.getMultiTilePolygon
public static Polygon getMultiTilePolygon (MisoSceneMetrics metrics, Point sp1, Point sp2) { int x = Math.min(sp1.x, sp2.x), y = Math.min(sp1.y, sp2.y); int width = Math.abs(sp1.x-sp2.x)+1, height = Math.abs(sp1.y-sp2.y)+1; return getFootprintPolygon(metrics, x, y, width, height); }
java
public static Polygon getMultiTilePolygon (MisoSceneMetrics metrics, Point sp1, Point sp2) { int x = Math.min(sp1.x, sp2.x), y = Math.min(sp1.y, sp2.y); int width = Math.abs(sp1.x-sp2.x)+1, height = Math.abs(sp1.y-sp2.y)+1; return getFootprintPolygon(metrics, x, y, width, height); }
[ "public", "static", "Polygon", "getMultiTilePolygon", "(", "MisoSceneMetrics", "metrics", ",", "Point", "sp1", ",", "Point", "sp2", ")", "{", "int", "x", "=", "Math", ".", "min", "(", "sp1", ".", "x", ",", "sp2", ".", "x", ")", ",", "y", "=", "Math",...
Return a screen-coordinates polygon framing the two specified tile-coordinate points.
[ "Return", "a", "screen", "-", "coordinates", "polygon", "framing", "the", "two", "specified", "tile", "-", "coordinate", "points", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L417-L423
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.getFootprintPolygon
public static Polygon getFootprintPolygon ( MisoSceneMetrics metrics, int x, int y, int width, int height) { SmartPolygon footprint = new SmartPolygon(); Point tpos = MisoUtil.tileToScreen(metrics, x, y, new Point()); // start with top-center point int rx = tpos.x + metrics.tilehwid, ry = tpos.y; footprint.addPoint(rx, ry); // right point rx += width * metrics.tilehwid; ry += width * metrics.tilehhei; footprint.addPoint(rx, ry); // bottom-center point rx -= height * metrics.tilehwid; ry += height * metrics.tilehhei; footprint.addPoint(rx, ry); // left point rx -= width * metrics.tilehwid; ry -= width * metrics.tilehhei; footprint.addPoint(rx, ry); // end with top-center point rx += height * metrics.tilehwid; ry -= height * metrics.tilehhei; footprint.addPoint(rx, ry); return footprint; }
java
public static Polygon getFootprintPolygon ( MisoSceneMetrics metrics, int x, int y, int width, int height) { SmartPolygon footprint = new SmartPolygon(); Point tpos = MisoUtil.tileToScreen(metrics, x, y, new Point()); // start with top-center point int rx = tpos.x + metrics.tilehwid, ry = tpos.y; footprint.addPoint(rx, ry); // right point rx += width * metrics.tilehwid; ry += width * metrics.tilehhei; footprint.addPoint(rx, ry); // bottom-center point rx -= height * metrics.tilehwid; ry += height * metrics.tilehhei; footprint.addPoint(rx, ry); // left point rx -= width * metrics.tilehwid; ry -= width * metrics.tilehhei; footprint.addPoint(rx, ry); // end with top-center point rx += height * metrics.tilehwid; ry -= height * metrics.tilehhei; footprint.addPoint(rx, ry); return footprint; }
[ "public", "static", "Polygon", "getFootprintPolygon", "(", "MisoSceneMetrics", "metrics", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "SmartPolygon", "footprint", "=", "new", "SmartPolygon", "(", ")", ";", "Point", ...
Returns a polygon framing the specified scene footprint. @param x the x tile coordinate of the "upper-left" of the footprint. @param y the y tile coordinate of the "upper-left" of the footprint. @param width the width in tiles of the footprint. @param height the height in tiles of the footprint.
[ "Returns", "a", "polygon", "framing", "the", "specified", "scene", "footprint", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L433-L460
train
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.tilePlusFineToFull
public static Point tilePlusFineToFull (MisoSceneMetrics metrics, int tileX, int tileY, int fineX, int fineY, Point full) { int dtx = fineX / metrics.finegran; int dty = fineY / metrics.finegran; int fx = fineX - dtx * metrics.finegran; if (fx < 0) { dtx--; fx += metrics.finegran; } int fy = fineY - dty * metrics.finegran; if (fy < 0) { dty--; fy += metrics.finegran; } full.x = toFull(tileX + dtx, fx); full.y = toFull(tileY + dty, fy); return full; }
java
public static Point tilePlusFineToFull (MisoSceneMetrics metrics, int tileX, int tileY, int fineX, int fineY, Point full) { int dtx = fineX / metrics.finegran; int dty = fineY / metrics.finegran; int fx = fineX - dtx * metrics.finegran; if (fx < 0) { dtx--; fx += metrics.finegran; } int fy = fineY - dty * metrics.finegran; if (fy < 0) { dty--; fy += metrics.finegran; } full.x = toFull(tileX + dtx, fx); full.y = toFull(tileY + dty, fy); return full; }
[ "public", "static", "Point", "tilePlusFineToFull", "(", "MisoSceneMetrics", "metrics", ",", "int", "tileX", ",", "int", "tileY", ",", "int", "fineX", ",", "int", "fineY", ",", "Point", "full", ")", "{", "int", "dtx", "=", "fineX", "/", "metrics", ".", "f...
Adds the supplied fine coordinates to the supplied tile coordinates to compute full coordinates. @return the point object supplied as <code>full</code>.
[ "Adds", "the", "supplied", "fine", "coordinates", "to", "the", "supplied", "tile", "coordinates", "to", "compute", "full", "coordinates", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L468-L489
train
groupon/robo-remote
RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/Client.java
Client.getInstance
public static Client getInstance() { if(instance == null) { instance = new Client(); } instance.API_PORT = PortSingleton.getInstance().getPort(); return instance; }
java
public static Client getInstance() { if(instance == null) { instance = new Client(); } instance.API_PORT = PortSingleton.getInstance().getPort(); return instance; }
[ "public", "static", "Client", "getInstance", "(", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "new", "Client", "(", ")", ";", "}", "instance", ".", "API_PORT", "=", "PortSingleton", ".", "getInstance", "(", ")", ".", "getP...
Gets a client instance on the roboremote port @return
[ "Gets", "a", "client", "instance", "on", "the", "roboremote", "port" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClient/src/main/com/groupon/roboremote/roboremoteclient/Client.java#L42-L49
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.clearBubbles
protected void clearBubbles (boolean all) { for (Iterator<BubbleGlyph> iter = _bubbles.iterator(); iter.hasNext();) { ChatGlyph rec = iter.next(); if (all || isPlaceOrientedType(rec.getType())) { _target.abortAnimation(rec); iter.remove(); } } }
java
protected void clearBubbles (boolean all) { for (Iterator<BubbleGlyph> iter = _bubbles.iterator(); iter.hasNext();) { ChatGlyph rec = iter.next(); if (all || isPlaceOrientedType(rec.getType())) { _target.abortAnimation(rec); iter.remove(); } } }
[ "protected", "void", "clearBubbles", "(", "boolean", "all", ")", "{", "for", "(", "Iterator", "<", "BubbleGlyph", ">", "iter", "=", "_bubbles", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "ChatGlyph", "rec", "=", ...
Clear chat bubbles, either all of them or just the place-oriented ones.
[ "Clear", "chat", "bubbles", "either", "all", "of", "them", "or", "just", "the", "place", "-", "oriented", "ones", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L143-L152
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.splitNear
protected String splitNear (String text, int pos) { if (pos >= text.length()) { return text; } int forward = text.indexOf(' ', pos); int backward = text.lastIndexOf(' ', pos); int newpos = (Math.abs(pos - forward) < Math.abs(pos - backward)) ? forward : backward; // if we couldn't find a decent place to split, just do it wherever if (newpos == -1) { newpos = pos; } else { // actually split the space onto the first part newpos++; } return text.substring(0, newpos); }
java
protected String splitNear (String text, int pos) { if (pos >= text.length()) { return text; } int forward = text.indexOf(' ', pos); int backward = text.lastIndexOf(' ', pos); int newpos = (Math.abs(pos - forward) < Math.abs(pos - backward)) ? forward : backward; // if we couldn't find a decent place to split, just do it wherever if (newpos == -1) { newpos = pos; } else { // actually split the space onto the first part newpos++; } return text.substring(0, newpos); }
[ "protected", "String", "splitNear", "(", "String", "text", ",", "int", "pos", ")", "{", "if", "(", "pos", ">=", "text", ".", "length", "(", ")", ")", "{", "return", "text", ";", "}", "int", "forward", "=", "text", ".", "indexOf", "(", "'", "'", "...
Split the text at the space nearest the specified location.
[ "Split", "the", "text", "at", "the", "space", "nearest", "the", "specified", "location", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L242-L262
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.adjustLabel
protected Point adjustLabel (int type, Point labelpos) { switch (ChatLogic.modeOf(type)) { case ChatLogic.SHOUT: case ChatLogic.EMOTE: case ChatLogic.THINK: labelpos.translate(PAD * 2, PAD * 2); break; default: labelpos.translate(PAD, PAD); break; } return labelpos; }
java
protected Point adjustLabel (int type, Point labelpos) { switch (ChatLogic.modeOf(type)) { case ChatLogic.SHOUT: case ChatLogic.EMOTE: case ChatLogic.THINK: labelpos.translate(PAD * 2, PAD * 2); break; default: labelpos.translate(PAD, PAD); break; } return labelpos; }
[ "protected", "Point", "adjustLabel", "(", "int", "type", ",", "Point", "labelpos", ")", "{", "switch", "(", "ChatLogic", ".", "modeOf", "(", "type", ")", ")", "{", "case", "ChatLogic", ".", "SHOUT", ":", "case", "ChatLogic", ".", "EMOTE", ":", "case", ...
Position the label based on the type.
[ "Position", "the", "label", "based", "on", "the", "type", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L385-L400
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.getRectWithOlds
protected Rectangle getRectWithOlds (Rectangle r, List<BubbleGlyph> oldbubs) { int n = oldbubs.size(); // if no old bubs, just return the new one. if (n == 0) { return r; } // otherwise, encompass all the oldies Rectangle bigR = null; for (int ii=0; ii < n; ii++) { BubbleGlyph bub = oldbubs.get(ii); if (ii == 0) { bigR = bub.getBubbleBounds(); } else { bigR = bigR.union(bub.getBubbleBounds()); } } // and add space for the new boy bigR.width = Math.max(bigR.width, r.width); bigR.height += r.height; return bigR; }
java
protected Rectangle getRectWithOlds (Rectangle r, List<BubbleGlyph> oldbubs) { int n = oldbubs.size(); // if no old bubs, just return the new one. if (n == 0) { return r; } // otherwise, encompass all the oldies Rectangle bigR = null; for (int ii=0; ii < n; ii++) { BubbleGlyph bub = oldbubs.get(ii); if (ii == 0) { bigR = bub.getBubbleBounds(); } else { bigR = bigR.union(bub.getBubbleBounds()); } } // and add space for the new boy bigR.width = Math.max(bigR.width, r.width); bigR.height += r.height; return bigR; }
[ "protected", "Rectangle", "getRectWithOlds", "(", "Rectangle", "r", ",", "List", "<", "BubbleGlyph", ">", "oldbubs", ")", "{", "int", "n", "=", "oldbubs", ".", "size", "(", ")", ";", "// if no old bubs, just return the new one.", "if", "(", "n", "==", "0", "...
Get a rectangle based on the old bubbles, but with room for the new one.
[ "Get", "a", "rectangle", "based", "on", "the", "old", "bubbles", "but", "with", "room", "for", "the", "new", "one", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L439-L463
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.getTail
protected Shape getTail (int type, Rectangle r, Point speaker) { // emotes don't actually have tails if (ChatLogic.modeOf(type) == ChatLogic.EMOTE) { return new Area(); // empty shape } int midx = r.x + (r.width / 2); int midy = r.y + (r.height / 2); // we actually want to start about SPEAKER_DISTANCE away from the // speaker int xx = speaker.x - midx; int yy = speaker.y - midy; float dist = (float) Math.sqrt(xx * xx + yy * yy); float perc = (dist - SPEAKER_DISTANCE) / dist; if (ChatLogic.modeOf(type) == ChatLogic.THINK) { int steps = Math.max((int) (dist / SPEAKER_DISTANCE), 2); float step = perc / steps; Area a = new Area(); for (int ii=0; ii < steps; ii++, perc -= step) { int radius = Math.min(SPEAKER_DISTANCE / 2 - 1, ii + 2); a.add(new Area(new Ellipse2D.Float( (int) ((1 - perc) * midx + perc * speaker.x) + perc * radius, (int) ((1 - perc) * midy + perc * speaker.y) + perc * radius, radius * 2, radius * 2))); } return a; } // ELSE draw a triangular tail shape Polygon p = new Polygon(); p.addPoint((int) ((1 - perc) * midx + perc * speaker.x), (int) ((1 - perc) * midy + perc * speaker.y)); if (Math.abs(speaker.x - midx) > Math.abs(speaker.y - midy)) { int x; if (midx > speaker.x) { x = r.x + PAD; } else { x = r.x + r.width - PAD; } p.addPoint(x, midy - (TAIL_WIDTH / 2)); p.addPoint(x, midy + (TAIL_WIDTH / 2)); } else { int y; if (midy > speaker.y) { y = r.y + PAD; } else { y = r.y + r.height - PAD; } p.addPoint(midx - (TAIL_WIDTH / 2), y); p.addPoint(midx + (TAIL_WIDTH / 2), y); } return p; }
java
protected Shape getTail (int type, Rectangle r, Point speaker) { // emotes don't actually have tails if (ChatLogic.modeOf(type) == ChatLogic.EMOTE) { return new Area(); // empty shape } int midx = r.x + (r.width / 2); int midy = r.y + (r.height / 2); // we actually want to start about SPEAKER_DISTANCE away from the // speaker int xx = speaker.x - midx; int yy = speaker.y - midy; float dist = (float) Math.sqrt(xx * xx + yy * yy); float perc = (dist - SPEAKER_DISTANCE) / dist; if (ChatLogic.modeOf(type) == ChatLogic.THINK) { int steps = Math.max((int) (dist / SPEAKER_DISTANCE), 2); float step = perc / steps; Area a = new Area(); for (int ii=0; ii < steps; ii++, perc -= step) { int radius = Math.min(SPEAKER_DISTANCE / 2 - 1, ii + 2); a.add(new Area(new Ellipse2D.Float( (int) ((1 - perc) * midx + perc * speaker.x) + perc * radius, (int) ((1 - perc) * midy + perc * speaker.y) + perc * radius, radius * 2, radius * 2))); } return a; } // ELSE draw a triangular tail shape Polygon p = new Polygon(); p.addPoint((int) ((1 - perc) * midx + perc * speaker.x), (int) ((1 - perc) * midy + perc * speaker.y)); if (Math.abs(speaker.x - midx) > Math.abs(speaker.y - midy)) { int x; if (midx > speaker.x) { x = r.x + PAD; } else { x = r.x + r.width - PAD; } p.addPoint(x, midy - (TAIL_WIDTH / 2)); p.addPoint(x, midy + (TAIL_WIDTH / 2)); } else { int y; if (midy > speaker.y) { y = r.y + PAD; } else { y = r.y + r.height - PAD; } p.addPoint(midx - (TAIL_WIDTH / 2), y); p.addPoint(midx + (TAIL_WIDTH / 2), y); } return p; }
[ "protected", "Shape", "getTail", "(", "int", "type", ",", "Rectangle", "r", ",", "Point", "speaker", ")", "{", "// emotes don't actually have tails", "if", "(", "ChatLogic", ".", "modeOf", "(", "type", ")", "==", "ChatLogic", ".", "EMOTE", ")", "{", "return"...
Create a tail to the specified rectangular area from the speaker point.
[ "Create", "a", "tail", "to", "the", "specified", "rectangular", "area", "from", "the", "speaker", "point", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L625-L684
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.getAndExpireBubbles
protected List<BubbleGlyph> getAndExpireBubbles (Name speaker) { int num = _bubbles.size(); // first, get all the old bubbles belonging to the user List<BubbleGlyph> oldbubs = Lists.newArrayList(); if (speaker != null) { for (int ii=0; ii < num; ii++) { BubbleGlyph bub = _bubbles.get(ii); if (bub.isSpeaker(speaker)) { oldbubs.add(bub); } } } // see if we need to expire this user's oldest bubble if (oldbubs.size() >= MAX_BUBBLES_PER_USER) { BubbleGlyph bub = oldbubs.remove(0); _bubbles.remove(bub); _target.abortAnimation(bub); // or some other old bubble } else if (num >= MAX_BUBBLES) { _target.abortAnimation(_bubbles.remove(0)); } // return the speaker's old bubbles return oldbubs; }
java
protected List<BubbleGlyph> getAndExpireBubbles (Name speaker) { int num = _bubbles.size(); // first, get all the old bubbles belonging to the user List<BubbleGlyph> oldbubs = Lists.newArrayList(); if (speaker != null) { for (int ii=0; ii < num; ii++) { BubbleGlyph bub = _bubbles.get(ii); if (bub.isSpeaker(speaker)) { oldbubs.add(bub); } } } // see if we need to expire this user's oldest bubble if (oldbubs.size() >= MAX_BUBBLES_PER_USER) { BubbleGlyph bub = oldbubs.remove(0); _bubbles.remove(bub); _target.abortAnimation(bub); // or some other old bubble } else if (num >= MAX_BUBBLES) { _target.abortAnimation(_bubbles.remove(0)); } // return the speaker's old bubbles return oldbubs; }
[ "protected", "List", "<", "BubbleGlyph", ">", "getAndExpireBubbles", "(", "Name", "speaker", ")", "{", "int", "num", "=", "_bubbles", ".", "size", "(", ")", ";", "// first, get all the old bubbles belonging to the user", "List", "<", "BubbleGlyph", ">", "oldbubs", ...
Expire a bubble, if necessary, and return the old bubbles for the specified speaker.
[ "Expire", "a", "bubble", "if", "necessary", "and", "return", "the", "old", "bubbles", "for", "the", "specified", "speaker", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L689-L717
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.layoutText
protected Label layoutText (Graphics2D gfx, Font font, String text) { Label label = _logic.createLabel(text); label.setFont(font); // layout in one line Rectangle vbounds = _target.getViewBounds(); label.setTargetWidth(vbounds.width - PAD * 2); label.layout(gfx); Dimension d = label.getSize(); // if the label is wide enough, try to split the text into multiple // lines if (d.width > MINIMUM_SPLIT_WIDTH) { int targetheight = getGoldenLabelHeight(d); if (targetheight > 1) { label.setTargetHeight(targetheight * d.height); label.layout(gfx); } } return label; }
java
protected Label layoutText (Graphics2D gfx, Font font, String text) { Label label = _logic.createLabel(text); label.setFont(font); // layout in one line Rectangle vbounds = _target.getViewBounds(); label.setTargetWidth(vbounds.width - PAD * 2); label.layout(gfx); Dimension d = label.getSize(); // if the label is wide enough, try to split the text into multiple // lines if (d.width > MINIMUM_SPLIT_WIDTH) { int targetheight = getGoldenLabelHeight(d); if (targetheight > 1) { label.setTargetHeight(targetheight * d.height); label.layout(gfx); } } return label; }
[ "protected", "Label", "layoutText", "(", "Graphics2D", "gfx", ",", "Font", "font", ",", "String", "text", ")", "{", "Label", "label", "=", "_logic", ".", "createLabel", "(", "text", ")", ";", "label", ".", "setFont", "(", "font", ")", ";", "// layout in ...
Get a label formatted as close to the golden ratio as possible for the specified text and given the standard padding we use on all bubbles.
[ "Get", "a", "label", "formatted", "as", "close", "to", "the", "golden", "ratio", "as", "possible", "for", "the", "specified", "text", "and", "given", "the", "standard", "padding", "we", "use", "on", "all", "bubbles", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L730-L751
train
threerings/nenya
core/src/main/java/com/threerings/chat/ComicChatOverlay.java
ComicChatOverlay.getAvoidList
protected List<Shape> getAvoidList (Name speaker) { List<Shape> avoid = Lists.newArrayList(); if (_provider == null) { return avoid; } // for now we don't accept low-priority avoids _provider.getAvoidables(speaker, avoid, null); // add the existing chatbub non-tail areas from other speakers for (BubbleGlyph bub : _bubbles) { if (!bub.isSpeaker(speaker)) { avoid.add(bub.getBubbleTerritory()); } } return avoid; }
java
protected List<Shape> getAvoidList (Name speaker) { List<Shape> avoid = Lists.newArrayList(); if (_provider == null) { return avoid; } // for now we don't accept low-priority avoids _provider.getAvoidables(speaker, avoid, null); // add the existing chatbub non-tail areas from other speakers for (BubbleGlyph bub : _bubbles) { if (!bub.isSpeaker(speaker)) { avoid.add(bub.getBubbleTerritory()); } } return avoid; }
[ "protected", "List", "<", "Shape", ">", "getAvoidList", "(", "Name", "speaker", ")", "{", "List", "<", "Shape", ">", "avoid", "=", "Lists", ".", "newArrayList", "(", ")", ";", "if", "(", "_provider", "==", "null", ")", "{", "return", "avoid", ";", "}...
Return a list of rectangular areas that we should avoid while laying out a bubble for the specified speaker.
[ "Return", "a", "list", "of", "rectangular", "areas", "that", "we", "should", "avoid", "while", "laying", "out", "a", "bubble", "for", "the", "specified", "speaker", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L781-L799
train
threerings/nenya
core/src/main/java/com/threerings/openal/FileStream.java
FileStream.queueFile
public void queueFile (File file, boolean loop) { try { queueURL(file.toURI().toURL(), loop); } catch (MalformedURLException e) { log.warning("Invalid file url.", "file", file, e); } }
java
public void queueFile (File file, boolean loop) { try { queueURL(file.toURI().toURL(), loop); } catch (MalformedURLException e) { log.warning("Invalid file url.", "file", file, e); } }
[ "public", "void", "queueFile", "(", "File", "file", ",", "boolean", "loop", ")", "{", "try", "{", "queueURL", "(", "file", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ",", "loop", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", ...
Adds a file to the queue of files to play. @param loop if true, play this file in a loop if there's nothing else on the queue
[ "Adds", "a", "file", "to", "the", "queue", "of", "files", "to", "play", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/FileStream.java#L52-L59
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterManager.java
CharacterManager.getActionFrames
public ActionFrames getActionFrames ( CharacterDescriptor descrip, String action) throws NoSuchComponentException { Tuple<CharacterDescriptor, String> key = new Tuple<CharacterDescriptor, String>(descrip, action); ActionFrames frames = _actionFrames.get(key); if (frames == null) { // this doesn't actually composite the images, but prepares an // object to be able to do so frames = createCompositeFrames(descrip, action); _actionFrames.put(key, frames); } // periodically report our frame image cache performance if (!_cacheStatThrottle.throttleOp()) { long size = getEstimatedCacheMemoryUsage(); int[] eff = _frameCache.getTrackedEffectiveness(); log.debug("CharacterManager LRU [mem=" + (size / 1024) + "k" + ", size=" + _frameCache.size() + ", hits=" + eff[0] + ", misses=" + eff[1] + "]."); } return frames; }
java
public ActionFrames getActionFrames ( CharacterDescriptor descrip, String action) throws NoSuchComponentException { Tuple<CharacterDescriptor, String> key = new Tuple<CharacterDescriptor, String>(descrip, action); ActionFrames frames = _actionFrames.get(key); if (frames == null) { // this doesn't actually composite the images, but prepares an // object to be able to do so frames = createCompositeFrames(descrip, action); _actionFrames.put(key, frames); } // periodically report our frame image cache performance if (!_cacheStatThrottle.throttleOp()) { long size = getEstimatedCacheMemoryUsage(); int[] eff = _frameCache.getTrackedEffectiveness(); log.debug("CharacterManager LRU [mem=" + (size / 1024) + "k" + ", size=" + _frameCache.size() + ", hits=" + eff[0] + ", misses=" + eff[1] + "]."); } return frames; }
[ "public", "ActionFrames", "getActionFrames", "(", "CharacterDescriptor", "descrip", ",", "String", "action", ")", "throws", "NoSuchComponentException", "{", "Tuple", "<", "CharacterDescriptor", ",", "String", ">", "key", "=", "new", "Tuple", "<", "CharacterDescriptor"...
Obtains the composited animation frames for the specified action for a character with the specified descriptor. The resulting composited animation will be cached. @exception NoSuchComponentException thrown if any of the components in the supplied descriptor do not exist. @exception IllegalArgumentException thrown if any of the components referenced in the descriptor do not support the specified action.
[ "Obtains", "the", "composited", "animation", "frames", "for", "the", "specified", "action", "for", "a", "character", "with", "the", "specified", "descriptor", ".", "The", "resulting", "composited", "animation", "will", "be", "cached", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterManager.java#L169-L192
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterManager.java
CharacterManager.resolveActionSequence
public void resolveActionSequence (CharacterDescriptor desc, String action) { try { if (getActionFrames(desc, action) == null) { log.warning("Failed to resolve action sequence " + "[desc=" + desc + ", action=" + action + "]."); } } catch (NoSuchComponentException nsce) { log.warning("Failed to resolve action sequence " + "[nsce=" + nsce + "]."); } }
java
public void resolveActionSequence (CharacterDescriptor desc, String action) { try { if (getActionFrames(desc, action) == null) { log.warning("Failed to resolve action sequence " + "[desc=" + desc + ", action=" + action + "]."); } } catch (NoSuchComponentException nsce) { log.warning("Failed to resolve action sequence " + "[nsce=" + nsce + "]."); } }
[ "public", "void", "resolveActionSequence", "(", "CharacterDescriptor", "desc", ",", "String", "action", ")", "{", "try", "{", "if", "(", "getActionFrames", "(", "desc", ",", "action", ")", "==", "null", ")", "{", "log", ".", "warning", "(", "\"Failed to reso...
Informs the character manager that the action sequence for the given character descriptor is likely to be needed in the near future and so any efforts that can be made to load it into the action sequence cache in advance should be undertaken. <p> This will eventually be revamped to spiffily load action sequences in the background.
[ "Informs", "the", "character", "manager", "that", "the", "action", "sequence", "for", "the", "given", "character", "descriptor", "is", "likely", "to", "be", "needed", "in", "the", "near", "future", "and", "so", "any", "efforts", "that", "can", "be", "made", ...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterManager.java#L203-L215
train
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterManager.java
CharacterManager.getEstimatedCacheMemoryUsage
protected long getEstimatedCacheMemoryUsage () { long size = 0; Iterator<CompositedMultiFrameImage> iter = _frameCache.values().iterator(); while (iter.hasNext()) { size += iter.next().getEstimatedMemoryUsage(); } return size; }
java
protected long getEstimatedCacheMemoryUsage () { long size = 0; Iterator<CompositedMultiFrameImage> iter = _frameCache.values().iterator(); while (iter.hasNext()) { size += iter.next().getEstimatedMemoryUsage(); } return size; }
[ "protected", "long", "getEstimatedCacheMemoryUsage", "(", ")", "{", "long", "size", "=", "0", ";", "Iterator", "<", "CompositedMultiFrameImage", ">", "iter", "=", "_frameCache", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ...
Returns the estimated memory usage in bytes for all images currently cached by the cached action frames.
[ "Returns", "the", "estimated", "memory", "usage", "in", "bytes", "for", "all", "images", "currently", "cached", "by", "the", "cached", "action", "frames", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterManager.java#L230-L238
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/impl/bridge/WebSocketNativeBridgeHandler.java
WebSocketNativeBridgeHandler.processAuthorize
@Override public void processAuthorize(WebSocketChannel channel, String authorizeToken) { LOG.entering(CLASS_NAME, "processAuthorize"); WebSocketNativeChannel nativeChannel = (WebSocketNativeChannel)channel; Proxy proxy = nativeChannel.getProxy(); proxy.processEvent(XoaEventKind.AUTHORIZE, new String[] { authorizeToken }); }
java
@Override public void processAuthorize(WebSocketChannel channel, String authorizeToken) { LOG.entering(CLASS_NAME, "processAuthorize"); WebSocketNativeChannel nativeChannel = (WebSocketNativeChannel)channel; Proxy proxy = nativeChannel.getProxy(); proxy.processEvent(XoaEventKind.AUTHORIZE, new String[] { authorizeToken }); }
[ "@", "Override", "public", "void", "processAuthorize", "(", "WebSocketChannel", "channel", ",", "String", "authorizeToken", ")", "{", "LOG", ".", "entering", "(", "CLASS_NAME", ",", "\"processAuthorize\"", ")", ";", "WebSocketNativeChannel", "nativeChannel", "=", "(...
Set the authorize token for future requests for "Basic" authentication.
[ "Set", "the", "authorize", "token", "for", "future", "requests", "for", "Basic", "authentication", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/impl/bridge/WebSocketNativeBridgeHandler.java#L95-L102
train
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/HexUtil.java
HexUtil.byteArrayToInt
public static int byteArrayToInt(byte[] b, int offset) { int value = 0; for (int i = 0; i < 4; i++) { int shift = (4 - 1 - i) * 8; value += (b[i + offset] & 0x000000FF) << shift; } return value; }
java
public static int byteArrayToInt(byte[] b, int offset) { int value = 0; for (int i = 0; i < 4; i++) { int shift = (4 - 1 - i) * 8; value += (b[i + offset] & 0x000000FF) << shift; } return value; }
[ "public", "static", "int", "byteArrayToInt", "(", "byte", "[", "]", "b", ",", "int", "offset", ")", "{", "int", "value", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "int", "shift", "=", "(", ...
Convert the byte array to an int starting from the given offset. @param b The byte array @param offset The array offset @return The integer
[ "Convert", "the", "byte", "array", "to", "an", "int", "starting", "from", "the", "given", "offset", "." ]
25ad2ae5bb24aa9d6b79400fce649b518dcfbe26
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/HexUtil.java#L81-L88
train
threerings/nenya
core/src/main/java/com/threerings/miso/data/ObjectInfo.java
ObjectInfo.setZations
public void setZations (byte primary, byte secondary, byte tertiary, byte quaternary) { zations = (primary | (secondary << 16) | (tertiary << 24) | (quaternary << 8)); }
java
public void setZations (byte primary, byte secondary, byte tertiary, byte quaternary) { zations = (primary | (secondary << 16) | (tertiary << 24) | (quaternary << 8)); }
[ "public", "void", "setZations", "(", "byte", "primary", ",", "byte", "secondary", ",", "byte", "tertiary", ",", "byte", "quaternary", ")", "{", "zations", "=", "(", "primary", "|", "(", "secondary", "<<", "16", ")", "|", "(", "tertiary", "<<", "24", ")...
Sets the primary and secondary colorization assignments.
[ "Sets", "the", "primary", "and", "secondary", "colorization", "assignments", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/data/ObjectInfo.java#L134-L137
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getFilteredViews
public <T extends View> ArrayList<T> getFilteredViews(Class<T> classToFilterBy) { ArrayList<T> filteredViews = new ArrayList<T>(); List<View> allViews = this.getViews(); for(View view : allViews){ if (view != null && classToFilterBy.isAssignableFrom(view.getClass())) { filteredViews.add(classToFilterBy.cast(view)); } } return filteredViews; }
java
public <T extends View> ArrayList<T> getFilteredViews(Class<T> classToFilterBy) { ArrayList<T> filteredViews = new ArrayList<T>(); List<View> allViews = this.getViews(); for(View view : allViews){ if (view != null && classToFilterBy.isAssignableFrom(view.getClass())) { filteredViews.add(classToFilterBy.cast(view)); } } return filteredViews; }
[ "public", "<", "T", "extends", "View", ">", "ArrayList", "<", "T", ">", "getFilteredViews", "(", "Class", "<", "T", ">", "classToFilterBy", ")", "{", "ArrayList", "<", "T", ">", "filteredViews", "=", "new", "ArrayList", "<", "T", ">", "(", ")", ";", ...
Filters through all views in current activity and gets those that inherit from a given class to filter by @param classToFilterBy - The class type by which to filter by. @param <T> Type representing a class @return - an ArrayList of views matching the filter
[ "Filters", "through", "all", "views", "in", "current", "activity", "and", "gets", "those", "that", "inherit", "from", "a", "given", "class", "to", "filter", "by" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L65-L74
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getVisibleText
public ArrayList<String> getVisibleText() { ArrayList<TextView> textViews = getFilteredViews(TextView.class); ArrayList<String> allStrings = new ArrayList<String>(); for(TextView v: textViews) { if(v.getVisibility() == View.VISIBLE) { String s = v.getText().toString(); allStrings.add(s); } } return allStrings; }
java
public ArrayList<String> getVisibleText() { ArrayList<TextView> textViews = getFilteredViews(TextView.class); ArrayList<String> allStrings = new ArrayList<String>(); for(TextView v: textViews) { if(v.getVisibility() == View.VISIBLE) { String s = v.getText().toString(); allStrings.add(s); } } return allStrings; }
[ "public", "ArrayList", "<", "String", ">", "getVisibleText", "(", ")", "{", "ArrayList", "<", "TextView", ">", "textViews", "=", "getFilteredViews", "(", "TextView", ".", "class", ")", ";", "ArrayList", "<", "String", ">", "allStrings", "=", "new", "ArrayLis...
Searches through all views and gets those containing text which are visible. Stips the text form each view and returns it as an arraylist. @return - ArrayList contating text in the current view
[ "Searches", "through", "all", "views", "and", "gets", "those", "containing", "text", "which", "are", "visible", ".", "Stips", "the", "text", "form", "each", "view", "and", "returns", "it", "as", "an", "arraylist", "." ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L81-L96
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getView
public View getView(int id, int timeout) { View v = null; int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { try { v = super.getView(id); } catch (Exception e) {} if (v != null) { break; } this.sleep(RETRY_PERIOD); } return v; }
java
public View getView(int id, int timeout) { View v = null; int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { try { v = super.getView(id); } catch (Exception e) {} if (v != null) { break; } this.sleep(RETRY_PERIOD); } return v; }
[ "public", "View", "getView", "(", "int", "id", ",", "int", "timeout", ")", "{", "View", "v", "=", "null", ";", "int", "RETRY_PERIOD", "=", "250", ";", "int", "retryNum", "=", "timeout", "/", "RETRY_PERIOD", ";", "for", "(", "int", "i", "=", "0", ";...
Extend the normal robotium getView to retry every 250ms over 10s to get the view requested @param id Resource id of the view @param timeout amount of time to retry getting the view @return View that we want to find by id
[ "Extend", "the", "normal", "robotium", "getView", "to", "retry", "every", "250ms", "over", "10s", "to", "get", "the", "view", "requested" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L114-L130
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.waitForResource
public <T> boolean waitForResource(int res, int timeout) { int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { T View = (T) this.getView(res); if (View != null) { break; } if (i == retryNum - 1) { return false; } this.sleep(RETRY_PERIOD); } return true; }
java
public <T> boolean waitForResource(int res, int timeout) { int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { T View = (T) this.getView(res); if (View != null) { break; } if (i == retryNum - 1) { return false; } this.sleep(RETRY_PERIOD); } return true; }
[ "public", "<", "T", ">", "boolean", "waitForResource", "(", "int", "res", ",", "int", "timeout", ")", "{", "int", "RETRY_PERIOD", "=", "250", ";", "int", "retryNum", "=", "timeout", "/", "RETRY_PERIOD", ";", "for", "(", "int", "i", "=", "0", ";", "i"...
Wait for a resource to become active @param res - view resource @param timeout - timeout period to keep retrying @param <T> - View type
[ "Wait", "for", "a", "resource", "to", "become", "active" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L158-L172
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getCustomViews
public ArrayList<View> getCustomViews(String viewName) { ArrayList<View> returnViews = new ArrayList<View>(); for(View v: this.getViews()) { if(v.getClass().getSimpleName().equals(viewName)) returnViews.add(v); } return returnViews; }
java
public ArrayList<View> getCustomViews(String viewName) { ArrayList<View> returnViews = new ArrayList<View>(); for(View v: this.getViews()) { if(v.getClass().getSimpleName().equals(viewName)) returnViews.add(v); } return returnViews; }
[ "public", "ArrayList", "<", "View", ">", "getCustomViews", "(", "String", "viewName", ")", "{", "ArrayList", "<", "View", ">", "returnViews", "=", "new", "ArrayList", "<", "View", ">", "(", ")", ";", "for", "(", "View", "v", ":", "this", ".", "getViews...
Gets views with a custom class name @param viewName simple class name of the view type @return arraylist of views matching class name provided
[ "Gets", "views", "with", "a", "custom", "class", "name" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L231-L241
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.waitForHintText
public void waitForHintText(String hintText, int timeout) throws Exception { int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for(int i=0; i < retryNum; i++) { ArrayList<View> imageViews = getCustomViews("EditText"); for(View v: imageViews) { if(((EditText)v).getHint() == null) continue; if(((EditText)v).getHint().equals(hintText) && v.getVisibility() == View.VISIBLE) return; } this.sleep(RETRY_PERIOD); } throw new Exception(String.format("Splash screen didn't disappear after %d ms", timeout)); }
java
public void waitForHintText(String hintText, int timeout) throws Exception { int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for(int i=0; i < retryNum; i++) { ArrayList<View> imageViews = getCustomViews("EditText"); for(View v: imageViews) { if(((EditText)v).getHint() == null) continue; if(((EditText)v).getHint().equals(hintText) && v.getVisibility() == View.VISIBLE) return; } this.sleep(RETRY_PERIOD); } throw new Exception(String.format("Splash screen didn't disappear after %d ms", timeout)); }
[ "public", "void", "waitForHintText", "(", "String", "hintText", ",", "int", "timeout", ")", "throws", "Exception", "{", "int", "RETRY_PERIOD", "=", "250", ";", "int", "retryNum", "=", "timeout", "/", "RETRY_PERIOD", ";", "for", "(", "int", "i", "=", "0", ...
Waits for hint text to appear in an EditText @param hintText text to wait for @param timeout amount of time to wait
[ "Waits", "for", "hint", "text", "to", "appear", "in", "an", "EditText" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L248-L267
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.enterTextAndWait
public void enterTextAndWait(int fieldResource, String value) { EditText textBox = (EditText) this.getView(fieldResource); this.enterText(textBox, value); this.waitForText(value); }
java
public void enterTextAndWait(int fieldResource, String value) { EditText textBox = (EditText) this.getView(fieldResource); this.enterText(textBox, value); this.waitForText(value); }
[ "public", "void", "enterTextAndWait", "(", "int", "fieldResource", ",", "String", "value", ")", "{", "EditText", "textBox", "=", "(", "EditText", ")", "this", ".", "getView", "(", "fieldResource", ")", ";", "this", ".", "enterText", "(", "textBox", ",", "v...
Enter text into a given field resource id @param fieldResource - Resource id of a field (R.id.*) @param value - value to enter into the given field
[ "Enter", "text", "into", "a", "given", "field", "resource", "id" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L274-L279
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getLocalizedResource
public String getLocalizedResource(String namespace, String resourceId) throws Exception { String resourceValue = ""; Class r = Class.forName(namespace + "$string"); Field f = r.getField(resourceId); resourceValue = getCurrentActivity().getResources().getString(f.getInt(f)); return resourceValue; }
java
public String getLocalizedResource(String namespace, String resourceId) throws Exception { String resourceValue = ""; Class r = Class.forName(namespace + "$string"); Field f = r.getField(resourceId); resourceValue = getCurrentActivity().getResources().getString(f.getInt(f)); return resourceValue; }
[ "public", "String", "getLocalizedResource", "(", "String", "namespace", ",", "String", "resourceId", ")", "throws", "Exception", "{", "String", "resourceValue", "=", "\"\"", ";", "Class", "r", "=", "Class", ".", "forName", "(", "namespace", "+", "\"$string\"", ...
Returns a string for a resourceId in the specified namespace @param namespace @param resourceId @return @throws Exception
[ "Returns", "a", "string", "for", "a", "resourceId", "in", "the", "specified", "namespace" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L288-L296
train
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getLocalizedResourceArray
public String[] getLocalizedResourceArray(String namespace, String resourceId) throws Exception { Class r = Class.forName(namespace + "$string"); Field f = r.getField(resourceId); return getCurrentActivity().getResources().getStringArray(f.getInt(f)); }
java
public String[] getLocalizedResourceArray(String namespace, String resourceId) throws Exception { Class r = Class.forName(namespace + "$string"); Field f = r.getField(resourceId); return getCurrentActivity().getResources().getStringArray(f.getInt(f)); }
[ "public", "String", "[", "]", "getLocalizedResourceArray", "(", "String", "namespace", ",", "String", "resourceId", ")", "throws", "Exception", "{", "Class", "r", "=", "Class", ".", "forName", "(", "namespace", "+", "\"$string\"", ")", ";", "Field", "f", "="...
Returns a string array for a specified string-array resourceId in the specified namespace @param namespace @param resourceId @return @throws Exception
[ "Returns", "a", "string", "array", "for", "a", "specified", "string", "-", "array", "resourceId", "in", "the", "specified", "namespace" ]
12d242faad50bf90f98657ca9a0c0c3ae1993f07
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L305-L309
train
threerings/nenya
core/src/main/java/com/threerings/openal/Listener.java
Listener.setPosition
public void setPosition (float x, float y, float z) { if (_px != x || _py != y || _pz != z) { AL10.alListener3f(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.alListener3f(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", ".", "alListener3f", "(", "AL10", ".", "AL_POSITION...
Sets the position of the listener.
[ "Sets", "the", "position", "of", "the", "listener", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Listener.java#L35-L40
train
threerings/nenya
core/src/main/java/com/threerings/openal/Listener.java
Listener.setVelocity
public void setVelocity (float x, float y, float z) { if (_vx != x || _vy != y || _vz != z) { AL10.alListener3f(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.alListener3f(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", ".", "alListener3f", "(", "AL10", ".", "AL_VELOCITY...
Sets the velocity of the listener.
[ "Sets", "the", "velocity", "of", "the", "listener", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Listener.java#L69-L74
train
threerings/nenya
core/src/main/java/com/threerings/openal/Listener.java
Listener.setGain
public void setGain (float gain) { if (_gain != gain) { AL10.alListenerf(AL10.AL_GAIN, _gain = gain); } }
java
public void setGain (float gain) { if (_gain != gain) { AL10.alListenerf(AL10.AL_GAIN, _gain = gain); } }
[ "public", "void", "setGain", "(", "float", "gain", ")", "{", "if", "(", "_gain", "!=", "gain", ")", "{", "AL10", ".", "alListenerf", "(", "AL10", ".", "AL_GAIN", ",", "_gain", "=", "gain", ")", ";", "}", "}" ]
Sets the gain of the listener.
[ "Sets", "the", "gain", "of", "the", "listener", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Listener.java#L79-L84
train
threerings/nenya
core/src/main/java/com/threerings/media/image/Colorization.java
Colorization.matches
public boolean matches (float[] hsv, int[] fhsv) { // check to see that this color is sufficiently "close" to the // root color based on the supplied distance parameters if (distance(fhsv[0], _fhsv[0], Short.MAX_VALUE) > range[0] * Short.MAX_VALUE) { return false; } // saturation and value don't wrap around like hue if (Math.abs(_hsv[1] - hsv[1]) > range[1] || Math.abs(_hsv[2] - hsv[2]) > range[2]) { return false; } return true; }
java
public boolean matches (float[] hsv, int[] fhsv) { // check to see that this color is sufficiently "close" to the // root color based on the supplied distance parameters if (distance(fhsv[0], _fhsv[0], Short.MAX_VALUE) > range[0] * Short.MAX_VALUE) { return false; } // saturation and value don't wrap around like hue if (Math.abs(_hsv[1] - hsv[1]) > range[1] || Math.abs(_hsv[2] - hsv[2]) > range[2]) { return false; } return true; }
[ "public", "boolean", "matches", "(", "float", "[", "]", "hsv", ",", "int", "[", "]", "fhsv", ")", "{", "// check to see that this color is sufficiently \"close\" to the", "// root color based on the supplied distance parameters", "if", "(", "distance", "(", "fhsv", "[", ...
Returns true if this colorization matches the supplied color, false otherwise. @param hsv the HSV values for the color in question. @param fhsv the HSV values converted to fixed point via {@link #toFixedHSV} for the color in question.
[ "Returns", "true", "if", "this", "colorization", "matches", "the", "supplied", "color", "false", "otherwise", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/Colorization.java#L115-L130
train
threerings/nenya
core/src/main/java/com/threerings/media/image/Colorization.java
Colorization.toFixedHSV
public static int[] toFixedHSV (float[] hsv, int[] fhsv) { if (fhsv == null) { fhsv = new int[hsv.length]; } for (int ii = 0; ii < hsv.length; ii++) { // fhsv[i] = (int)(hsv[i]*Integer.MAX_VALUE); fhsv[ii] = (int)(hsv[ii]*Short.MAX_VALUE); } return fhsv; }
java
public static int[] toFixedHSV (float[] hsv, int[] fhsv) { if (fhsv == null) { fhsv = new int[hsv.length]; } for (int ii = 0; ii < hsv.length; ii++) { // fhsv[i] = (int)(hsv[i]*Integer.MAX_VALUE); fhsv[ii] = (int)(hsv[ii]*Short.MAX_VALUE); } return fhsv; }
[ "public", "static", "int", "[", "]", "toFixedHSV", "(", "float", "[", "]", "hsv", ",", "int", "[", "]", "fhsv", ")", "{", "if", "(", "fhsv", "==", "null", ")", "{", "fhsv", "=", "new", "int", "[", "hsv", ".", "length", "]", ";", "}", "for", "...
Converts floating point HSV values to a fixed point integer representation. @param hsv the HSV values to be converted. @param fhsv the destination array into which the fixed values will be stored. If this is null, a new array will be created of the appropriate length. @return the <code>fhsv</code> parameter if it was non-null or the newly created target array.
[ "Converts", "floating", "point", "HSV", "values", "to", "a", "fixed", "point", "integer", "representation", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/Colorization.java#L172-L182
train
threerings/nenya
core/src/main/java/com/threerings/media/image/Colorization.java
Colorization.distance
public static int distance (int a, int b, int N) { return (a > b) ? Math.min(a-b, b+N-a) : Math.min(b-a, a+N-b); }
java
public static int distance (int a, int b, int N) { return (a > b) ? Math.min(a-b, b+N-a) : Math.min(b-a, a+N-b); }
[ "public", "static", "int", "distance", "(", "int", "a", ",", "int", "b", ",", "int", "N", ")", "{", "return", "(", "a", ">", "b", ")", "?", "Math", ".", "min", "(", "a", "-", "b", ",", "b", "+", "N", "-", "a", ")", ":", "Math", ".", "min"...
Returns the distance between the supplied to numbers modulo N.
[ "Returns", "the", "distance", "between", "the", "supplied", "to", "numbers", "modulo", "N", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/Colorization.java#L187-L190
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.setSceneModel
public void setSceneModel (MisoSceneModel model) { _model = model; // clear out old blocks and objects clearScene(); centerOnTile(0, 0); if (isShowing()) { rethink(); _remgr.invalidateRegion(_vbounds); } }
java
public void setSceneModel (MisoSceneModel model) { _model = model; // clear out old blocks and objects clearScene(); centerOnTile(0, 0); if (isShowing()) { rethink(); _remgr.invalidateRegion(_vbounds); } }
[ "public", "void", "setSceneModel", "(", "MisoSceneModel", "model", ")", "{", "_model", "=", "model", ";", "// clear out old blocks and objects", "clearScene", "(", ")", ";", "centerOnTile", "(", "0", ",", "0", ")", ";", "if", "(", "isShowing", "(", ")", ")",...
Configures this display with a scene model which will immediately be resolved and displayed.
[ "Configures", "this", "display", "with", "a", "scene", "model", "which", "will", "immediately", "be", "resolved", "and", "displayed", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L127-L139
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.clearScene
protected void clearScene () { _blocks.clear(); _vizobjs.clear(); _fringes.clear(); _masks.clear(); if (_dpanel != null) { _dpanel.newScene(); } }
java
protected void clearScene () { _blocks.clear(); _vizobjs.clear(); _fringes.clear(); _masks.clear(); if (_dpanel != null) { _dpanel.newScene(); } }
[ "protected", "void", "clearScene", "(", ")", "{", "_blocks", ".", "clear", "(", ")", ";", "_vizobjs", ".", "clear", "(", ")", ";", "_fringes", ".", "clear", "(", ")", ";", "_masks", ".", "clear", "(", ")", ";", "if", "(", "_dpanel", "!=", "null", ...
Clears out our old scene business.
[ "Clears", "out", "our", "old", "scene", "business", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L144-L153
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.centerOnTile
public void centerOnTile (int tx, int ty) { Rectangle trect = MisoUtil.getTilePolygon(_metrics, tx, ty).getBounds(); int nx = trect.x + trect.width/2 - _vbounds.width/2; int ny = trect.y + trect.height/2 - _vbounds.height/2; // Log.info("Centering on t:" + StringUtil.coordsToString(tx, ty) + // " b:" + StringUtil.toString(trect) + // " vb: " + StringUtil.toString(_vbounds) + // ", n:" + StringUtil.coordsToString(nx, ny) + "."); setViewLocation(nx, ny); }
java
public void centerOnTile (int tx, int ty) { Rectangle trect = MisoUtil.getTilePolygon(_metrics, tx, ty).getBounds(); int nx = trect.x + trect.width/2 - _vbounds.width/2; int ny = trect.y + trect.height/2 - _vbounds.height/2; // Log.info("Centering on t:" + StringUtil.coordsToString(tx, ty) + // " b:" + StringUtil.toString(trect) + // " vb: " + StringUtil.toString(_vbounds) + // ", n:" + StringUtil.coordsToString(nx, ny) + "."); setViewLocation(nx, ny); }
[ "public", "void", "centerOnTile", "(", "int", "tx", ",", "int", "ty", ")", "{", "Rectangle", "trect", "=", "MisoUtil", ".", "getTilePolygon", "(", "_metrics", ",", "tx", ",", "ty", ")", ".", "getBounds", "(", ")", ";", "int", "nx", "=", "trect", ".",...
Moves the scene such that the specified tile is in the center.
[ "Moves", "the", "scene", "such", "that", "the", "specified", "tile", "is", "in", "the", "center", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L169-L179
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.showFlagsDidChange
protected void showFlagsDidChange (int oldflags) { if ((oldflags & SHOW_TIPS) != (_showFlags & SHOW_TIPS)) { for (SceneObjectIndicator indic : _indicators.values()) { dirtyIndicator(indic); } } }
java
protected void showFlagsDidChange (int oldflags) { if ((oldflags & SHOW_TIPS) != (_showFlags & SHOW_TIPS)) { for (SceneObjectIndicator indic : _indicators.values()) { dirtyIndicator(indic); } } }
[ "protected", "void", "showFlagsDidChange", "(", "int", "oldflags", ")", "{", "if", "(", "(", "oldflags", "&", "SHOW_TIPS", ")", "!=", "(", "_showFlags", "&", "SHOW_TIPS", ")", ")", "{", "for", "(", "SceneObjectIndicator", "indic", ":", "_indicators", ".", ...
Called when our show flags have changed.
[ "Called", "when", "our", "show", "flags", "have", "changed", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L227-L234
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getBlock
public SceneBlock getBlock (int tx, int ty) { int bx = MathUtil.floorDiv(tx, _metrics.blockwid); int by = MathUtil.floorDiv(ty, _metrics.blockhei); return _blocks.get(compose(bx, by)); }
java
public SceneBlock getBlock (int tx, int ty) { int bx = MathUtil.floorDiv(tx, _metrics.blockwid); int by = MathUtil.floorDiv(ty, _metrics.blockhei); return _blocks.get(compose(bx, by)); }
[ "public", "SceneBlock", "getBlock", "(", "int", "tx", ",", "int", "ty", ")", "{", "int", "bx", "=", "MathUtil", ".", "floorDiv", "(", "tx", ",", "_metrics", ".", "blockwid", ")", ";", "int", "by", "=", "MathUtil", ".", "floorDiv", "(", "ty", ",", "...
Returns the resolved block that contains the specified tile coordinate or null if no block is resolved for that coordinate.
[ "Returns", "the", "resolved", "block", "that", "contains", "the", "specified", "tile", "coordinate", "or", "null", "if", "no", "block", "is", "resolved", "for", "that", "coordinate", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L265-L270
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getPath
public Path getPath (Sprite sprite, int x, int y, boolean loose) { // sanity check if (sprite == null) { throw new IllegalArgumentException( "Can't get path for null sprite [x=" + x + ", y=" + y + "."); } // get the destination tile coordinates Point src = MisoUtil.screenToTile( _metrics, sprite.getX(), sprite.getY(), new Point()); Point dest = MisoUtil.screenToTile(_metrics, x, y, new Point()); // compute our longest path from the screen size int longestPath = 3 * (getWidth() / _metrics.tilewid); // get a reasonable tile path through the scene long start = System.currentTimeMillis(); List<Point> points = AStarPathUtil.getPath( this, sprite, longestPath, src.x, src.y, dest.x, dest.y, loose); long duration = System.currentTimeMillis() - start; // sanity check the number of nodes searched so that we can keep an eye out for bogosity if (duration > 500L) { int considered = AStarPathUtil.getConsidered(); log.warning("Considered " + considered + " nodes for path from " + StringUtil.toString(src) + " to " + StringUtil.toString(dest) + " [duration=" + duration + "]."); } // construct a path object to guide the sprite on its merry way return (points == null) ? null : new TilePath(_metrics, sprite, points, x, y); }
java
public Path getPath (Sprite sprite, int x, int y, boolean loose) { // sanity check if (sprite == null) { throw new IllegalArgumentException( "Can't get path for null sprite [x=" + x + ", y=" + y + "."); } // get the destination tile coordinates Point src = MisoUtil.screenToTile( _metrics, sprite.getX(), sprite.getY(), new Point()); Point dest = MisoUtil.screenToTile(_metrics, x, y, new Point()); // compute our longest path from the screen size int longestPath = 3 * (getWidth() / _metrics.tilewid); // get a reasonable tile path through the scene long start = System.currentTimeMillis(); List<Point> points = AStarPathUtil.getPath( this, sprite, longestPath, src.x, src.y, dest.x, dest.y, loose); long duration = System.currentTimeMillis() - start; // sanity check the number of nodes searched so that we can keep an eye out for bogosity if (duration > 500L) { int considered = AStarPathUtil.getConsidered(); log.warning("Considered " + considered + " nodes for path from " + StringUtil.toString(src) + " to " + StringUtil.toString(dest) + " [duration=" + duration + "]."); } // construct a path object to guide the sprite on its merry way return (points == null) ? null : new TilePath(_metrics, sprite, points, x, y); }
[ "public", "Path", "getPath", "(", "Sprite", "sprite", ",", "int", "x", ",", "int", "y", ",", "boolean", "loose", ")", "{", "// sanity check", "if", "(", "sprite", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't get path for ...
Computes a path for the specified sprite to the specified tile coordinates. @param loose if true, an approximate path will be returned if a complete path cannot be located. This path will navigate the sprite "legally" as far as possible and then walk the sprite in a straight line to its final destination. This is generally only useful if the the path goes "off screen".
[ "Computes", "a", "path", "for", "the", "specified", "sprite", "to", "the", "specified", "tile", "coordinates", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L280-L314
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getScreenCoords
public Point getScreenCoords (int x, int y) { return MisoUtil.fullToScreen(_metrics, x, y, new Point()); }
java
public Point getScreenCoords (int x, int y) { return MisoUtil.fullToScreen(_metrics, x, y, new Point()); }
[ "public", "Point", "getScreenCoords", "(", "int", "x", ",", "int", "y", ")", "{", "return", "MisoUtil", ".", "fullToScreen", "(", "_metrics", ",", "x", ",", "y", ",", "new", "Point", "(", ")", ")", ";", "}" ]
Converts the supplied full coordinates to screen coordinates.
[ "Converts", "the", "supplied", "full", "coordinates", "to", "screen", "coordinates", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L319-L322
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getFullCoords
public Point getFullCoords (int x, int y) { return MisoUtil.screenToFull(_metrics, x, y, new Point()); }
java
public Point getFullCoords (int x, int y) { return MisoUtil.screenToFull(_metrics, x, y, new Point()); }
[ "public", "Point", "getFullCoords", "(", "int", "x", ",", "int", "y", ")", "{", "return", "MisoUtil", ".", "screenToFull", "(", "_metrics", ",", "x", ",", "y", ",", "new", "Point", "(", ")", ")", ";", "}" ]
Converts the supplied screen coordinates to full coordinates.
[ "Converts", "the", "supplied", "screen", "coordinates", "to", "full", "coordinates", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L327-L330
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getTileCoords
public Point getTileCoords (int x, int y) { return MisoUtil.screenToTile(_metrics, x, y, new Point()); }
java
public Point getTileCoords (int x, int y) { return MisoUtil.screenToTile(_metrics, x, y, new Point()); }
[ "public", "Point", "getTileCoords", "(", "int", "x", ",", "int", "y", ")", "{", "return", "MisoUtil", ".", "screenToTile", "(", "_metrics", ",", "x", ",", "y", ",", "new", "Point", "(", ")", ")", ";", "}" ]
Converts the supplied screen coordinates to tile coordinates.
[ "Converts", "the", "supplied", "screen", "coordinates", "to", "tile", "coordinates", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L335-L338
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.reportMemoryUsage
public void reportMemoryUsage () { Map<Tile.Key,BaseTile> base = Maps.newHashMap(); Set<BaseTile> fringe = Sets.newHashSet(); Map<Tile.Key,ObjectTile> object = Maps.newHashMap(); long[] usage = new long[3]; for (SceneBlock block : _blocks.values()) { block.computeMemoryUsage(base, fringe, object, usage); } log.info("Scene tile memory usage", "scene", StringUtil.shortClassName(this), "base", base.size() + "->" + (usage[0] / 1024) + "k", "fringe", fringe.size() + "->" + (usage[1] / 1024) + "k", "obj", object.size() + "->" + (usage[2] / 1024) + "k"); }
java
public void reportMemoryUsage () { Map<Tile.Key,BaseTile> base = Maps.newHashMap(); Set<BaseTile> fringe = Sets.newHashSet(); Map<Tile.Key,ObjectTile> object = Maps.newHashMap(); long[] usage = new long[3]; for (SceneBlock block : _blocks.values()) { block.computeMemoryUsage(base, fringe, object, usage); } log.info("Scene tile memory usage", "scene", StringUtil.shortClassName(this), "base", base.size() + "->" + (usage[0] / 1024) + "k", "fringe", fringe.size() + "->" + (usage[1] / 1024) + "k", "obj", object.size() + "->" + (usage[2] / 1024) + "k"); }
[ "public", "void", "reportMemoryUsage", "(", ")", "{", "Map", "<", "Tile", ".", "Key", ",", "BaseTile", ">", "base", "=", "Maps", ".", "newHashMap", "(", ")", ";", "Set", "<", "BaseTile", ">", "fringe", "=", "Sets", ".", "newHashSet", "(", ")", ";", ...
Reports the memory usage of the resolved tiles in the current scene block.
[ "Reports", "the", "memory", "usage", "of", "the", "resolved", "tiles", "in", "the", "current", "scene", "block", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L353-L367
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.handleObjectPressed
protected void handleObjectPressed (final SceneObject scobj, int mx, int my) { String action = scobj.info.action; final ObjectActionHandler handler = ObjectActionHandler.lookup(action); // if there's no handler, just fire the action immediately if (handler == null) { fireObjectAction(null, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // if the action's not allowed, pretend like we handled it if (!handler.actionAllowed(action)) { return; } // if there's no menu for this object, fire the action immediately RadialMenu menu = handler.handlePressed(scobj); if (menu == null) { fireObjectAction(handler, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // make the menu surround the clicked object, but with consistent size Rectangle mbounds = getRadialMenuBounds(scobj); _activeMenu = menu; _activeMenu.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e) { if (e instanceof CommandEvent) { fireObjectAction(handler, scobj, e); } else { SceneObjectActionEvent event = new SceneObjectActionEvent( e.getSource(), e.getID(), e.getActionCommand(), e.getModifiers(), scobj); fireObjectAction(handler, scobj, event); } } }); _activeMenu.activate(this, mbounds, scobj); }
java
protected void handleObjectPressed (final SceneObject scobj, int mx, int my) { String action = scobj.info.action; final ObjectActionHandler handler = ObjectActionHandler.lookup(action); // if there's no handler, just fire the action immediately if (handler == null) { fireObjectAction(null, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // if the action's not allowed, pretend like we handled it if (!handler.actionAllowed(action)) { return; } // if there's no menu for this object, fire the action immediately RadialMenu menu = handler.handlePressed(scobj); if (menu == null) { fireObjectAction(handler, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // make the menu surround the clicked object, but with consistent size Rectangle mbounds = getRadialMenuBounds(scobj); _activeMenu = menu; _activeMenu.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e) { if (e instanceof CommandEvent) { fireObjectAction(handler, scobj, e); } else { SceneObjectActionEvent event = new SceneObjectActionEvent( e.getSource(), e.getID(), e.getActionCommand(), e.getModifiers(), scobj); fireObjectAction(handler, scobj, event); } } }); _activeMenu.activate(this, mbounds, scobj); }
[ "protected", "void", "handleObjectPressed", "(", "final", "SceneObject", "scobj", ",", "int", "mx", ",", "int", "my", ")", "{", "String", "action", "=", "scobj", ".", "info", ".", "action", ";", "final", "ObjectActionHandler", "handler", "=", "ObjectActionHand...
Called when the user presses the mouse button over an object.
[ "Called", "when", "the", "user", "presses", "the", "mouse", "button", "over", "an", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L443-L485
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.fireObjectAction
protected void fireObjectAction ( ObjectActionHandler handler, SceneObject scobj, ActionEvent event) { if (handler == null) { Controller.postAction(event); } else { handler.handleAction(scobj, event); } }
java
protected void fireObjectAction ( ObjectActionHandler handler, SceneObject scobj, ActionEvent event) { if (handler == null) { Controller.postAction(event); } else { handler.handleAction(scobj, event); } }
[ "protected", "void", "fireObjectAction", "(", "ObjectActionHandler", "handler", ",", "SceneObject", "scobj", ",", "ActionEvent", "event", ")", "{", "if", "(", "handler", "==", "null", ")", "{", "Controller", ".", "postAction", "(", "event", ")", ";", "}", "e...
Called when an object or object menu item has been clicked.
[ "Called", "when", "an", "object", "or", "object", "menu", "item", "has", "been", "clicked", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L519-L527
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.appendDirtySprite
protected void appendDirtySprite (DirtyItemList list, Sprite sprite) { MisoUtil.screenToTile(_metrics, sprite.getX(), sprite.getY(), _tcoords); list.appendDirtySprite(sprite, _tcoords.x, _tcoords.y); }
java
protected void appendDirtySprite (DirtyItemList list, Sprite sprite) { MisoUtil.screenToTile(_metrics, sprite.getX(), sprite.getY(), _tcoords); list.appendDirtySprite(sprite, _tcoords.x, _tcoords.y); }
[ "protected", "void", "appendDirtySprite", "(", "DirtyItemList", "list", ",", "Sprite", "sprite", ")", "{", "MisoUtil", ".", "screenToTile", "(", "_metrics", ",", "sprite", ".", "getX", "(", ")", ",", "sprite", ".", "getY", "(", ")", ",", "_tcoords", ")", ...
Computes the tile coordinates of the supplied sprite and appends it to the supplied dirty item list.
[ "Computes", "the", "tile", "coordinates", "of", "the", "supplied", "sprite", "and", "appends", "it", "to", "the", "supplied", "dirty", "item", "list", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L756-L760
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.blockAbandoned
protected void blockAbandoned (SceneBlock block) { if (_dpanel != null) { _dpanel.blockCleared(block); } blockFinished(block); }
java
protected void blockAbandoned (SceneBlock block) { if (_dpanel != null) { _dpanel.blockCleared(block); } blockFinished(block); }
[ "protected", "void", "blockAbandoned", "(", "SceneBlock", "block", ")", "{", "if", "(", "_dpanel", "!=", "null", ")", "{", "_dpanel", ".", "blockCleared", "(", "block", ")", ";", "}", "blockFinished", "(", "block", ")", ";", "}" ]
Called by the scene block if it has come up for resolution but is no longer influential.
[ "Called", "by", "the", "scene", "block", "if", "it", "has", "come", "up", "for", "resolution", "but", "is", "no", "longer", "influential", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L902-L909
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.blockResolved
protected void blockResolved (SceneBlock block) { if (_dpanel != null) { _dpanel.resolvedBlock(block); } Rectangle sbounds = block.getScreenBounds(); if (!_delayRepaint && sbounds != null && sbounds.intersects(_vbounds)) { // warnVisible(block, sbounds); // if we have yet further blocks to resolve, queue up a repaint now so that we get these // data onscreen as quickly as possible if (_pendingBlocks > 1) { recomputeVisible(); _remgr.invalidateRegion(sbounds); } } blockFinished(block); }
java
protected void blockResolved (SceneBlock block) { if (_dpanel != null) { _dpanel.resolvedBlock(block); } Rectangle sbounds = block.getScreenBounds(); if (!_delayRepaint && sbounds != null && sbounds.intersects(_vbounds)) { // warnVisible(block, sbounds); // if we have yet further blocks to resolve, queue up a repaint now so that we get these // data onscreen as quickly as possible if (_pendingBlocks > 1) { recomputeVisible(); _remgr.invalidateRegion(sbounds); } } blockFinished(block); }
[ "protected", "void", "blockResolved", "(", "SceneBlock", "block", ")", "{", "if", "(", "_dpanel", "!=", "null", ")", "{", "_dpanel", ".", "resolvedBlock", "(", "block", ")", ";", "}", "Rectangle", "sbounds", "=", "block", ".", "getScreenBounds", "(", ")", ...
Called by a scene block when it has completed its resolution process.
[ "Called", "by", "a", "scene", "block", "when", "it", "has", "completed", "its", "resolution", "process", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L914-L932
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.blockFinished
protected void blockFinished (SceneBlock block) { --_pendingBlocks; // once all the visible pending blocks have completed their // resolution, recompute our visible object set and show ourselves if (_visiBlocks.remove(block) && _visiBlocks.size() == 0) { allBlocksFinished(); } }
java
protected void blockFinished (SceneBlock block) { --_pendingBlocks; // once all the visible pending blocks have completed their // resolution, recompute our visible object set and show ourselves if (_visiBlocks.remove(block) && _visiBlocks.size() == 0) { allBlocksFinished(); } }
[ "protected", "void", "blockFinished", "(", "SceneBlock", "block", ")", "{", "--", "_pendingBlocks", ";", "// once all the visible pending blocks have completed their", "// resolution, recompute our visible object set and show ourselves", "if", "(", "_visiBlocks", ".", "remove", "...
Called whenever a block is done resolving, whether it was successfully resolved or if it was abandoned.
[ "Called", "whenever", "a", "block", "is", "done", "resolving", "whether", "it", "was", "successfully", "resolved", "or", "if", "it", "was", "abandoned", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L938-L947
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.allBlocksFinished
protected void allBlocksFinished () { recomputeVisible(); log.info("Restoring repaint... ", "left", _pendingBlocks, "view", StringUtil.toString(_vbounds)); _delayRepaint = false; // Need to restore visibility as it may have been turned of as a result of the delay setVisible(true); _remgr.invalidateRegion(_vbounds); }
java
protected void allBlocksFinished () { recomputeVisible(); log.info("Restoring repaint... ", "left", _pendingBlocks, "view", StringUtil.toString(_vbounds)); _delayRepaint = false; // Need to restore visibility as it may have been turned of as a result of the delay setVisible(true); _remgr.invalidateRegion(_vbounds); }
[ "protected", "void", "allBlocksFinished", "(", ")", "{", "recomputeVisible", "(", ")", ";", "log", ".", "info", "(", "\"Restoring repaint... \"", ",", "\"left\"", ",", "_pendingBlocks", ",", "\"view\"", ",", "StringUtil", ".", "toString", "(", "_vbounds", ")", ...
Called to handle the proceedings once our last resolving block has been finished.
[ "Called", "to", "handle", "the", "proceedings", "once", "our", "last", "resolving", "block", "has", "been", "finished", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L952-L961
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.warnVisible
protected void warnVisible (SceneBlock block, Rectangle sbounds) { log.warning("Block visible during resolution " + block + " sbounds:" + StringUtil.toString(sbounds) + " vbounds:" + StringUtil.toString(_vbounds) + "."); }
java
protected void warnVisible (SceneBlock block, Rectangle sbounds) { log.warning("Block visible during resolution " + block + " sbounds:" + StringUtil.toString(sbounds) + " vbounds:" + StringUtil.toString(_vbounds) + "."); }
[ "protected", "void", "warnVisible", "(", "SceneBlock", "block", ",", "Rectangle", "sbounds", ")", "{", "log", ".", "warning", "(", "\"Block visible during resolution \"", "+", "block", "+", "\" sbounds:\"", "+", "StringUtil", ".", "toString", "(", "sbounds", ")", ...
Issues a warning to the error log that the specified block became visible prior to being resolved. Derived classes may wish to augment or inhibit this warning.
[ "Issues", "a", "warning", "to", "the", "error", "log", "that", "the", "specified", "block", "became", "visible", "prior", "to", "being", "resolved", ".", "Derived", "classes", "may", "wish", "to", "augment", "or", "inhibit", "this", "warning", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L967-L972
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.recomputeVisible
protected void recomputeVisible () { // flush our visible object set which we'll recreate later _vizobjs.clear(); Rectangle vbounds = new Rectangle( _vbounds.x-_metrics.tilewid, _vbounds.y-_metrics.tilehei, _vbounds.width+2*_metrics.tilewid, _vbounds.height+2*_metrics.tilehei); for (SceneBlock block : _blocks.values()) { if (!block.isResolved()) { continue; } // links this block to its neighbors; computes coverage block.update(_blocks); // see which of this block's objects are visible SceneObject[] objs = block.getObjects(); for (SceneObject obj : objs) { if (obj.bounds != null && vbounds.intersects(obj.bounds)) { _vizobjs.add(obj); } } } // recompute our object indicators computeIndicators(); // Log.info("Computed " + _vizobjs.size() + " visible objects from " + // _blocks.size() + " blocks."); // Log.info(StringUtil.listToString(_vizobjs, new StringUtil.Formatter() { // public String toString (Object object) { // SceneObject scobj = (SceneObject)object; // return (TileUtil.getTileSetId(scobj.info.tileId) + ":" + // TileUtil.getTileIndex(scobj.info.tileId)); // } // })); }
java
protected void recomputeVisible () { // flush our visible object set which we'll recreate later _vizobjs.clear(); Rectangle vbounds = new Rectangle( _vbounds.x-_metrics.tilewid, _vbounds.y-_metrics.tilehei, _vbounds.width+2*_metrics.tilewid, _vbounds.height+2*_metrics.tilehei); for (SceneBlock block : _blocks.values()) { if (!block.isResolved()) { continue; } // links this block to its neighbors; computes coverage block.update(_blocks); // see which of this block's objects are visible SceneObject[] objs = block.getObjects(); for (SceneObject obj : objs) { if (obj.bounds != null && vbounds.intersects(obj.bounds)) { _vizobjs.add(obj); } } } // recompute our object indicators computeIndicators(); // Log.info("Computed " + _vizobjs.size() + " visible objects from " + // _blocks.size() + " blocks."); // Log.info(StringUtil.listToString(_vizobjs, new StringUtil.Formatter() { // public String toString (Object object) { // SceneObject scobj = (SceneObject)object; // return (TileUtil.getTileSetId(scobj.info.tileId) + ":" + // TileUtil.getTileIndex(scobj.info.tileId)); // } // })); }
[ "protected", "void", "recomputeVisible", "(", ")", "{", "// flush our visible object set which we'll recreate later", "_vizobjs", ".", "clear", "(", ")", ";", "Rectangle", "vbounds", "=", "new", "Rectangle", "(", "_vbounds", ".", "x", "-", "_metrics", ".", "tilewid"...
Recomputes our set of visible objects and their indicators.
[ "Recomputes", "our", "set", "of", "visible", "objects", "and", "their", "indicators", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L977-L1018
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.computeIndicators
public void computeIndicators () { Map<SceneObject, SceneObjectIndicator> _unupdated = Maps.newHashMap(_indicators); for (int ii = 0, nn = _vizobjs.size(); ii < nn; ii++) { SceneObject scobj = _vizobjs.get(ii); String action = scobj.info.action; // if the object has no action, skip it if (StringUtil.isBlank(action)) { continue; } // if we have an object action handler, possibly let them veto // the display of this tooltip and action ObjectActionHandler oah = ObjectActionHandler.lookup(action); if (oah != null && !oah.isVisible(action)) { continue; } String tiptext = getTipText(scobj, action); if (tiptext != null) { Icon icon = getTipIcon(scobj, action); SceneObjectIndicator indic = _unupdated.remove(scobj); if (indic == null) { // let the object action handler create the indicator if it exists, otherwise // just use a regular tip if (oah != null) { indic = oah.createIndicator(this, tiptext, icon); } else { indic = new SceneObjectTip(tiptext, icon); } _indicators.put(scobj, indic); } else { indic.update(icon, tiptext); } dirtyIndicator(indic); } } // clear out any no longer used indicators for (SceneObject toremove : _unupdated.keySet()) { SceneObjectIndicator indic = _indicators.remove(toremove); indic.removed(); dirtyIndicator(indic); } _indicatorsLaidOut = false; }
java
public void computeIndicators () { Map<SceneObject, SceneObjectIndicator> _unupdated = Maps.newHashMap(_indicators); for (int ii = 0, nn = _vizobjs.size(); ii < nn; ii++) { SceneObject scobj = _vizobjs.get(ii); String action = scobj.info.action; // if the object has no action, skip it if (StringUtil.isBlank(action)) { continue; } // if we have an object action handler, possibly let them veto // the display of this tooltip and action ObjectActionHandler oah = ObjectActionHandler.lookup(action); if (oah != null && !oah.isVisible(action)) { continue; } String tiptext = getTipText(scobj, action); if (tiptext != null) { Icon icon = getTipIcon(scobj, action); SceneObjectIndicator indic = _unupdated.remove(scobj); if (indic == null) { // let the object action handler create the indicator if it exists, otherwise // just use a regular tip if (oah != null) { indic = oah.createIndicator(this, tiptext, icon); } else { indic = new SceneObjectTip(tiptext, icon); } _indicators.put(scobj, indic); } else { indic.update(icon, tiptext); } dirtyIndicator(indic); } } // clear out any no longer used indicators for (SceneObject toremove : _unupdated.keySet()) { SceneObjectIndicator indic = _indicators.remove(toremove); indic.removed(); dirtyIndicator(indic); } _indicatorsLaidOut = false; }
[ "public", "void", "computeIndicators", "(", ")", "{", "Map", "<", "SceneObject", ",", "SceneObjectIndicator", ">", "_unupdated", "=", "Maps", ".", "newHashMap", "(", "_indicators", ")", ";", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "_vizobjs", ...
Compute the indicators for any objects in the scene.
[ "Compute", "the", "indicators", "for", "any", "objects", "in", "the", "scene", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1032-L1078
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getTipText
protected String getTipText (SceneObject scobj, String action) { ObjectActionHandler oah = ObjectActionHandler.lookup(action); return (oah == null) ? action : oah.getTipText(action); }
java
protected String getTipText (SceneObject scobj, String action) { ObjectActionHandler oah = ObjectActionHandler.lookup(action); return (oah == null) ? action : oah.getTipText(action); }
[ "protected", "String", "getTipText", "(", "SceneObject", "scobj", ",", "String", "action", ")", "{", "ObjectActionHandler", "oah", "=", "ObjectActionHandler", ".", "lookup", "(", "action", ")", ";", "return", "(", "oah", "==", "null", ")", "?", "action", ":"...
Derived classes can provide human readable object tips via this method.
[ "Derived", "classes", "can", "provide", "human", "readable", "object", "tips", "via", "this", "method", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1083-L1087
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getTipIcon
protected Icon getTipIcon (SceneObject scobj, String action) { ObjectActionHandler oah = ObjectActionHandler.lookup(action); return (oah == null) ? null : oah.getTipIcon(action); }
java
protected Icon getTipIcon (SceneObject scobj, String action) { ObjectActionHandler oah = ObjectActionHandler.lookup(action); return (oah == null) ? null : oah.getTipIcon(action); }
[ "protected", "Icon", "getTipIcon", "(", "SceneObject", "scobj", ",", "String", "action", ")", "{", "ObjectActionHandler", "oah", "=", "ObjectActionHandler", ".", "lookup", "(", "action", ")", ";", "return", "(", "oah", "==", "null", ")", "?", "null", ":", ...
Provides an icon for this tooltip, the default looks up an object action handler for the action and requests the icon from it.
[ "Provides", "an", "icon", "for", "this", "tooltip", "the", "default", "looks", "up", "an", "object", "action", "handler", "for", "the", "action", "and", "requests", "the", "icon", "from", "it", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1093-L1097
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.dirtyIndicator
protected void dirtyIndicator (SceneObjectIndicator indic) { if (indic != null) { Rectangle r = indic.getBounds(); if (r != null) { _remgr.invalidateRegion(r); } } }
java
protected void dirtyIndicator (SceneObjectIndicator indic) { if (indic != null) { Rectangle r = indic.getBounds(); if (r != null) { _remgr.invalidateRegion(r); } } }
[ "protected", "void", "dirtyIndicator", "(", "SceneObjectIndicator", "indic", ")", "{", "if", "(", "indic", "!=", "null", ")", "{", "Rectangle", "r", "=", "indic", ".", "getBounds", "(", ")", ";", "if", "(", "r", "!=", "null", ")", "{", "_remgr", ".", ...
Dirties the specified indicator.
[ "Dirties", "the", "specified", "indicator", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1102-L1110
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.changeHoverObject
protected void changeHoverObject (Object newHover) { if (newHover == _hobject) { return; } Object oldHover = _hobject; _hobject = newHover; hoverObjectChanged(oldHover, newHover); }
java
protected void changeHoverObject (Object newHover) { if (newHover == _hobject) { return; } Object oldHover = _hobject; _hobject = newHover; hoverObjectChanged(oldHover, newHover); }
[ "protected", "void", "changeHoverObject", "(", "Object", "newHover", ")", "{", "if", "(", "newHover", "==", "_hobject", ")", "{", "return", ";", "}", "Object", "oldHover", "=", "_hobject", ";", "_hobject", "=", "newHover", ";", "hoverObjectChanged", "(", "ol...
Change the hover object to the new object.
[ "Change", "the", "hover", "object", "to", "the", "new", "object", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1115-L1123
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.hoverObjectChanged
protected void hoverObjectChanged (Object oldHover, Object newHover) { // deal with objects that care about being hovered over if (oldHover instanceof SceneObject) { SceneObject oldhov = (SceneObject)oldHover; if (oldhov.setHovered(false)) { _remgr.invalidateRegion(oldhov.bounds); } } if (newHover instanceof SceneObject) { SceneObject newhov = (SceneObject)newHover; if (newhov.setHovered(true)) { _remgr.invalidateRegion(newhov.bounds); } } // dirty the indicators associated with the hover objects dirtyIndicator(_indicators.get(oldHover)); dirtyIndicator(_indicators.get(newHover)); }
java
protected void hoverObjectChanged (Object oldHover, Object newHover) { // deal with objects that care about being hovered over if (oldHover instanceof SceneObject) { SceneObject oldhov = (SceneObject)oldHover; if (oldhov.setHovered(false)) { _remgr.invalidateRegion(oldhov.bounds); } } if (newHover instanceof SceneObject) { SceneObject newhov = (SceneObject)newHover; if (newhov.setHovered(true)) { _remgr.invalidateRegion(newhov.bounds); } } // dirty the indicators associated with the hover objects dirtyIndicator(_indicators.get(oldHover)); dirtyIndicator(_indicators.get(newHover)); }
[ "protected", "void", "hoverObjectChanged", "(", "Object", "oldHover", ",", "Object", "newHover", ")", "{", "// deal with objects that care about being hovered over", "if", "(", "oldHover", "instanceof", "SceneObject", ")", "{", "SceneObject", "oldhov", "=", "(", "SceneO...
A place for subclasses to react to the hover object changing. One of the supplied arguments may be null.
[ "A", "place", "for", "subclasses", "to", "react", "to", "the", "hover", "object", "changing", ".", "One", "of", "the", "supplied", "arguments", "may", "be", "null", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1129-L1148
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getHitObjects
protected void getHitObjects (DirtyItemList list, int x, int y) { for (SceneObject scobj : _vizobjs) { Rectangle pbounds = scobj.bounds; if (!pbounds.contains(x, y)) { continue; } // see if we should skip it if (skipHitObject(scobj)) { continue; } // now check that the pixel in the tile image is non-transparent at that point if (!scobj.tile.hitTest(x - pbounds.x, y - pbounds.y)) { continue; } // we've passed the test, add the object to the list list.appendDirtyObject(scobj); } }
java
protected void getHitObjects (DirtyItemList list, int x, int y) { for (SceneObject scobj : _vizobjs) { Rectangle pbounds = scobj.bounds; if (!pbounds.contains(x, y)) { continue; } // see if we should skip it if (skipHitObject(scobj)) { continue; } // now check that the pixel in the tile image is non-transparent at that point if (!scobj.tile.hitTest(x - pbounds.x, y - pbounds.y)) { continue; } // we've passed the test, add the object to the list list.appendDirtyObject(scobj); } }
[ "protected", "void", "getHitObjects", "(", "DirtyItemList", "list", ",", "int", "x", ",", "int", "y", ")", "{", "for", "(", "SceneObject", "scobj", ":", "_vizobjs", ")", "{", "Rectangle", "pbounds", "=", "scobj", ".", "bounds", ";", "if", "(", "!", "pb...
Adds to the supplied dirty item list, all of the object tiles that are hit by the specified point (meaning the point is contained within their bounds and intersects a non-transparent pixel in the actual object image.
[ "Adds", "to", "the", "supplied", "dirty", "item", "list", "all", "of", "the", "object", "tiles", "that", "are", "hit", "by", "the", "specified", "point", "(", "meaning", "the", "point", "is", "contained", "within", "their", "bounds", "and", "intersects", "...
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1155-L1176
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.paintBits
@Override protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty) { _animmgr.paint(gfx, layer, dirty); }
java
@Override protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty) { _animmgr.paint(gfx, layer, dirty); }
[ "@", "Override", "protected", "void", "paintBits", "(", "Graphics2D", "gfx", ",", "int", "layer", ",", "Rectangle", "dirty", ")", "{", "_animmgr", ".", "paint", "(", "gfx", ",", "layer", ",", "dirty", ")", ";", "}" ]
We don't want sprites rendered using the standard mechanism because we intersperse them with objects in our scene and need to manage their z-order.
[ "We", "don", "t", "want", "sprites", "rendered", "using", "the", "standard", "mechanism", "because", "we", "intersperse", "them", "with", "objects", "in", "our", "scene", "and", "need", "to", "manage", "their", "z", "-", "order", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1253-L1257
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.paintDirtyItems
protected void paintDirtyItems (Graphics2D gfx, Rectangle clip) { // add any sprites impacted by the dirty rectangle _dirtySprites.clear(); _spritemgr.getIntersectingSprites(_dirtySprites, clip); int size = _dirtySprites.size(); for (int ii = 0; ii < size; ii++) { Sprite sprite = _dirtySprites.get(ii); Rectangle bounds = sprite.getBounds(); if (!bounds.intersects(clip)) { continue; } appendDirtySprite(_dirtyItems, sprite); // Log.info("Dirtied item: " + sprite); } // add any objects impacted by the dirty rectangle for (SceneObject scobj : _vizobjs) { if (!scobj.bounds.intersects(clip)) { continue; } _dirtyItems.appendDirtyObject(scobj); // Log.info("Dirtied item: " + scobj); } // Log.info("paintDirtyItems [items=" + _dirtyItems.size() + "]."); // sort the dirty items so that we can paint them back-to-front _dirtyItems.sort(); _dirtyItems.paintAndClear(gfx); }
java
protected void paintDirtyItems (Graphics2D gfx, Rectangle clip) { // add any sprites impacted by the dirty rectangle _dirtySprites.clear(); _spritemgr.getIntersectingSprites(_dirtySprites, clip); int size = _dirtySprites.size(); for (int ii = 0; ii < size; ii++) { Sprite sprite = _dirtySprites.get(ii); Rectangle bounds = sprite.getBounds(); if (!bounds.intersects(clip)) { continue; } appendDirtySprite(_dirtyItems, sprite); // Log.info("Dirtied item: " + sprite); } // add any objects impacted by the dirty rectangle for (SceneObject scobj : _vizobjs) { if (!scobj.bounds.intersects(clip)) { continue; } _dirtyItems.appendDirtyObject(scobj); // Log.info("Dirtied item: " + scobj); } // Log.info("paintDirtyItems [items=" + _dirtyItems.size() + "]."); // sort the dirty items so that we can paint them back-to-front _dirtyItems.sort(); _dirtyItems.paintAndClear(gfx); }
[ "protected", "void", "paintDirtyItems", "(", "Graphics2D", "gfx", ",", "Rectangle", "clip", ")", "{", "// add any sprites impacted by the dirty rectangle", "_dirtySprites", ".", "clear", "(", ")", ";", "_spritemgr", ".", "getIntersectingSprites", "(", "_dirtySprites", "...
Renders the dirty sprites and objects in the scene to the given graphics context.
[ "Renders", "the", "dirty", "sprites", "and", "objects", "in", "the", "scene", "to", "the", "given", "graphics", "context", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1272-L1302
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.paintIndicators
protected void paintIndicators (Graphics2D gfx, Rectangle clip) { // make sure the indicators are ready if (!_indicatorsLaidOut) { for (Map.Entry<SceneObject, SceneObjectIndicator> entry : _indicators.entrySet()) { SceneObjectIndicator indic = entry.getValue(); if (!indic.isLaidOut()) { indic.layout(gfx, entry.getKey(), _vbounds); dirtyIndicator(indic); } } _indicatorsLaidOut = true; } if (checkShowFlag(SHOW_TIPS)) { // show all the indicators for (SceneObjectIndicator indic : _indicators.values()) { paintIndicator(gfx, clip, indic); } } else { // show maybe one indicator SceneObjectIndicator indic = _indicators.get(_hobject); if (indic != null) { paintIndicator(gfx, clip, indic); } } }
java
protected void paintIndicators (Graphics2D gfx, Rectangle clip) { // make sure the indicators are ready if (!_indicatorsLaidOut) { for (Map.Entry<SceneObject, SceneObjectIndicator> entry : _indicators.entrySet()) { SceneObjectIndicator indic = entry.getValue(); if (!indic.isLaidOut()) { indic.layout(gfx, entry.getKey(), _vbounds); dirtyIndicator(indic); } } _indicatorsLaidOut = true; } if (checkShowFlag(SHOW_TIPS)) { // show all the indicators for (SceneObjectIndicator indic : _indicators.values()) { paintIndicator(gfx, clip, indic); } } else { // show maybe one indicator SceneObjectIndicator indic = _indicators.get(_hobject); if (indic != null) { paintIndicator(gfx, clip, indic); } } }
[ "protected", "void", "paintIndicators", "(", "Graphics2D", "gfx", ",", "Rectangle", "clip", ")", "{", "// make sure the indicators are ready", "if", "(", "!", "_indicatorsLaidOut", ")", "{", "for", "(", "Map", ".", "Entry", "<", "SceneObject", ",", "SceneObjectInd...
Paint all the appropriate indicators for our scene objects.
[ "Paint", "all", "the", "appropriate", "indicators", "for", "our", "scene", "objects", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1318-L1345
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.paintIndicator
protected void paintIndicator (Graphics2D gfx, Rectangle clip, SceneObjectIndicator tip) { if (clip.intersects(tip.getBounds())) { tip.paint(gfx); } }
java
protected void paintIndicator (Graphics2D gfx, Rectangle clip, SceneObjectIndicator tip) { if (clip.intersects(tip.getBounds())) { tip.paint(gfx); } }
[ "protected", "void", "paintIndicator", "(", "Graphics2D", "gfx", ",", "Rectangle", "clip", ",", "SceneObjectIndicator", "tip", ")", "{", "if", "(", "clip", ".", "intersects", "(", "tip", ".", "getBounds", "(", ")", ")", ")", "{", "tip", ".", "paint", "("...
Paint the specified indicator if it intersects the clipping rectangle.
[ "Paint", "the", "specified", "indicator", "if", "it", "intersects", "the", "clipping", "rectangle", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1350-L1355
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.paintTiles
protected void paintTiles (Graphics2D gfx, Rectangle clip) { // go through rendering our tiles _paintOp.setGraphics(gfx); _applicator.applyToTiles(clip, _paintOp); _paintOp.setGraphics(null); }
java
protected void paintTiles (Graphics2D gfx, Rectangle clip) { // go through rendering our tiles _paintOp.setGraphics(gfx); _applicator.applyToTiles(clip, _paintOp); _paintOp.setGraphics(null); }
[ "protected", "void", "paintTiles", "(", "Graphics2D", "gfx", ",", "Rectangle", "clip", ")", "{", "// go through rendering our tiles", "_paintOp", ".", "setGraphics", "(", "gfx", ")", ";", "_applicator", ".", "applyToTiles", "(", "clip", ",", "_paintOp", ")", ";"...
Renders the base and fringe layer tiles that intersect the specified clipping rectangle.
[ "Renders", "the", "base", "and", "fringe", "layer", "tiles", "that", "intersect", "the", "specified", "clipping", "rectangle", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1361-L1367
train
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.fillTile
protected void fillTile ( Graphics2D gfx, int tx, int ty, Color color) { Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_FILL_TILE); Polygon poly = MisoUtil.getTilePolygon(_metrics, tx, ty); gfx.setColor(color); gfx.fill(poly); gfx.setComposite(ocomp); }
java
protected void fillTile ( Graphics2D gfx, int tx, int ty, Color color) { Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_FILL_TILE); Polygon poly = MisoUtil.getTilePolygon(_metrics, tx, ty); gfx.setColor(color); gfx.fill(poly); gfx.setComposite(ocomp); }
[ "protected", "void", "fillTile", "(", "Graphics2D", "gfx", ",", "int", "tx", ",", "int", "ty", ",", "Color", "color", ")", "{", "Composite", "ocomp", "=", "gfx", ".", "getComposite", "(", ")", ";", "gfx", ".", "setComposite", "(", "ALPHA_FILL_TILE", ")",...
Fills the specified tile with the given color at 50% alpha. Intended for debug-only tile highlighting purposes.
[ "Fills", "the", "specified", "tile", "with", "the", "given", "color", "at", "50%", "alpha", ".", "Intended", "for", "debug", "-", "only", "tile", "highlighting", "purposes", "." ]
3165a012fd859009db3367f87bd2a5b820cc760a
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1373-L1382
train