Type safety and widening.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@246 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2007-05-15 16:59:58 +00:00
parent c755fd626a
commit 9a30debf42
3 changed files with 134 additions and 145 deletions
@@ -21,19 +21,20 @@
package com.threerings.media.animation;
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 generating events when animations finish
* and suchlike.
* Manages a collection of animations, ticking them when the animation manager itself is ticked and
* generating events when animations finish and suchlike.
*/
public class AnimationManager extends AbstractMediaManager
{
/**
* Registers the given {@link Animation} with the animation manager
* for ticking and painting.
* Registers the given {@link Animation} with the animation manager for ticking and painting.
*/
public void registerAnimation (Animation anim)
{
@@ -41,23 +42,22 @@ public class AnimationManager extends AbstractMediaManager
}
/**
* Un-registers the given {@link Animation} from the animation
* manager. The bounds of the animation will automatically be
* invalidated so that they are properly rerendered in the absence of
* the animation.
* Un-registers the given {@link Animation} from the animation manager. The bounds of the
* animation will automatically be invalidated so that they are properly rerendered in the
* absence of the animation.
*/
public void unregisterAnimation (Animation anim)
{
removeMedia(anim);
}
// documentation inherited
@Override // from AbstractMediaManager
protected void tickAllMedia (long tickStamp)
{
super.tickAllMedia(tickStamp);
for (int ii = _media.size() - 1; ii >= 0; ii--) {
Animation anim = (Animation)_media.get(ii);
for (int ii = _anims.size() - 1; ii >= 0; ii--) {
Animation anim = _anims.get(ii);
if (!anim.isFinished()) {
continue;
}
@@ -69,4 +69,12 @@ public class AnimationManager extends AbstractMediaManager
// Log.info("Removed finished animation " + anim + ".");
}
}
@Override // from AbstractMediaManager
protected SortableArrayList<? extends AbstractMedia> createMediaList ()
{
return (_anims = new SortableArrayList<Animation>());
}
protected SortableArrayList<Animation> _anims;
}