I have a .txt file where data are written like this:
ZONEIDFROM;ZONEIDTO;DISTANCETYPE;FACILITYID;DISTANCE;
1;2;C;HF;9,416667;
I want to return the distance if zoneidfrom = 1 and zoneidto = 2.
Everything seems to be okay in my code except for the distance which is a double.
public void Load(String filename, int zoneidfrom, int zoneidto, String mode) throws Exception{
queue.clear();
int from,to;
double dist;
String c_or_l;
BufferedReader br = new BufferedReader(new FileReader(filename));
String ligne = br.readLine(); //First line read
while(ligne != null){
ligne = br.readLine(); //First line read
String [] tab = ligne.split(";");
ArrayList<Double> d = new ArrayList<>();
d.add(Double.parseDouble(ligne));
from = Integer.parseInt(tab[0]);
to = Integer.parseInt(tab[1]);
c_or_l = tab[2];
dist = d.get(4);
if(zoneidfrom == from && zoneidto == to && c_or_l.equals(mode));{
distance(dist);
}
}
}
public double distance(double db_distance){
return db_distance;
}