import java.awt.Color;

public class Viiva {
    private double ax;
    private double ay;
    private double bx;
    private double by;
    private Color väri;

    public Viiva(double ax, double ay, double bx, double by, Color väri) {
	this.ax = ax;
	this.ay = ay;
	this.bx = bx;
	this.by = by;
	this.väri = väri;
    }

    public String toString() {
 	return "(" + ax + ", " + ay + ") -> (" + bx + ", " + by + ")";
    }

    public void piirrä(Piirto p) {
	p.vaihdaVäri(väri);
	p.piirräViiva(ax, ay, bx, by);
    }

    public void siirrä(double dx, double dy) {
	ax += dx;
	ay += dy;
	bx += dx;
	by += dy;
    }
}
