/**
 * Class to draw a broccoli flower
 */
import objectdraw.*;
import java.awt.*;

public class Flower implements BroccoliPart {

  private static final Color BROCCOLI_COLOR = new Color(0,135,0);
  private static final int BUD_SIZE = 3;  // diameter of bud

  private AngLine stem;                                    // stem of broccoli

  private FilledOval bud;                // flower of broccoli plant

  /**
   * Draw flower
   */
  public Flower(Location startCoords, double size,
                double direction, DrawingCanvas canvas) {
    // Draw stem and color green
    stem = new AngLine(startCoords, size, direction, canvas);
    stem.setColor(BROCCOLI_COLOR);

    Location destCoords = stem.getEnd();        // end of stem

    bud = new FilledOval(destCoords,BUD_SIZE,BUD_SIZE,canvas);
    bud.setColor(Color.yellow);
  }

  /**
   * @param x,y amount to move flower
   */
  public void move(double x, double y) {
    // move stem
    stem.move(x,y);

    // move bud
    bud.move(x,y);
  }

  /**
   * @param point location to be checked for containment in flower
   */
  public boolean contains (Location point) {
    return stem.contains(point) || bud.contains(point);
  }


}
