View Javadoc
1   package org.woehlke.computer.kurzweil.commons.model.turing;
2   
3   import java.util.Objects;
4   
5   /**
6    * Mandelbrot Set drawn by a Turing Machine.
7    *
8    * (C) 2006 - 2015 Thomas Woehlke.
9    * https://thomas-woehlke.blogspot.com/2016/01/mandelbrot-set-drawn-by-turing-machine.html
10   * @author Thomas Woehlke
11   *
12   * Date: 04.02.2006
13   * Time: 23:47:05
14   */
15  public class Point {
16  
17      private volatile int x = 0;
18      private volatile int y = 0;
19  
20      public Point() {
21      }
22  
23      public Pointint" href="../../../../../../../org/woehlke/computer/kurzweil/commons/model/turing/Point.html#Point">Point(Point p) {
24          this.x = p.getX();
25          this.y = p.getY();
26      }
27  
28      public Point(int x, int y) {
29          this.x = x;
30          this.y = y;
31      }
32  
33      public void moveUp() {
34          y--;
35      }
36  
37      public void moveRight() {
38          x++;
39      }
40  
41      public void moveDown() {
42          y++;
43      }
44  
45      public void moveLeft() {
46          x--;
47      }
48  
49      public int getWidth(){
50          return x;
51      }
52      public int getHeight() { return y; }
53  
54      public int getX() {
55          return x;
56      }
57  
58      public void setX(int x) {
59          this.x = x;
60      }
61  
62      public int getY() {
63          return y;
64      }
65  
66      public void setY(int y) {
67          this.y = y;
68      }
69  
70      @Override
71      public boolean equals(Object o) {
72          if (this == o) return true;
73          if (!(o instanceof Point)) return false;
74          Point="../../../../../../../org/woehlke/computer/kurzweil/commons/model/turing/Point.html#Point">Point point = (Point) o;
75          return getX() == point.getX() &&
76              getY() == point.getY();
77      }
78  
79      @Override
80      public int hashCode() {
81          return Objects.hash(getX(), getY());
82      }
83  
84      @Override
85      public String toString() {
86          return "Point{" +
87              "x=" + x +
88              ", y=" + y +
89              '}';
90      }
91  }