×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Vojtech Bayer
Added: Dec 9, 2013 2:45 PM
Views: 1848
Tags: no tags
  1. public void read(InputStream ins) throws IOException {
  2.         String line;
  3.         String[] params;
  4.         SortedMap<String,Vertex2D> temp = new TreeMap<>();
  5.        
  6.       try(BufferedReader br = new BufferedReader(new InputStreamReader(ins))){
  7.            
  8.         while((line = br.readLine())!= null){
  9.             params = line.split(line,3);
  10.            
  11.            
  12.             double valX = Double.parseDouble(params[0]);
  13.             double valY = Double.parseDouble(params[1]);
  14.            
  15.                        
  16.             temp.put(params[2],new Vertex2D(valX,valY));
  17.         }
  18.        
  19.       }
  20.      
  21.       verts.putAll(temp);
  22.    
  23.     }