-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGap.java
More file actions
50 lines (40 loc) · 986 Bytes
/
Gap.java
File metadata and controls
50 lines (40 loc) · 986 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
49
50
class Gap{
Int3 first;
int gapSize;
double time;
Gap(Int3 first, int gapSize, double time){
this.first = first;
this.gapSize = gapSize;
this.time = (System.nanoTime() - time) / 1000000;
}
public String toString(){
return ("Found new gap with size " + gapSize + ", after prime " + first.toString() + ". Used " + time + " ms.");
}
}
class GapSave{
Gap[] gaps;
int saveAtIndex = 0;
int biggestGapSize = 0;
GapSave(int nToSave){
gaps = new Gap[nToSave];
}
public void save(Gap g){
gaps[saveAtIndex] = g;
saveAtIndex++;
if (g.gapSize > biggestGapSize){
biggestGapSize = g.gapSize;
}
}
public void resetSaveIndex(){
saveAtIndex = 0;
}
public Gap read(int i){
return gaps[i];
}
public int getLength(){
return saveAtIndex;
}
public int getBiggestGap(){
return biggestGapSize;
}
}