import objectdraw.*;

/**
 * Represents a full BullsEye
 */
public class BullsEyeRing implements BullsEyeInterface {

    private FramedOval outer; // outer ring of bullseye
        private BullsEyeInterface rest; // everything but outer ring

        // Create bullseye centered at pt with given radius
        public BullsEyeRing(Location pt, double radius, DrawingCanvas canvas) {

                // Create and center outer ring
                outer =
                        new FramedOval(
                                pt.getX() - radius,
                                pt.getY() - radius,
                                2.0 * radius,
                                2.0 * radius,
                                canvas);

                // Create smaller bullseye centered at same place
                radius = radius - RING_GAP;
                if (radius >= MIN_OUTER) {
                        // Big enough to have more rings
                        rest = new BullsEyeRing(pt, radius, canvas);
                } else {
                        // Small enough so only center left
                        rest = new BullsEyeCenter(pt, radius, canvas);
                }
        }

        // move the bullseye by dx in x direction and dy in y direction
        public void move(double dx, double dy) {
                outer.move(dx, dy);
                rest.move(dx, dy); 
        }

        // return whether the bullseye contains pt
        public boolean contains(Location pt) {
                return outer.contains(pt);
        }

        // remove the entire bullseye from the canvas
        public void removeFromCanvas() {
                outer.removeFromCanvas();
                rest.removeFromCanvas();
        }
}
