-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.java
More file actions
48 lines (40 loc) · 799 Bytes
/
Event.java
File metadata and controls
48 lines (40 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
public class Event implements Comparable<Event>{
Line line;
Boolean isLesser; //this is set to true for horizontal lines in ProposedAlgorithm
Boolean isVertical;
int y;
public Event(Line l, Boolean isL) {
line = l;
isLesser = isL;
isVertical = l.isVertical();
if (isLesser)
y = line.getLesser().getY();
else
y = line.getGreater().getY();
}
@Override
public int compareTo(Event e) {
int comp = y - e.getY();
if (comp == 0) {
if (isVertical && !e.isVertical()) {
return -1;
}
else if (!isVertical && e.isVertical()) {
return 1;
}
}
return comp;
}
public Line getLine() {
return line;
}
public Boolean isLesser() {
return isLesser;
}
public Boolean isVertical() {
return isVertical;
}
public int getY() {
return y;
}
}