import java.awt.*;

/**
 * Beschreiben Sie hier die Klasse figur.
 * 
 * @author Rainer Helfrich
 * @version 1.0
 */
public abstract class Figur implements Comparable<Figur>
{
    protected int x;
    protected int y;
    protected Color farbe;
    
    /**
     * Konstruktor für Objekte der Klasse figur
     */
    public Figur(int x, int y, Color f)
    {
        this.x = x;
        this.y = y;
        this.farbe = f;
    }

    public void zeichneDich(Graphics g)
    {
        g.setColor(farbe);
    }
    
    public void verschiebeUm(int x, int y)
    {
        this.x += x;
        this.y += y;
    }
    
    public void verschiebeNach(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    public abstract boolean enthaeltPunkt(int x, int y);

    public abstract double getFlaecheninhalt();

    public int compareTo(Figur f)
    {
        double delta = getFlaecheninhalt() - f.getFlaecheninhalt();
        if (delta < 0)
        {
            return -1;
        }
        if (delta > 0)
        {
            return 1;
        }
        return 0;
    }
    
    public String toString()
    {
        return ": " + getFlaecheninhalt();
    }
    
}
