-
Notifications
You must be signed in to change notification settings - Fork 0
/
FloorsArrayLink.java
51 lines (42 loc) · 935 Bytes
/
FloorsArrayLink.java
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
49
50
public class FloorsArrayLink {
private FloorsArrayLink[] nextPointers;
private FloorsArrayLink[] prevPointers;
private double key;
public FloorsArrayLink(double key, int arrSize){
this.key = key;
nextPointers = new FloorsArrayLink[arrSize];
prevPointers = new FloorsArrayLink[arrSize];
}
public double getKey() {
return key;
}
public FloorsArrayLink getNext(int i) {
if (i > nextPointers.length) {
return null;
}
else {
return nextPointers[i-1];
}
}
public FloorsArrayLink getPrev(int i) {
if (i > prevPointers.length) {
return null;
}
else {
return prevPointers[i-1];
}
}
public void setNext(int i, FloorsArrayLink next) {
if (i <= nextPointers.length) {
nextPointers[i-1] = next;
}
}
public void setPrev(int i, FloorsArrayLink prev) {
if (i <= prevPointers.length) {
prevPointers[i-1] = prev;
}
}
public int getArrSize(){
return prevPointers.length;
}
}