Skip to content

Commit 9686549

Browse files
Zachary KiedaZachary Kieda
authored andcommitted
updated project to java8 (with generics), improved QuadTree to implement java.util.Map
1 parent 372846d commit 9686549

5 files changed

Lines changed: 136 additions & 62 deletions

File tree

pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
<version>4.7</version>
2121
</dependency>
2222
</dependencies>
23-
23+
<properties>
24+
<maven.compiler.source>1.8</maven.compiler.source>
25+
<maven.compiler.target>1.8</maven.compiler.target>
26+
</properties>
2427
</project>

src/main/java/Func.java

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/main/java/Node.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
public class Node {
1+
public class Node<T> {
22

33
private double x;
44
private double y;
55
private double w;
66
private double h;
7-
private Node opt_parent;
8-
private Point point;
7+
private Node<T> opt_parent;
8+
private Point<T> point;
99
private NodeType nodetype = NodeType.EMPTY;
1010
private Node nw;
1111
private Node ne;
@@ -22,7 +22,7 @@ public class Node {
2222
* @param {Node} opt_parent Optional parent node.
2323
* @constructor
2424
*/
25-
public Node(double x, double y, double w, double h, Node opt_parent) {
25+
public Node(double x, double y, double w, double h, Node<T> opt_parent) {
2626
this.x = x;
2727
this.y = y;
2828
this.w = w;
@@ -62,19 +62,19 @@ public void setH(double h) {
6262
this.h = h;
6363
}
6464

65-
public Node getParent() {
65+
public Node<T> getParent() {
6666
return opt_parent;
6767
}
6868

69-
public void setParent(Node opt_parent) {
69+
public void setParent(Node<T> opt_parent) {
7070
this.opt_parent = opt_parent;
7171
}
7272

73-
public void setPoint(Point point) {
73+
public void setPoint(Point<T> point) {
7474
this.point = point;
7575
}
7676

77-
public Point getPoint() {
77+
public Point<T> getPoint() {
7878
return this.point;
7979
}
8080

@@ -87,35 +87,35 @@ public NodeType getNodeType() {
8787
}
8888

8989

90-
public void setNw(Node nw) {
90+
public void setNw(Node<T> nw) {
9191
this.nw = nw;
9292
}
9393

94-
public void setNe(Node ne) {
94+
public void setNe(Node<T> ne) {
9595
this.ne = ne;
9696
}
9797

98-
public void setSw(Node sw) {
98+
public void setSw(Node<T> sw) {
9999
this.sw = sw;
100100
}
101101

102-
public void setSe(Node se) {
102+
public void setSe(Node<T> se) {
103103
this.se = se;
104104
}
105105

106-
public Node getNe() {
106+
public Node<T> getNe() {
107107
return ne;
108108
}
109109

110-
public Node getNw() {
110+
public Node<T> getNw() {
111111
return nw;
112112
}
113113

114-
public Node getSw() {
114+
public Node<T> getSw() {
115115
return sw;
116116
}
117117

118-
public Node getSe() {
118+
public Node<T> getSe() {
119119
return se;
120120
}
121121
}

src/main/java/Point.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
public class Point implements Comparable<Point> {
1+
public class Point<T> implements Comparable<Point> {
22

33
private double x;
44
private double y;
5-
private Object opt_value;
5+
private T opt_value;
66

77
/**
88
* Creates a new point object.
99
*
1010
* @param {double} x The x-coordinate of the point.
1111
* @param {double} y The y-coordinate of the point.
12-
* @param {Object} opt_value Optional value associated with the point.
12+
* @param {T} opt_value Optional value associated with the point.
1313
*/
14-
public Point(double x, double y, Object opt_value) {
14+
public Point(double x, double y, T opt_value) {
1515
this.x = x;
1616
this.y = y;
1717
this.opt_value = opt_value;
@@ -33,11 +33,11 @@ public void setY(double y) {
3333
this.y = y;
3434
}
3535

36-
public Object getValue() {
36+
public T getValue() {
3737
return opt_value;
3838
}
3939

40-
public void setValue(Object opt_value) {
40+
public void setValue(T opt_value) {
4141
this.opt_value = opt_value;
4242
}
4343

0 commit comments

Comments
 (0)