I wonder if a copy constructor in Animation is a good addition to the class.
In my case this would be useful because I have a cache of animations and sometimes I reuse the same animation on a number of places, and sometimes I need a new copy.
Code:
/**
* Copy images and configuration from another Animation
* The animation starts at the first frame
*
* @param otherAnimation the animation to copy
*/
public Animation(Animation otherAnimation) {
this.frames = new ArrayList(otherAnimation.frames);
this.stopped = otherAnimation.stopped;
this.stopAt = otherAnimation.stopAt;
this.autoUpdate = otherAnimation.autoUpdate;
this.direction = otherAnimation.direction;
this.pingPong = otherAnimation.pingPong;
this.loop = otherAnimation.loop;
this.spriteSheet = spriteSheet;
this.currentFrame = 0;
}
Would this be useful or is there a reason not to add it? as the class seems to be well thought out so there is probably a reason why it is not included.