雙閱讀我這裏,數據是這樣寫的.txt文件:從.txt文件
ZONEIDFROM; ZONEIDTO; DISTANCETYPE; FACILITYID;距離;
1; 2; C; HF; 9,416667;
我想如果zoneidfrom = 1和zoneidto = 2
一切都似乎是在我的代碼好,除了這是一個雙重的距離返回的距離。
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;
}