TP2: add class annotations.
[TP_POO.git] / TP2 / Point.java
1
2 @ClassPreamble (
3 author = "Jérôme Benoit",
4 date = "11/02/2012"
5 )
6 class Point {
7 private double x;
8 private double y;
9
10 Point() {
11 /*
12 * FIXME?: init to (0,0)
13 */
14 }
15
16 Point (double x, double y) {
17 this.x = x;
18 this.y = y;
19 }
20
21 public void setX(double x) {
22 this.x = x;
23 }
24
25 public double getX() {
26 return x;
27 }
28
29 public void setY(double y) {
30 this.y = y;
31 }
32
33 public double getY() {
34 return y;
35 }
36
37 public Point additionner(Point p) {
38 Point pNew = new Point(p.getX() + getX(), p.getY() + getY());
39 return pNew;
40 }
41
42 public String toString() {
43 return "(" + x + "," + y + ")";
44 }
45
46 }