-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.java
More file actions
58 lines (54 loc) · 1.82 KB
/
Copy pathController.java
File metadata and controls
58 lines (54 loc) · 1.82 KB
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
51
52
53
54
55
56
57
58
import java.util.*;
import java.io.*;
/**
* This is the testing class.
*
* @author Tafita Rakotozandry & Taylor Strong & Khalid Al-Motaery
* @version 11/28/2020
*/
public class Controller
{
static String[] titles = {"The Yellow Wallpaper","Home-made Electrical Apparatus","The Adventures of Sherlock Holmes","Emma","Whale","Shakespeare"};
public static void main(String[] args) {
Controller c = new Controller();
for (int i=0; i<titles.length; i++){
c.timeHashIndex(titles[i]);
}
System.out.println("Hash Index Time");
for (int i=0; i<titles.length; i++){
c.timeTreeIndex(titles[i]);
}
System.out.println("Tree Index Time");
for (int i=0; i<titles.length; i++){
c.timeArrayIndex(titles[i]);
}
System.out.println("Array Index Time");
}
public void timeHashIndex(String title){
HashIndex hash = new HashIndex();
long start = System.currentTimeMillis();
hash.readFile(title);
hash.createOutFile();
long end = System.currentTimeMillis();
long time = end - start;
System.out.println(time);
}
public void timeTreeIndex(String title){
TreeIndex tree = new TreeIndex();
long start = System.currentTimeMillis();
tree.readFile(title);
tree.createOutFile();
long end = System.currentTimeMillis();
long time = end - start;
System.out.println(time);
}
public void timeArrayIndex(String title){
ArrayIndex array = new ArrayIndex();
long start = System.currentTimeMillis();
array.readFile(title);
array.createOutFile();
long end = System.currentTimeMillis();
long time = end - start;
System.out.println(time);
}
}