1 package org.woehlke.computer.kurzweil.commons.model;
2
3 import lombok.*;
4 import lombok.extern.log4j.Log4j2;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 @Log4j2
20 @Getter
21 @Setter
22 @ToString
23 @NoArgsConstructor
24 @AllArgsConstructor
25 @EqualsAndHashCode
26 public class LatticePoint {
27
28
29
30
31 private int x = 0;
32
33
34
35
36 private int y = 0;
37
38 public LatticePointef="../../../../../../org/woehlke/computer/kurzweil/commons/model/LatticePoint.html#LatticePoint">LatticePoint(LatticePoint other) {
39 this.x = other.getX();
40 this.y = other.getY();
41 }
42
43 public int getWidth() {
44 return x;
45 }
46
47 public int getHeight() {
48 return y;
49 }
50
51 public void absoluteValue() {
52 x *= Integer.signum(x);
53 y *= Integer.signum(y);
54 }
55
56 public void killNegative() {
57 absoluteValue();
58 }
59
60 public void plus(LatticePoint p) {
61 this.x += p.getX();
62 this.y += p.getY();
63 absoluteValue();
64 }
65
66 public void moveBy(LatticePoint p) {
67 this.x += p.getX();
68 this.y += p.getY();
69 }
70
71 public void normalize(LatticePoint p) {
72 this.x %= p.getX();
73 this.y %= p.getY();
74 }
75
76 public void moveUp() {
77 y--;
78 }
79
80 public void moveRight() {
81 x++;
82 }
83
84 public void moveDown() {
85 y++;
86 }
87
88 public void moveLeft() {
89 x--;
90 }
91
92 public LatticePoint copy() {
93 return new LatticePoint(this);
94 }
95
96 public static LatticePoint/../../../../../org/woehlke/computer/kurzweil/commons/model/LatticePoint.html#LatticePoint">LatticePoint start(LatticePoint worldDimensions){
97 return new LatticePoint(
98 (worldDimensions.getX()-2),
99 ((worldDimensions.getY()/2)+11)
100 );
101 }
102
103 }