package de.tuberlin.dima.schubotz.common.utils;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import de.tuberlin.dima.schubotz.wiki.types.WikiTuple;
import eu.stratosphere.api.java.DataSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.google.common.collect.HashMultiset;

/**
 * Helper for preprocessed generated CSV files
 */
public class CSVHelper {
	public static Log LOG = LogFactory.getLog(CSVHelper.class);
	/**
	 * @param in path + name of file to read from
	 * @return HashMultiset, where index is first CSV field, count is second CSV field
	 * @throws FileNotFoundException
	 * @throws IOException
	 */
	public static HashMultiset<String> csvToMultiset(String in) throws FileNotFoundException, IOException {
		HashMultiset<String> out = HashMultiset.create();
		BufferedReader br = new BufferedReader(new FileReader(in));
        String line = "";
        while ((line = br.readLine()) != null) {
        	String parts[] = line.split(" ");
        	try {
        		out.add(parts[0], Integer.valueOf(parts[1]).intValue());
        	} catch (NullPointerException e) {
        		if (LOG.isWarnEnabled()) {
        			LOG.warn("Non integer in CSV!");
        		}
        		continue;
        	}
        }
        br.close();
        return out;
	}

    public static DataSet<WikiTuple> csvToWikiTuple(String in) throws FileNotFoundException, IOException {

    }
}

@@ -167,16 +167,67 @@
 ption;%0A%0A
+import de.tuberlin.dima.schubotz.wiki.WikiProgram;%0A
 import d
@@ -273,16 +273,16 @@
 iTuple;%0A
-
 import e
@@ -589,16 +589,186 @@
 class);%0A
+    public static final String CSV_LINE_SEPARATOR = WikiProgram.CSV_LINE_SEPARATOR;%0A    public static final String CSV_FIELD_SEPARATOR = WikiProgram.CSV_FIELD_SEPARATOR;%0A
 %09/**%0A%09 *
@@ -1271,16 +1271,16 @@
 ring
+%5B%5D
  parts
-%5B%5D
  = l
@@ -1293,11 +1293,27 @@
 lit(
-%22 %22
+CSV_FIELD_SEPARATOR
 );%0A 
@@ -1682,52 +1682,30 @@
 in) 
-throws FileNotFoundException, IOException %7B%0A
+%7B%0A        return null;
 %0A   

Add skeleton method and vars to CSVHelper