Advertisement
INSECURE-FLOWERPOT

Untitled

Mar 27th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. while(cities!=null&&peopleList != null)
  2. {
  3.  
  4. String[]citiesTokens=cities.split("; ");
  5. if(citiesTokens.length == 4)
  6. {
  7. String cityState=citiesTokens[0]+","+citiesTokens[1];
  8. String latLong=citiesTokens[2]+","+citiesTokens[3];
  9. hash.put(cityState, latLong);
  10.  
  11. peopleLine.add(peopleList);
  12. }
  13. cities=brCities.readLine();
  14. peopleList=brPeopleList.readLine();
  15.  
  16. }
  17.  
  18. for(int i=0; i<peopleLine.size();i++)
  19. {
  20. String[]tokens=peopleLine.get(i).split(",");
  21. if(tokens.length ==4 || tokens.length ==5)
  22. {
  23. int x=-1;
  24. for(int j=0; j<states.size(); j++)
  25. {
  26. State s= states.get(j);
  27. if(s.getState().equals(tokens[3]))
  28. {
  29. x=j;
  30. break;
  31. }
  32. }
  33. if(x>=0)
  34. {
  35. State s=states.get(x);
  36. if(hash.containsKey(tokens[2]+","+tokens[3]))
  37. {
  38. String latLong= hash.get(tokens[2]+","+tokens[3]);
  39. s.addCity(tokens[2],latLong);
  40.  
  41. s.addPeople(peopleLine.get(i));
  42. }
  43. }
  44. else
  45. {
  46. states.add(new State(tokens[2],tokens[3],peopleLine.get(i),hash.get(tokens[2]+","+tokens[3])));
  47. }
  48. }
  49. else
  50. {
  51. states.add(new State(tokens[2],tokens[3],peopleLine.get(i),hash.get(tokens[2]+","+tokens[3])));
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement