package immibis.bon.mcp;

import java.io.*;
import java.util.*;

public abstract class CsvFile {
	public static Map<String, String> read(File f, int[] n_sides) throws IOException {
		Map<String, String> data = new HashMap<String, String>();
		Scanner in = new Scanner(new BufferedReader(new FileReader(f)));
		
		try {
			in.useDelimiter(",");
			while(in.hasNextLine()) {
				String searge = in.next();
				String name = in.next();
				String side = in.next();
				/*String desc =*/ in.nextLine();
				if(sideIn(Integer.parseInt(side), n_sides)) {
					data.put(searge, name);
				}
			}
		} finally {
			in.close();
		}
		return data;
	}

	private static boolean sideIn(int i, int[] ar) {
		for(int n : ar)
			if(n == i)
				return true;
		return false;
	}
}

@@ -488,24 +488,35 @@
 nextLine();%0A
+%09%09%09%09try %7B%0A%09
 %09%09%09%09if(sideI
@@ -558,16 +558,17 @@
  %7B%0A%09%09%09%09%09
+%09
 data.put
@@ -583,16 +583,62 @@
  name);%0A
+%09%09%09%09%09%7D%0A%09%09%09%09%7D catch(NumberFormatException e) %7B%0A
 %09%09%09%09%7D%0A%09%09

Fix last commit.