Commit | Line | Data |
---|---|---|
4871c009 JB |
1 | |
2 | class Point { | |
3 | private double x; | |
4 | private double y; | |
5 | ||
6 | Point() { | |
14d4fd0d | 7 | /* |
f8ac3cd5 | 8 | * FIXME: init to (0,0)? |
14d4fd0d | 9 | */ |
4871c009 JB |
10 | } |
11 | ||
12 | Point (double x, double y) { | |
13 | this.x = x; | |
14 | this.y = y; | |
15 | } | |
16 | ||
17 | public void setX(double x) { | |
18 | this.x = x; | |
19 | } | |
20 | ||
21 | public double getX() { | |
22 | return x; | |
23 | } | |
24 | ||
25 | public void setY(double y) { | |
26 | this.y = y; | |
27 | } | |
28 | ||
29 | public double getY() { | |
30 | return y; | |
31 | } | |
32 | ||
14d4fd0d JB |
33 | public Point additionner(Point p) { |
34 | Point pNew = new Point(p.getX() + getX(), p.getY() + getY()); | |
35 | return pNew; | |
4871c009 JB |
36 | } |
37 | ||
38 | public String toString() { | |
39 | return "(" + x + "," + y + ")"; | |
40 | } | |
41 | ||
42 | } |