public TreeMap countyDistanceDataParser() {
TreeMap treeOfCountyDistance = new TreeMap();
String record = null;
String key = null;
try {
FileReader fileReader = new FileReader(this.countyDistanceData);
BufferedReader buffer = new BufferedReader(fileReader);
record = new String();
StringTokenizer stringToken;
String s1 = buffer.readLine();
int count = 0; // the arrays of th shortest paths start from one
while ((record = buffer.readLine()) != null) {
//Logger.out.println("record: " + record);
stringToken = new StringTokenizer(record);
CountyDistance cntDist = new CountyDistance();
count = count + 1;
int counter = 0;
while (stringToken.hasMoreTokens()) {
String str = stringToken.nextToken();
counter = counter + 1;
if (counter == 1) {
cntDist.setOrgFips("f" + str);
} else if (counter == 2) {
cntDist.setDestFips("f" + str);
} else if (counter == 3) {
cntDist.setOrgName(str);
} else if (counter == 4) {
cntDist.setDestName(str);
} else if (counter == 5) {
Float gcd = new Float(str);
float gcdF = gcd.floatValue();
cntDist.setGCD(gcdF);
} else if (counter == 6) {
Float hmi = new Float(str);
float hmiF = hmi.floatValue();
cntDist.setH_Mi(hmiF);
} else if (counter == 7) {
Float himp = new Float(str);
float himpF = himp.floatValue();
cntDist.setH_Imp(himpF);
} else if (counter == 8) {
Float Rmi = new Float(str);
float RmiF = Rmi.floatValue();
cntDist.setR_Mi(RmiF);
} else if (counter == 9) {
Float Rimp = new Float(str);
float RimpF = Rimp.floatValue();
cntDist.setR_Imp(RimpF);
} else if (counter == 10) {
Float wmi = new Float(str);
float wmiF = wmi.floatValue();
cntDist.setW_Mi(wmiF);
} else if (counter == 11) {
Float wimp = new Float(str);
float wimpF = wimp.floatValue();
cntDist.setW_Imp(wimpF);
} else if (counter == 12) {
Float HRHimp = new Float(str);
float HRHimpF = HRHimp.floatValue();
cntDist.setHRH_Imp(HRHimpF);
}
}
// add the intersection to the tree
key = cntDist.getOrgFips() + cntDist.getDestFips();
treeOfCountyDistance.put(key, cntDist);
}
} catch (IOException e) {
// catch possible io errors from readLine()
System.out.println("IOException error: ");
e.printStackTrace();
}
return treeOfCountyDistance;
}