diff options
Diffstat (limited to 'ws2015/eip/blaetter/07/H7-1C/de/lmu/tcs/Position.java')
-rw-r--r-- | ws2015/eip/blaetter/07/H7-1C/de/lmu/tcs/Position.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ws2015/eip/blaetter/07/H7-1C/de/lmu/tcs/Position.java b/ws2015/eip/blaetter/07/H7-1C/de/lmu/tcs/Position.java new file mode 100644 index 0000000..9c98b77 --- /dev/null +++ b/ws2015/eip/blaetter/07/H7-1C/de/lmu/tcs/Position.java | |||
@@ -0,0 +1,31 @@ | |||
1 | package de.lmu.tcs; | ||
2 | |||
3 | /** | ||
4 | * Model | ||
5 | * | ||
6 | * Immutable | ||
7 | * | ||
8 | * Created by jost on 24.11.15. | ||
9 | */ | ||
10 | public class Position { | ||
11 | |||
12 | private final int x; | ||
13 | private final int y; | ||
14 | |||
15 | public Position(int x, int y) { | ||
16 | this.x = x; | ||
17 | this.y = y; | ||
18 | } | ||
19 | |||
20 | public int getX() { | ||
21 | return this.x; | ||
22 | } | ||
23 | |||
24 | public int getY() { | ||
25 | return this.y; | ||
26 | } | ||
27 | |||
28 | public Position add(Position r) { | ||
29 | return new Position(this.x + r.x, this.y + r.y); | ||
30 | } | ||
31 | } | ||