Advertisement
INSECURE-FLOWERPOT

Untitled

Feb 27th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. line=br.readLine();
  2. while(line != null)
  3. {
  4.  
  5. String[]tokens = line.split(delim);
  6.  
  7. if(tokens.length==4)
  8. {
  9. String[]tok=tokens[0].split(del);
  10. //START HERE
  11. if(!place.isEmpty())
  12. {
  13. //does this place exist?
  14.  
  15. int x = -1;
  16. //loop through all places and do manual check for place name
  17. for(int i=0; i<place.size(); i++)
  18. {
  19. Place lugar = place.get(i);
  20. if(lugar.getState().equals(tokens[3]))
  21. {
  22. x = i;
  23. break;
  24. }
  25. }
  26. if(x>=0)
  27. {
  28. //it does exist, add the city and state to that place
  29. Place lugar = place.get(x);
  30. lugar.addCity(tokens[2]);
  31. lugar.addPeople(line);
  32. }
  33. else
  34. {
  35. place.add(new Place(tokens[2],tokens[3],line));
  36. }
  37.  
  38.  
  39. }
  40. else
  41. {
  42.  
  43. place.add(new Place(tokens[2],tokens[3],line));
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement