1 package org.woehlke.simulation.evolution.beans;
2
3 import java.io.Serializable;
4
5
6
7
8
9
10
11
12 public class SimGenPoint implements Serializable {
13 private int x = 0;
14 private int y = 0;
15
16 public SimGenPoint(SimGenPoint p) {
17 this.x = p.getX();
18 this.y = p.getY();
19 }
20
21 public SimGenPoint(int x, int y) {
22 this.x = x;
23 this.y = y;
24 }
25
26 public int getX() {
27 return x;
28 }
29
30 public void setX(int x) {
31 this.x = x;
32 }
33
34 public int getY() {
35 return y;
36 }
37
38 public void setY(int y) {
39 this.y = y;
40 }
41
42 public void killNagative() {
43 if (y < 0) {
44 y *= -1;
45 }
46 if (x < 0) {
47 x *= -1;
48 }
49 }
50
51 public void add(SimGenPoint p) {
52 this.x += p.getX();
53 this.y += p.getY();
54 }
55
56 public void normalize(SimGenPoint p) {
57 this.x %= p.getX();
58 this.y %= p.getY();
59 }
60 }