public void readDumpedPersons(String file) { try { FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String curr_line; while ((curr_line = br.readLine()) != null) { String[] entrs = curr_line.split(";", -1); Id<Person> userId = Id.create(entrs[0].trim().substring(4, 8), Person.class); EstimationPerson person = new EstimationPerson(userId); this.population.put(userId, person); person.setAge(Math.max(0, Integer.parseInt(entrs[1].trim()))); if (entrs[2].trim().equals("w")) { person.setSex("f"); } else if (entrs[2].trim().equals("m")) { person.setSex("m"); } else { person.setSex("-99"); } person.setWeight(1.0); // TODO: hh income -99 = AHV if (!entrs[3].trim().equals("")) { person.setHhIncome(Integer.parseInt(entrs[3].trim())); } else { person.setHhIncome(-1); } person.setHhSize(Integer.parseInt(entrs[4].trim())); person.setNbrPersonShoppingTripsMonth(Integer.parseInt(entrs[5].trim())); person.setNbrShoppingTripsMonth(entrs[6].trim()); Location hlocation = new Location(Id.create(-1, Location.class)); person.setHomeLocation(hlocation); hlocation.setCity(entrs[10].trim()); CoordImpl hcoords = new CoordImpl( Double.parseDouble(entrs[12].trim()), Double.parseDouble(entrs[11].trim())); hlocation.setCoord(this.trafo.transform(hcoords)); // TODO: prüfen bei NULL person.setModesForShopping( SurveyControler.modes.indexOf("car"), SurveyControler.frequency.indexOf(entrs[13].trim().replaceAll("car", ""))); person.setModesForShopping( SurveyControler.modes.indexOf("pt"), SurveyControler.frequency.indexOf(entrs[14].trim().replaceAll("pt", ""))); person.setModesForShopping( SurveyControler.modes.indexOf("bike"), SurveyControler.frequency.indexOf(entrs[15].trim().substring(1))); person.setModesForShopping( SurveyControler.modes.indexOf("walk"), SurveyControler.frequency.indexOf(entrs[16].trim().substring(1))); boolean hasJob = entrs[17].trim().equals("yes"); if (hasJob) { Location wlocation = new Location(Id.create(-2, Location.class)); person.setEmployed(hasJob); person.setWorkLocation(wlocation); wlocation.setCity(entrs[21].trim()); wlocation.setCoord( this.trafo.transform( new CoordImpl( Double.parseDouble(entrs[22].trim()), Double.parseDouble(entrs[23].trim())))); if (entrs[25].trim().contains("car")) person.setModeForWorking(SurveyControler.modes.indexOf("car"), true); if (entrs[25].trim().contains("pt")) person.setModeForWorking(SurveyControler.modes.indexOf("pt"), true); if (entrs[25].trim().contains("bike")) person.setModeForWorking(SurveyControler.modes.indexOf("bike"), true); if (entrs[25].trim().contains("walk")) person.setModeForWorking(SurveyControler.modes.indexOf("walk"), true); person.setAreaToShop( 0, SurveyControler.frequency.indexOf(entrs[26].trim().replaceAll("home", ""))); person.setAreaToShop( 1, SurveyControler.frequency.indexOf(entrs[27].trim().replaceAll("work", ""))); person.setAreaToShop( 2, SurveyControler.frequency.indexOf(entrs[28].trim().replaceAll("inter", ""))); person.setAreaToShop( 3, SurveyControler.frequency.indexOf(entrs[29].trim().replaceAll("other", ""))); } } } catch (IOException e) { e.printStackTrace(); } }