From b4409dfb5c0b3af31919c5c7c71957946586d3bb Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Thu, 26 May 2011 17:31:25 +0000 Subject: [PATCH] Whitespace git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@1167 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../bundle/BundledComponentRepository.java | 61 +++++++---------- .../com/threerings/cast/util/CastUtil.java | 7 +- .../media/AbstractMediaManager.java | 2 +- .../media/animation/AnimationArranger.java | 3 +- .../animation/AnimationFrameSequencer.java | 66 +++++++------------ .../media/animation/ExplodeAnimation.java | 3 +- .../animation/SequencedAnimationObserver.java | 3 +- .../threerings/media/effects/FadeEffect.java | 3 +- .../threerings/media/image/ColorPository.java | 4 +- .../threerings/media/image/Colorization.java | 3 +- .../com/threerings/media/image/ImageUtil.java | 6 +- .../tile/SimpleCachingImageProvider.java | 2 +- .../threerings/media/tile/TileManager.java | 6 +- .../com/threerings/media/tile/TileSet.java | 12 ++-- .../threerings/media/tools/RecolorImage.java | 4 +- .../threerings/media/util/FrameSequencer.java | 53 ++++++--------- .../com/threerings/media/util/MathUtil.java | 21 +++--- .../com/threerings/miso/util/MisoContext.java | 7 +- .../threerings/openal/OpenALSoundPlayer.java | 12 ++-- 19 files changed, 104 insertions(+), 174 deletions(-) diff --git a/src/main/java/com/threerings/cast/bundle/BundledComponentRepository.java b/src/main/java/com/threerings/cast/bundle/BundledComponentRepository.java index d982adba..7ae71d02 100644 --- a/src/main/java/com/threerings/cast/bundle/BundledComponentRepository.java +++ b/src/main/java/com/threerings/cast/bundle/BundledComponentRepository.java @@ -290,33 +290,29 @@ public class BundledComponentRepository /** * Constructs an instance that will obtain image data from the specified resource bundle. */ - public ResourceBundleProvider (ImageManager imgr, ResourceBundle bundle) - { + public ResourceBundleProvider (ImageManager imgr, ResourceBundle bundle) { super(imgr, (String)null); _dprov = this; _bundle = bundle; } // from interface ImageDataProvider - public String getIdent () - { + public String getIdent () { return "bcr:" + _bundle.getIdent(); } // from interface ImageDataProvider - public BufferedImage loadImage (String path) throws IOException - { + public BufferedImage loadImage (String path) throws IOException { return _bundle.getImageResource(path, true); } // from interface FrameProvider - public ActionFrames getFrames (CharacterComponent component, String action, String type) - { + public ActionFrames getFrames (CharacterComponent component, String action, String type) { // obtain the action sequence definition for this action ActionSequence actseq = _actions.get(action); if (actseq == null) { - log.warning("Missing action sequence definition [action=" + action + - ", component=" + component + "]."); + log.warning("Missing action sequence definition", + "action", action, "component", component); return null; } @@ -373,15 +369,15 @@ public class BundledComponentRepository return createTileSetFrameImage(aset, actseq); } catch (Exception e) { - log.warning("Error loading tset for action '" + imgpath + "' " + component + ".", e); + log.warning("Error loading tset for action '" + imgpath + "' " + component + ".", + e); return null; } } // from interface FrameProvider public String getFramePath (CharacterComponent component, String action, String type, - Set existentPaths) - { + Set existentPaths) { String actionPath = makePath(component, action, type); if(!existentPaths.contains(actionPath)) { return makePath(component, ActionSequence.DEFAULT_SEQUENCE, type); @@ -389,8 +385,7 @@ public class BundledComponentRepository return actionPath; } - protected String makePath(CharacterComponent component, String action, String type) - { + protected String makePath(CharacterComponent component, String action, String type) { String imgpath = action; if (type != null) { imgpath += "_" + type; @@ -400,8 +395,7 @@ public class BundledComponentRepository } @Override - public Mirage getTileImage (String path, Rectangle bounds, Colorization[] zations) - { + public Mirage getTileImage (String path, Rectangle bounds, Colorization[] zations) { // we don't need our images prepared for screen rendering BufferedImage src = _imgr.getImage(getImageKey(path), zations); float percentageOfDataBuffer = 1; @@ -429,8 +423,7 @@ public class BundledComponentRepository * Constructs a tileset frame image with the specified tileset and for the specified * orientation. */ - public TileSetFrameImage (TileSet set, ActionSequence actseq) - { + public TileSetFrameImage (TileSet set, ActionSequence actseq) { this(set, actseq, 0, 0); } @@ -438,8 +431,7 @@ public class BundledComponentRepository * Constructs a tileset frame image with the specified tileset and for the specified * orientation, with an optional translation. */ - public TileSetFrameImage (TileSet set, ActionSequence actseq, int dx, int dy) - { + public TileSetFrameImage (TileSet set, ActionSequence actseq, int dx, int dy) { _set = set; _actseq = actseq; _dx = dx; @@ -456,14 +448,12 @@ public class BundledComponentRepository } // documentation inherited from interface - public int getOrientationCount () - { + public int getOrientationCount () { return _ocount; } // documentation inherited from interface - public TrimmedMultiFrameImage getFrames (final int orient) - { + public TrimmedMultiFrameImage getFrames (final int orient) { return new TrimmedMultiFrameImage() { public int getFrameCount () { return _fcount; @@ -491,8 +481,7 @@ public class BundledComponentRepository }; } - protected void paintTile(Graphics2D g, int orient, int index, int x, int y) - { + protected void paintTile(Graphics2D g, int orient, int index, int x, int y) { _set.getTile(getTileIndex(orient, index)).paint(g, x + _dx, y + _dy); } @@ -507,36 +496,30 @@ public class BundledComponentRepository } // documentation inherited from interface - public int getXOrigin (int orient, int index) - { + public int getXOrigin (int orient, int index) { return _actseq.origin.x; } // documentation inherited from interface - public int getYOrigin (int orient, int index) - { + public int getYOrigin (int orient, int index) { return _actseq.origin.y; } // documentation inherited from interface - public ActionFrames cloneColorized (Colorization[] zations) - { + public ActionFrames cloneColorized (Colorization[] zations) { return new TileSetFrameImage(_set.clone(zations), _actseq); } // documentation inherited from interface - public ActionFrames cloneTranslated (int dx, int dy) - { + public ActionFrames cloneTranslated (int dx, int dy) { return new TileSetFrameImage(_set, _actseq, dx, dy); } - protected int getTileIndex (int orient, int index) - { + protected int getTileIndex (int orient, int index) { return _orients.get(orient) * _fcount + index; } - public Tile getTile (int orient, int index) - { + public Tile getTile (int orient, int index) { return _set.getTile(getTileIndex(orient, index)); } diff --git a/src/main/java/com/threerings/cast/util/CastUtil.java b/src/main/java/com/threerings/cast/util/CastUtil.java index 5deecb62..e21870fa 100644 --- a/src/main/java/com/threerings/cast/util/CastUtil.java +++ b/src/main/java/com/threerings/cast/util/CastUtil.java @@ -58,15 +58,14 @@ public class CastUtil // make sure the component class exists if (cclass == null) { - log.warning("Missing definition for component class " + - "[class=" + cname + "]."); + log.warning("Missing definition for component class", "class", cname); continue; } // make sure there are some components in this class Iterator iter = crepo.enumerateComponentIds(cclass); if (!iter.hasNext()) { - log.info("Skipping class for which we have no components [class=" + cclass + "]."); + log.info("Skipping class for which we have no components", "class", cclass); continue; } @@ -99,7 +98,7 @@ public class CastUtil int idx = RandomUtil.getInt(choices.size()); components[ii] = choices.get(idx).intValue(); } else { - log.info("Have no components in class [class=" + cclass + "]."); + log.info("Have no components in class", "class", cclass); } } diff --git a/src/main/java/com/threerings/media/AbstractMediaManager.java b/src/main/java/com/threerings/media/AbstractMediaManager.java index f11af3c0..7ec1fc0c 100644 --- a/src/main/java/com/threerings/media/AbstractMediaManager.java +++ b/src/main/java/com/threerings/media/AbstractMediaManager.java @@ -300,7 +300,7 @@ public abstract class AbstractMediaManager protected RegionManager _remgr; /** List of observers to notify at the end of the tick. */ - protected List,ObserverOp>> _notify = Lists.newArrayList(); + protected List, ObserverOp>> _notify = Lists.newArrayList(); /** Our render-order sorted list of media. */ @SuppressWarnings("unchecked") protected SortableArrayList _media = diff --git a/src/main/java/com/threerings/media/animation/AnimationArranger.java b/src/main/java/com/threerings/media/animation/AnimationArranger.java index 218361ef..36cb7d46 100644 --- a/src/main/java/com/threerings/media/animation/AnimationArranger.java +++ b/src/main/java/com/threerings/media/animation/AnimationArranger.java @@ -32,8 +32,7 @@ import com.samskivert.swing.util.SwingUtil; import static com.threerings.media.Log.log; /** - * A utility class for positioning animations such that they don't overlap, - * as best as possible. + * A utility class for positioning animations such that they don't overlap, as best as possible. */ public class AnimationArranger { diff --git a/src/main/java/com/threerings/media/animation/AnimationFrameSequencer.java b/src/main/java/com/threerings/media/animation/AnimationFrameSequencer.java index b68fedc6..3355d0d4 100644 --- a/src/main/java/com/threerings/media/animation/AnimationFrameSequencer.java +++ b/src/main/java/com/threerings/media/animation/AnimationFrameSequencer.java @@ -37,9 +37,8 @@ public interface AnimationFrameSequencer extends FrameSequencer public void setAnimation (Animation anim); /** - * A sequencer that can step through a series of frames in any order - * and speed and notify (via {@link SequencedAnimationObserver}) when - * specific frames are reached. + * A sequencer that can step through a series of frames in any order and speed and notify (via + * {@link SequencedAnimationObserver}) when specific frames are reached. */ public static class MultiFunction implements AnimationFrameSequencer { @@ -48,12 +47,10 @@ public interface AnimationFrameSequencer extends FrameSequencer * * @param sequence the ordering to display the frames. * @param msPerFrame the number of ms to display each frame. - * @param loop if false, the sequencer will report the end of - * the animation after progressing through all of the frames once, - * otherwise it will loop indefinitely. + * @param loop if false, the sequencer will report the end of the animation after + * progressing through all of the frames once, otherwise it will loop indefinitely. */ - public MultiFunction (int[] sequence, long msPerFrame, boolean loop) - { + public MultiFunction (int[] sequence, long msPerFrame, boolean loop) { _length = sequence.length; _sequence = sequence; setDelay(msPerFrame); @@ -66,20 +63,16 @@ public interface AnimationFrameSequencer extends FrameSequencer * * @param sequence the ordering to display the frames. * @param msPerFrame the number of ms to display each frame. - * @param marks if true for a frame, a FrameReachedEvent will - * be generated when that frame is reached. - * @param loop if false, the sequencer will report the end of - * the animation after progressing through all of the frames once, - * otherwise it will loop indefinitely. + * @param marks if true for a frame, a FrameReachedEvent will be generated when that frame + * is reached. + * @param loop if false, the sequencer will report the end of the animation after + * progressing through all of the frames once, otherwise it will loop indefinitely. */ - public MultiFunction ( - int[] sequence, long[] msPerFrame, boolean[] marks, boolean loop) - { + public MultiFunction (int[] sequence, long[] msPerFrame, boolean[] marks, boolean loop) { _length = sequence.length; if ((_length != msPerFrame.length) || (_length != marks.length)) { throw new IllegalArgumentException( - "All MultiFunction FrameSequencer arrays must be " + - "the same length."); + "All MultiFunction FrameSequencer arrays must be the same length."); } _sequence = sequence; @@ -91,18 +84,16 @@ public interface AnimationFrameSequencer extends FrameSequencer /** * Set the delay to use. */ - public void setDelay (long msPerFrame) - { + public void setDelay (long msPerFrame) { _delays = null; _delay = msPerFrame; } /** - * Set the length of the sequence we are to use, or 0 means set - * it to the length of the sequence array that we were constructed with. + * Set the length of the sequence we are to use, or 0 means set it to the length of the + * sequence array that we were constructed with. */ - public void setLength (int len) - { + public void setLength (int len) { _length = (len == 0) ? _sequence.length : len; if (_curIdx >= _length) { _curIdx = 0; @@ -112,14 +103,12 @@ public interface AnimationFrameSequencer extends FrameSequencer /** * Do we reset the animation on init? Default is true. */ - public void setResetOnInit (boolean resets) - { + public void setResetOnInit (boolean resets) { _resets = resets; } // documentation inherited from interface - public int init (MultiFrameImage source) - { + public int init (MultiFrameImage source) { int framecount = source.getFrameCount(); // let's make sure our frames are valid for (int ii=0; ii < _length; ii++) { @@ -140,14 +129,12 @@ public interface AnimationFrameSequencer extends FrameSequencer } // documentation inherited from interface - public void setAnimation (Animation anim) - { + public void setAnimation (Animation anim) { _animation = anim; } // documentation inherited from interface - public int tick (long tickStamp) - { + public int tick (long tickStamp) { // obtain our starting timestamp if we don't already have one if (_lastStamp == 0L) { _lastStamp = tickStamp; @@ -179,8 +166,7 @@ public interface AnimationFrameSequencer extends FrameSequencer } // documentation inherited from interface - public void fastForward (long timeDelta) - { + public void fastForward (long timeDelta) { // this method should be called "unpause" _lastStamp += timeDelta; } @@ -188,20 +174,17 @@ public interface AnimationFrameSequencer extends FrameSequencer /** * Get the delay to use for the specified frame. */ - protected final long getDelay (int index) - { + protected final long getDelay (int index) { return (_delays == null) ? _delay : _delays[index]; } /** * Check to see if we need to notify that we've reached a marked frame. */ - protected void checkNotify (long tickStamp) - { + protected void checkNotify (long tickStamp) { if (_marks[_curIdx]) { _animation.queueNotification( - new FrameReachedOp(_animation, tickStamp, - _sequence[_curIdx], _curIdx)); + new FrameReachedOp(_animation, tickStamp, _sequence[_curIdx], _curIdx)); } } @@ -238,8 +221,7 @@ public interface AnimationFrameSequencer extends FrameSequencer /** Used to dispatch {@link SequencedAnimationObserver#frameReached}. */ protected static class FrameReachedOp implements ObserverList.ObserverOp { - public FrameReachedOp (Animation anim, long when, - int frameIdx, int frameSeq) { + public FrameReachedOp (Animation anim, long when, int frameIdx, int frameSeq) { _anim = anim; _when = when; _frameIdx = frameIdx; diff --git a/src/main/java/com/threerings/media/animation/ExplodeAnimation.java b/src/main/java/com/threerings/media/animation/ExplodeAnimation.java index a889410c..fe5cf8ea 100644 --- a/src/main/java/com/threerings/media/animation/ExplodeAnimation.java +++ b/src/main/java/com/threerings/media/animation/ExplodeAnimation.java @@ -65,8 +65,7 @@ public class ExplodeAnimation extends Animation public long delay; @Override - public String toString () - { + public String toString () { return StringUtil.fieldsToString(this); } } diff --git a/src/main/java/com/threerings/media/animation/SequencedAnimationObserver.java b/src/main/java/com/threerings/media/animation/SequencedAnimationObserver.java index c00f8f40..f3400a94 100644 --- a/src/main/java/com/threerings/media/animation/SequencedAnimationObserver.java +++ b/src/main/java/com/threerings/media/animation/SequencedAnimationObserver.java @@ -30,6 +30,5 @@ public interface SequencedAnimationObserver extends AnimationObserver * Called when the observed animation -- previously configured with an * {@link AnimationFrameSequencer} -- reached the specified frame. */ - public void frameReached (Animation anim, long when, - int frameIdx, int frameSeq); + public void frameReached (Animation anim, long when, int frameIdx, int frameSeq); } diff --git a/src/main/java/com/threerings/media/effects/FadeEffect.java b/src/main/java/com/threerings/media/effects/FadeEffect.java index c744c747..39be4e60 100644 --- a/src/main/java/com/threerings/media/effects/FadeEffect.java +++ b/src/main/java/com/threerings/media/effects/FadeEffect.java @@ -32,8 +32,7 @@ public class FadeEffect { public FadeEffect (float alpha, float step, float target) { - if ((step == 0f) || (alpha > target && step > 0f) || - (alpha < target && step < 0f)) { + if ((step == 0f) || (alpha > target && step > 0f) || (alpha < target && step < 0f)) { throw new IllegalArgumentException("Step specified is illegal: " + "Fade would never finish (start=" + alpha + ", step=" + step + ", target=" + target + ")"); diff --git a/src/main/java/com/threerings/media/image/ColorPository.java b/src/main/java/com/threerings/media/image/ColorPository.java index 5084de32..84990ca9 100644 --- a/src/main/java/com/threerings/media/image/ColorPository.java +++ b/src/main/java/com/threerings/media/image/ColorPository.java @@ -475,7 +475,7 @@ public class ColorPository implements Serializable } /** - * Loads up a serialized color pository from the supplied resource manager. + * Loads up a serialized ColorPository from the supplied resource manager. */ public static ColorPository loadColorPository (ResourceManager rmgr) { @@ -488,7 +488,7 @@ public class ColorPository implements Serializable } /** - * Loads up a serialized color pository from the supplied resource manager. + * Loads up a serialized ColorPository from the supplied resource manager. */ public static ColorPository loadColorPository (InputStream source) { diff --git a/src/main/java/com/threerings/media/image/Colorization.java b/src/main/java/com/threerings/media/image/Colorization.java index 7f9f6058..f2418734 100644 --- a/src/main/java/com/threerings/media/image/Colorization.java +++ b/src/main/java/com/threerings/media/image/Colorization.java @@ -100,8 +100,7 @@ public class Colorization { // 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) { + if (distance(fhsv[0], _fhsv[0], Short.MAX_VALUE) > range[0] * Short.MAX_VALUE) { return false; } diff --git a/src/main/java/com/threerings/media/image/ImageUtil.java b/src/main/java/com/threerings/media/image/ImageUtil.java index d05ba80d..db8bc0ac 100644 --- a/src/main/java/com/threerings/media/image/ImageUtil.java +++ b/src/main/java/com/threerings/media/image/ImageUtil.java @@ -148,8 +148,7 @@ public class ImageUtil Color.RGBtoHSB(red, green, blue, hsv); Colorization.toFixedHSV(hsv, fhsv); - // see if this color matches and of our colorizations and - // recolor it if it does + // see if this color matches and of our colorizations and recolor it if it does for (int z = 0; z < zcount; z++) { Colorization cz = zations[z]; if (cz != null && cz.matches(hsv, fhsv)) { @@ -171,8 +170,7 @@ public class ImageUtil * Paints multiple copies of the supplied image using the supplied graphics context such that * the requested area is filled with the image. */ - public static void tileImage ( - Graphics2D gfx, Mirage image, int x, int y, int width, int height) + public static void tileImage (Graphics2D gfx, Mirage image, int x, int y, int width, int height) { int iwidth = image.getWidth(), iheight = image.getHeight(); int xnum = width / iwidth, xplus = width % iwidth; diff --git a/src/main/java/com/threerings/media/tile/SimpleCachingImageProvider.java b/src/main/java/com/threerings/media/tile/SimpleCachingImageProvider.java index e4081d1b..10d7c4b4 100644 --- a/src/main/java/com/threerings/media/tile/SimpleCachingImageProvider.java +++ b/src/main/java/com/threerings/media/tile/SimpleCachingImageProvider.java @@ -52,7 +52,7 @@ public abstract class SimpleCachingImageProvider implements ImageProvider image = loadImage(path); _cache.put(path, image); } catch (IOException ioe) { - log.warning("Failed to load image [path=" + path + ", ioe=" + ioe + "]."); + log.warning("Failed to load image", "path", path, "ioe", ioe); } } diff --git a/src/main/java/com/threerings/media/tile/TileManager.java b/src/main/java/com/threerings/media/tile/TileManager.java index c258bd5f..04a3c52f 100644 --- a/src/main/java/com/threerings/media/tile/TileManager.java +++ b/src/main/java/com/threerings/media/tile/TileManager.java @@ -80,8 +80,7 @@ public class TileManager /** */ public UniformTileSet loadTileSet ( - ImageProvider improv, String improvKey, String imgPath, - int width, int height) + ImageProvider improv, String improvKey, String imgPath, int width, int height) { UniformTileSet uts = loadCachedTileSet(improvKey, imgPath, width, height); uts.setImageProvider(improv); @@ -89,8 +88,7 @@ public class TileManager } /** - * Returns an image provider that will load images from the specified - * resource set. + * Returns an image provider that will load images from the specified resource set. */ public ImageProvider getImageProvider (String rset) { diff --git a/src/main/java/com/threerings/media/tile/TileSet.java b/src/main/java/com/threerings/media/tile/TileSet.java index 9b50637c..ae81fa8f 100644 --- a/src/main/java/com/threerings/media/tile/TileSet.java +++ b/src/main/java/com/threerings/media/tile/TileSet.java @@ -33,7 +33,6 @@ import java.awt.image.BufferedImage; import com.google.common.collect.Maps; -import com.samskivert.util.StringUtil; import com.samskivert.util.Throttle; import com.threerings.media.image.BufferedMirage; @@ -131,8 +130,8 @@ public abstract class TileSet return tset; } catch (CloneNotSupportedException cnse) { - log.warning("Unable to clone tileset prior to colorization [tset=" + this + - ", zations=" + StringUtil.toString(zations) + ", error=" + cnse + "]."); + log.warning("Unable to clone tileset prior to colorization", + "tset", this, "zations", zations, "error", cnse); return null; } } @@ -272,7 +271,7 @@ public abstract class TileSet Mirage mirage = null; if (checkTileIndex(tileIndex)) { if (_improv == null) { - log.warning("Aiya! Tile set missing image provider [path=" + _imagePath + "]."); + log.warning("Aiya! Tile set missing image provider", "path", _imagePath); } else { mirage = _improv.getTileImage(_imagePath, bounds, zations); } @@ -404,9 +403,8 @@ public abstract class TileSet } } } - log.info("Tile caches [amem=" + (amem / 1024) + "k" + - ", tmem=" + (Tile._totalTileMemory / 1024) + "k" + - ", seen=" + _atiles.size() + ", asize=" + asize + "]."); + log.info("Tile caches", "amem", (amem / 1024) + "k", + "tmem", (Tile._totalTileMemory / 1024) + "k", "seen", _atiles.size(), "asize", + asize); } /** diff --git a/src/main/java/com/threerings/media/tools/RecolorImage.java b/src/main/java/com/threerings/media/tools/RecolorImage.java index 2fd7cd3a..dfb9fa79 100644 --- a/src/main/java/com/threerings/media/tools/RecolorImage.java +++ b/src/main/java/com/threerings/media/tools/RecolorImage.java @@ -498,8 +498,7 @@ public class RecolorImage extends JPanel { float[] hsv = new float[3]; Color color = new Color(rgb); - Color.RGBtoHSB(color.getRed(), color.getGreen(), - color.getBlue(), hsv); + Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsv); return hsv; } @@ -619,7 +618,6 @@ public class RecolorImage extends JPanel protected ColorPository _colRepo; protected static final String IMAGE_PATH = - // "bundles/components/pirate/torso/regular/standing.png"; "bundles/components/pirate/head/regular/standing.png"; /** The actions for our various buttons. */ diff --git a/src/main/java/com/threerings/media/util/FrameSequencer.java b/src/main/java/com/threerings/media/util/FrameSequencer.java index d1156c27..f0903719 100644 --- a/src/main/java/com/threerings/media/util/FrameSequencer.java +++ b/src/main/java/com/threerings/media/util/FrameSequencer.java @@ -22,63 +22,53 @@ package com.threerings.media.util; /** - * Used to control animation timing when displaying a {@link - * MultiFrameImage}. This interface allows for constant framerates, or - * more sophisticated animation timing. + * Used to control animation timing when displaying a {@link MultiFrameImage}. This interface + * allows for constant framerates, or more sophisticated animation timing. */ public interface FrameSequencer { /** - * Called prior to the execution of an animation sequence (not - * necessarily immediately, so time stamps should be obtained in the - * first call to tick). + * Called prior to the execution of an animation sequence (not necessarily immediately, so + * time stamps should be obtained in the first call to tick). * - * @param source the multie-frame image that is providing the - * animation frames. + * @param source the multi-frame image that is providing the animation frames. * @return initial frame index */ public int init (MultiFrameImage source); /** - * Called every display frame, the frame sequencer should return the - * index of the animation frame that should be displayed during this - * tick. If the sequencer returns -1, it is taken as an indication - * that the animation is finished and should be stopped. + * Called every display frame, the frame sequencer should return the index of the animation + * frame that should be displayed during this tick. If the sequencer returns -1, it is taken + * as an indication that the animation is finished and should be stopped. */ public int tick (long tickStamp); /** - * Called if the display is paused for some length of time and then - * unpaused. Sequencers should adjust any time stamps they are - * maintaining internally by the delta so that time maintains the - * illusion of flowing smoothly forward. + * Called if the display is paused for some length of time and then unpaused. Sequencers + * should adjust any time stamps they are maintaining internally by the delta so that time + * maintains the illusion of flowing smoothly forward. */ public void fastForward (long timeDelta); /** - * A frame sequencer that delivers a constant frame rate in either one - * shot or looping mode. + * A frame sequencer that delivers a constant frame rate in either one shot or looping mode. */ public static class ConstantRate implements FrameSequencer { /** - * Creates a constant rate frame sequencer with the desired target - * frames per second. + * Creates a constant rate frame sequencer with the desired target frames per second. * * @param framesPerSecond the target frames per second. - * @param loop if false, the sequencer will report the end of - * the animation after progressing through all of the frames once, - * otherwise it will loop indefinitely. + * @param loop if false, the sequencer will report the end of the animation after + * progressing through all of the frames once, otherwise it will loop indefinitely. */ - public ConstantRate (double framesPerSecond, boolean loop) - { + public ConstantRate (double framesPerSecond, boolean loop) { _millisPerFrame = (long)(1000d / framesPerSecond); _loop = loop; } // documentation inherited from interface - public int init (MultiFrameImage source) - { + public int init (MultiFrameImage source) { _frameCount = source.getFrameCount(); _startStamp = 0l; @@ -86,8 +76,7 @@ public interface FrameSequencer } // documentation inherited from interface - public int tick (long tickStamp) - { + public int tick (long tickStamp) { // obtain our starting timestamp if we don't already have one if (_startStamp == 0) { _startStamp = tickStamp; @@ -98,13 +87,11 @@ public interface FrameSequencer // if we're not looping and we've exhausted our frames, we // return -1 to indicate that the animation should stop - return (_loop || frameIdx < _frameCount) ? (frameIdx % _frameCount) - : -1; + return (_loop || frameIdx < _frameCount) ? (frameIdx % _frameCount) : -1; } // documentation inherited from interface - public void fastForward (long timeDelta) - { + public void fastForward (long timeDelta) { _startStamp += timeDelta; } diff --git a/src/main/java/com/threerings/media/util/MathUtil.java b/src/main/java/com/threerings/media/util/MathUtil.java index 697a0dac..4e3c3f2e 100644 --- a/src/main/java/com/threerings/media/util/MathUtil.java +++ b/src/main/java/com/threerings/media/util/MathUtil.java @@ -24,8 +24,7 @@ package com.threerings.media.util; import java.awt.Point; /** - * Provides miscellaneous useful utility routines for mathematical - * calculations. + * Provides miscellaneous useful utility routines for mathematical calculations. */ public class MathUtil { @@ -82,10 +81,9 @@ public class MathUtil } /** - * Returns the approximate circumference of the ellipse defined by the - * specified minor and major axes. The formula used (due to Ramanujan, - * via a paper of his entitled "Modular Equations and Approximations - * to Pi"), is Pi(3a + 3b - sqrt[(a+3b)(b+3a)]). + * Returns the approximate circumference of the ellipse defined by the specified minor and + * major axes. The formula used (due to Ramanujan, via a paper of his entitled "Modular + * Equations and Approximations to Pi"), is Pi(3a + 3b - sqrt[(a+3b)(b+3a)]). */ public static double ellipseCircum (double a, double b) { @@ -93,8 +91,8 @@ public class MathUtil } /** - * Returns positive 1 if the sign of the argument is positive, or -1 - * if the sign of the argument is negative. + * Returns positive 1 if the sign of the argument is positive, or -1 if the sign of the + * argument is negative. */ public static int sign (int value) { @@ -121,8 +119,7 @@ public class MathUtil /** * Computes the standard deviation of the supplied values. * - * @return an array of three values: the mean, variance and standard - * deviation, in that order. + * @return an array of three values: the mean, variance and standard deviation, in that order. */ public static float[] stddev (int[] values, int start, int length) { @@ -146,8 +143,8 @@ public class MathUtil } /** - * Computes (N choose K), the number of ways to select K different - * elements from a set of size N. + * Computes (N choose K), the number of ways to select K different elements from a set of size + * N. */ public static int choose (int n, int k) { diff --git a/src/main/java/com/threerings/miso/util/MisoContext.java b/src/main/java/com/threerings/miso/util/MisoContext.java index ef3e0ea0..c4a5aafb 100644 --- a/src/main/java/com/threerings/miso/util/MisoContext.java +++ b/src/main/java/com/threerings/miso/util/MisoContext.java @@ -26,8 +26,7 @@ import com.threerings.media.FrameManager; import com.threerings.miso.tile.MisoTileManager; /** - * Provides Miso code with access to the managers that it needs to do its - * thing. + * Provides Miso code with access to the managers that it needs to do its thing. */ public interface MisoContext { @@ -37,8 +36,8 @@ public interface MisoContext public FrameManager getFrameManager (); /** - * Returns a reference to the tile manager. This reference is valid - * for the lifetime of the application. + * Returns a reference to the tile manager. This reference is valid for the lifetime of the + * application. */ public MisoTileManager getTileManager (); } diff --git a/src/main/java/com/threerings/openal/OpenALSoundPlayer.java b/src/main/java/com/threerings/openal/OpenALSoundPlayer.java index 10a0a06e..e80d56c6 100644 --- a/src/main/java/com/threerings/openal/OpenALSoundPlayer.java +++ b/src/main/java/com/threerings/openal/OpenALSoundPlayer.java @@ -382,14 +382,12 @@ public class OpenALSoundPlayer extends SoundPlayer */ protected class TickingQueue extends BasicRunQueue { - public TickingQueue () - { + public TickingQueue () { super("SoundPlayerQueue"); } @Override - protected void iterate () - { + protected void iterate () { long elapsed = _timer.getElapsedMillis() - _lastTick; Runnable r; if (elapsed >= STREAM_UPDATE_INTERVAL) { @@ -438,14 +436,12 @@ public class OpenALSoundPlayer extends SoundPlayer public Sound sound; - public SoundGrabber (String pkgPath, String key) - { + public SoundGrabber (String pkgPath, String key) { String[] paths = getPaths(pkgPath, key); path = paths[RandomUtil.getInt(paths.length)]; } - public void run () - { + public void run () { sound = _group.getSound(path); soundLoaded(); }