Add in @Overrides across the board, clean up the comments around them some, and remove

unneeded imports.
I've got partially completed patches for narya & vilya, too, but nenya was the 
only one that wound up in a decent state after a friday evening puttering at it,
killing time waiting on other things to finish.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@572 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2008-07-14 18:19:23 +00:00
parent 1df0737bf7
commit 5f1eed7b94
137 changed files with 394 additions and 433 deletions
@@ -62,7 +62,7 @@ public abstract class Animation extends AbstractMedia
_finished = false;
}
// documentation inherited
@Override
public void setLocation (int x, int y)
{
if (_bounds.x == x && _bounds.y == y) {
@@ -79,7 +79,7 @@ public abstract class Animation extends AbstractMedia
invalidateAfterChange(obounds);
}
// documentation inherited
@Override
protected void willStart (long tickStamp)
{
super.willStart(tickStamp);
@@ -59,6 +59,7 @@ public class AnimationArranger
/** Automatically removes avoid animations when they're done. */
protected AnimationAdapter _avoidAnimObs = new AnimationAdapter() {
@Override
public void animationCompleted (Animation anim, long when) {
if (!_avoidAnims.remove(anim)) {
log.warning("Couldn't remove avoid animation?! " + anim + ".");
@@ -25,7 +25,6 @@ import com.samskivert.util.SortableArrayList;
import com.threerings.media.AbstractMedia;
import com.threerings.media.AbstractMediaManager;
import com.threerings.media.MediaHost;
/**
* Manages a collection of animations, ticking them when the animation manager itself is ticked and
@@ -51,7 +50,7 @@ public class AnimationManager extends AbstractMediaManager
removeMedia(anim);
}
@Override // from AbstractMediaManager
@Override
protected void tickAllMedia (long tickStamp)
{
super.tickAllMedia(tickStamp);
@@ -70,7 +69,7 @@ public class AnimationManager extends AbstractMediaManager
}
}
@Override // from AbstractMediaManager
@Override
protected SortableArrayList<? extends AbstractMedia> createMediaList ()
{
return (_anims = new SortableArrayList<Animation>());
@@ -113,7 +113,7 @@ public class AnimationSequencer extends Animation
_lastStamp = 0;
}
// documentation inherited
@Override
public void tick (long tickStamp)
{
if (_lastStamp == 0) {
@@ -148,19 +148,19 @@ public class AnimationSequencer extends Animation
// }
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
// don't care
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
_lastStamp += timeDelta;
}
// documentation inherited
@Override
public void viewLocationDidChange (int dx, int dy)
{
super.viewLocationDidChange(dx, dy);
@@ -259,11 +259,13 @@ public class AnimationSequencer extends Animation
tick(when);
}
@Override
public void animationCompleted (Animation anim, long when)
{
fireCompletion(when);
}
@Override
public String toString ()
{
return "[anim=" + StringUtil.shortClassName(_anim) +
@@ -24,12 +24,9 @@ package com.threerings.media.animation;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import com.threerings.media.AbstractMediaManager;
import com.threerings.media.MediaPanel;
import com.threerings.media.sprite.Sprite;
import com.threerings.media.animation.Animation;
import com.threerings.media.animation.AnimationAdapter;
import com.threerings.media.animation.AnimationObserver;
/**
* A Sprite that wraps an animation so that a sequence of frames can be easily
@@ -47,12 +44,13 @@ public class AnimationSprite extends Sprite
_owner = owner;
}
@Override
public void init ()
{
_anim.init(_mgr);
}
// documentation inherited
@Override
public void tick (long tickStamp)
{
super.tick(tickStamp);
@@ -67,21 +65,21 @@ public class AnimationSprite extends Sprite
}
}
// documentation inherited.
@Override
public void setLocation (int x, int y)
{
_anim.setLocation(x - _oxoff, y - _oyoff);
super.setLocation(x, y);
}
// documentation inherited
@Override
public void willStart (long tickStamp)
{
super.willStart(tickStamp);
_anim.willStart(tickStamp);
}
// documentation inherited
@Override
public void paint (Graphics2D gfx) {
// Nothing to paint for ourselves.
@@ -37,7 +37,7 @@ public class BlankAnimation extends Animation
_duration = duration;
}
// documentation inherited
@Override
public void tick (long timestamp)
{
if (_start == 0) {
@@ -49,7 +49,7 @@ public class BlankAnimation extends Animation
_finished = (timestamp - _start >= _duration);
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
if (_start > 0) {
@@ -57,7 +57,7 @@ public class BlankAnimation extends Animation
}
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
// nothing doing
@@ -48,7 +48,7 @@ public class BlendAnimation extends Animation
_tfunc = new LinearTimeFunction(0, 100 * fades, delay * fades);
}
// documentation inherited
@Override
public void tick (long timestamp)
{
// check to see if our blend level has changed
@@ -64,13 +64,13 @@ public class BlendAnimation extends Animation
invalidate();
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
_tfunc.fastForward(timeDelta);
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
int index = _level / 100;
@@ -60,7 +60,7 @@ public class BobbleAnimation extends Animation
_duration = duration;
}
// documentation inherited
@Override
public void tick (long tickStamp)
{
// grab our ending time on our first tick
@@ -78,19 +78,19 @@ public class BobbleAnimation extends Animation
_y = _sy + dy * ((RandomUtil.getInt(2) == 0) ? -1 : 1);
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
_end += timeDelta;
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
_image.paint(gfx, _x, _y);
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
@@ -66,7 +66,7 @@ public class ExplodeAnimation extends Animation
* should continue until all pieces are outside the bounds. */
public long delay;
/** Returns a string representation of this instance. */
@Override
public String toString ()
{
return StringUtil.fieldsToString(this);
@@ -156,7 +156,7 @@ public class ExplodeAnimation extends Animation
_angle = 0.0f;
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
if (_start > 0) {
@@ -165,7 +165,7 @@ public class ExplodeAnimation extends Animation
}
}
// documentation inherited
@Override
public void tick (long timestamp)
{
if (_start == 0) {
@@ -218,7 +218,7 @@ public class ExplodeAnimation extends Animation
invalidate();
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
Shape oclip = gfx.getClip();
@@ -270,7 +270,7 @@ public class ExplodeAnimation extends Animation
}
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
@@ -21,15 +21,11 @@
package com.threerings.media.animation;
import java.awt.AlphaComposite;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import com.threerings.media.effects.FadeEffect;
import static com.threerings.media.Log.log;
/**
* An animation that displays an image fading from one alpha level to
* another in specified increments over time. The animation is finished
@@ -52,7 +48,7 @@ public abstract class FadeAnimation extends Animation
_effect = new FadeEffect(alpha, step, target);
}
// documentation inherited
@Override
public void tick (long timestamp)
{
if (_effect.tick(timestamp)) {
@@ -61,7 +57,7 @@ public abstract class FadeAnimation extends Animation
}
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
_effect.beforePaint(gfx);
@@ -69,7 +65,7 @@ public abstract class FadeAnimation extends Animation
_effect.afterPaint(gfx);
}
// documentation inherited
@Override
protected void willStart (long tickStamp)
{
super.willStart(tickStamp);
@@ -42,7 +42,7 @@ public class FadeImageAnimation extends FadeAnimation
_image = image;
}
// documentation inherited
@Override
protected void paintAnimation (Graphics2D gfx)
{
_image.paint(gfx, _bounds.x, _bounds.y);
@@ -29,8 +29,6 @@ import java.awt.RenderingHints;
import com.samskivert.swing.Label;
import com.samskivert.swing.util.SwingUtil;
import static com.threerings.media.Log.log;
/**
* Does something extraordinary.
*/
@@ -54,7 +52,7 @@ public class FadeLabelAnimation extends FadeAnimation
_antiAliased = antiAliased;
}
// documentation inherited
@Override
protected void init ()
{
super.init();
@@ -78,7 +76,7 @@ public class FadeLabelAnimation extends FadeAnimation
_bounds.height = size.height;
}
// documentation inherited
@Override
protected void paintAnimation (Graphics2D gfx)
{
Object ohints = null;
@@ -91,7 +91,7 @@ public class FloatingTextAnimation extends Animation
return _label;
}
// documentation inherited
@Override
public void setLocation (int x, int y)
{
super.setLocation(x, y);
@@ -119,7 +119,7 @@ public class FloatingTextAnimation extends Animation
_floatPeriod = floatPeriod;
}
// documentation inherited
@Override
public void tick (long timestamp)
{
boolean invalid = false;
@@ -172,7 +172,7 @@ public class FloatingTextAnimation extends Animation
_finished = (msecs >= _floatPeriod);
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
if (_start > 0) {
@@ -180,7 +180,7 @@ public class FloatingTextAnimation extends Animation
}
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
Composite ocomp = gfx.getComposite();
@@ -203,7 +203,7 @@ public class FloatingTextAnimation extends Animation
_label.render(gfx, x, y);
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
@@ -64,17 +64,14 @@ public class MultiFrameAnimation extends Animation
reset();
}
// documentation inherited
@Override
public Rectangle getBounds ()
{
// fill in the bounds with our current animation frame's bounds
return _bounds;
}
/**
* If this animation has run to completion, it can be reset to prepare
* it for another go.
*/
@Override
public void reset ()
{
super.reset();
@@ -90,7 +87,7 @@ public class MultiFrameAnimation extends Animation
}
}
// documentation inherited
@Override
public void tick (long tickStamp)
{
int fidx = _seeker.tick(tickStamp);
@@ -119,13 +116,13 @@ public class MultiFrameAnimation extends Animation
_bounds.height = _frames.getHeight(_fidx);
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
_frames.paintFrame(gfx, _fidx, _bounds.x, _bounds.y);
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
_seeker.fastForward(timeDelta);
@@ -76,7 +76,7 @@ public class RainAnimation extends Animation
_duration = duration;
}
// documentation inherited
@Override
public void tick (long tickStamp)
{
// grab our ending time on our first tick
@@ -96,13 +96,13 @@ public class RainAnimation extends Animation
invalidate();
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
_end += timeDelta;
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
gfx.setColor(Color.white);
@@ -21,21 +21,13 @@
package com.threerings.media.animation;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Image;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import com.threerings.media.image.Mirage;
import com.threerings.media.sprite.Sprite;
import com.threerings.media.sprite.SpriteManager;
import com.threerings.media.util.LinearTimeFunction;
import com.threerings.media.util.TimeFunction;
@@ -100,10 +92,7 @@ public class ScaleAnimation extends Animation
return new Rectangle(corner.x, corner.y, size.x, size.y);
}
/**
* Compute the bounds to use to render the animation's image
* right now.
*/
@Override
public Rectangle getBounds ()
{
return getBounds(_scale, _center, _image);
@@ -126,7 +115,7 @@ public class ScaleAnimation extends Animation
return new Point(center.x - size.x/2, center.y - size.y/2);
}
// documentation inherited
@Override
public void tick (long tickStamp)
{
// Compute the new scaling value
@@ -147,13 +136,13 @@ public class ScaleAnimation extends Animation
}
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
_scaleFunc.fastForward(timeDelta);
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
// Compute the bounding box to render this image
@@ -32,8 +32,6 @@ import com.samskivert.util.RandomUtil;
import com.threerings.media.animation.Animation;
import com.threerings.media.image.Mirage;
import static com.threerings.media.Log.log;
/**
* Displays a set of spark images originating from a specified position
* and flying outward in random directions, fading out as they go, for a
@@ -126,20 +124,20 @@ public class SparkAnimation extends Animation
return (RandomUtil.getInt(2) == 0) ? -1 : 1;
}
// documentation inherited
@Override
protected void willStart (long stamp)
{
super.willStart(stamp);
_start = stamp;
}
// documentation inherited
@Override
public void fastForward (long timeDelta)
{
_start += timeDelta;
}
// documentation inherited
@Override
public void tick (long timestamp)
{
// figure out the distance the chunks have travelled
@@ -184,7 +182,7 @@ public class SparkAnimation extends Animation
invalidate();
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
Shape oclip = gfx.getClip();
@@ -206,7 +204,7 @@ public class SparkAnimation extends Animation
gfx.setClip(oclip);
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
@@ -50,10 +50,7 @@ public class SpriteAnimation extends Animation
_sprite.addSpriteObserver(this);
}
/**
* Derived classes can override tick if they want to end the animation
* in some other way than the sprite completing a path.
*/
@Override
public void tick (long timestamp)
{
// start the sprite moving on its path on our first tick
@@ -64,7 +61,7 @@ public class SpriteAnimation extends Animation
}
}
// documentation inherited
@Override
public void paint (Graphics2D gfx)
{
// nothing for now
@@ -82,7 +79,7 @@ public class SpriteAnimation extends Animation
_finished = true;
}
// documentation inherited
@Override
protected void didFinish (long tickStamp)
{
super.didFinish(tickStamp);