Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import java.io.File;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6.  
  7.  
  8. public class GeodataTxtParser extends TxtParser {
  9.     static int id = 1;
  10.  
  11.     public GeodataTxtParser(File file) {
  12.         super(file);
  13.     }
  14.    
  15.     public  List parse() {
  16.      
  17.         List<String> lines = super.parse();
  18.         List<String> results = new ArrayList<String>();
  19.         String[] data = null;
  20.  
  21.        
  22.         for(String line: lines){
  23.             data = line.split(" ");
  24.            
  25.        
  26.  
  27.       double  x = Double.parseDouble(data[1]);
  28.        double y = Double.parseDouble(data[2]);
  29.        double z = Double.parseDouble(data[3]);
  30.      
  31.        
  32.    
  33.  
  34.  
  35.             id++;
  36.        
  37.        
  38.            
  39.     results.add(data[0]+ data[1]+data[2]+data[3]);
  40.            
  41.         }
  42.        
  43.     return results;
  44.  
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement