- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashCodeMain.java
More file actions
Latest commit
81 lines (72 loc) · 2.25 KB
/
Copy pathHashCodeMain.java
File metadata and controls
81 lines (72 loc) · 2.25 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
importjava.util.*;
importjava.lang.*;
importjava.io.*;
importjava.nio.file.*;
importjava.util.ArrayList;
publicclassHashCodeMain{
publicstaticvoidmain(String[] args){
//inputname
Stringinputf=args[0];
intRAWS=0;
intCOLS=0;
intNUMV=0;
intNUMR=0;
intB=0;
intT=0;
intid=0;
Vehicle[] vs;
try{
//reading one input run
Filefile=newFile(inputf);
Scannerinput=newScanner(file);
System.out.println("Parsing input file: "+file);
Stringfirst=input.nextLine(); //read a line
Scannerline=newScanner(first);
RAWS=Integer.parseInt(line.next()); //read the raws value
COLS=Integer.parseInt(line.next()); //read the cols value
NUMV=Integer.parseInt(line.next()); //read the vehicle value
vs=newVehicle(NUMV);
NUMR=Integer.parseInt(line.next()); //read the rides value
B=Integer.parseInt(line.next()); //read the bonus value
T=Integer.parseInt(line.next()); //read the steps value
ArrayList<Ride> rides=newArrayList<>();
while(input.hasNextLine()){
Stringride=input.nextLine(); //read a line
line=newScanner(ride);
intsr=Integer.parseInt(line.next()); //read the starting raw
intsc=Integer.parseInt(line.next()); //read the starting column
inter=Integer.parseInt(line.next()); //read the ending raw
intec=Integer.parseInt(line.next()); //read the ending column
intearly=Integer.parseInt(line.next()); //read the bonus value
intlate=Integer.parseInt(line.next()); //read the steps value
Rider=newRide(id,sr,sc,er,ec,early,late);
id++;
rides.add(r);
}
input.close();
}
catch(IOExceptione){
System.out.println(e);
System.exit(0);
}
System.out.println("Succesfully parsed");
//Writing the run file for condorcet strategy
/*String fileName="results/condorcet-fuse.res";
FileWriter fileWriter=null;
try{
fileWriter = new FileWriter(fileName);
}
catch(IOException e){
System.exit(1);
}
PrintWriter printWriter = new PrintWriter(fileWriter);
for(int y=0;y<50;y++){
condorcet[y].defineRank();
condorcet[y].reverse();
printWriter.print(condorcet[y]);
}
System.out.println("Output of Condorcet-fuse in file "+fileName);
printWriter.close();
*/
}
}