// Path: src/main/java/smile/wide/data/DataSetReader.java
// public interface DataSetReader<K,V> {
// 
// 	// ==========================================
// 	// this part about configuring the reader
// 
// 	/**
// 	 * 
// 	 * @param filter - a string like 1,2,4-5, all - weka-style
// 	 * 
// 	 * 1-based index of the column in the un-filtered dataset
// 	 * 
// 	 */
// 	void setFilter(String filter);
// 	
// 	/**
// 	 * Which column represents the unique instance ID.
// 	 * This is required, because the map may require
// 	 * the instance ID for output to reduce.
// 	 * 
// 	 * 1-based index of the column in the un-filtered dataset
// 	 * So if filter is 1,3,5 and instanceID = 2, the second 
// 	 * column is used, and not part of the data presented to the
// 	 * Bayes network.
// 	 */
// 	void setInstanceIDColumn(int instanceIDcolumn);
// 	
// 	// ==========================================
// 	// this part about reading from a text file
// 	
// 	/** 
// 	 *	open the file to read from.
// 	 *  close previous file if open
// 	 *  
// 	 *  @return file successfully opened
// 	 */
// 	boolean setFile(String fileName);
// 	
// 	/** 
// 	 *	set file pointer back to start
// 	 *  
// 	 *  @return file successfully rewound
// 	 */
// 	boolean rewind();
// 	
// 	/** 
// 	 * 
// 	 * @return the next record as an instance
// 	 *         or null if end of file
// 	 * 
// 	 */
// 	Instance<K, V> nextRecord();
// 	
// 	// ==========================================
// 	// this part about parsing lines one by one
// 		
// 	Instance<K, V> parseLine(String value);
// 
// 	// ==========================================
// 	// this part about interpreting the values	
// 	
// 	/** 
// 	 * Interpret a raw string value as a BN outcome.
// 	 * Must guarantee that output is a valid SMILE BN outcome identifier, 
// 	 * but need not specifically check that it is valid for a particular network.
// 	 * 
// 	 * @param value
// 	 * @return A Bayesian network outcome valid for the attribute.
// 	 */
// 	public abstract String interpret(String value, String forAttribute);
// 	
// 	/** 
// 	 * Does the given string represents a missing value for the given attribute?
// 	 * 
// 	 * @param value
// 	 * @param forAtribute
// 	 * @return	True iff the given string represent a missing value for the given attribute.
// 	 */
// 	public abstract boolean isMissingValue(String value, String forAtribute);
// 	
// }
// 
// Path: src/main/java/smile/wide/data/Instance.java
// public class Instance<ID,Value> {
// 	
// 	    private ID _id;
// 	    private Value[] _val;
// 	    
// 	    public Instance(ID id, Value[] v){
// 	        this._id = id;
// 	        this._val = v;
// 	    }
// 	    
// 	    public ID getID()
// 	    { 
// 	    	return _id; 
// 	    }
// 	    	    
// 	    public Value[] getValue()
// 	    { 
// 	    	return _val; 
// 	    }
// 	    
// 	    public void setID(ID id)
// 	    { 
// 	    	this._id = id; 
// 	    }
// 	    
// 	    public void setValue(Value[] v)
// 	    { 
// 	    	this._val = v; 
// 	    }
// 
// }


import smile.wide.data.Instance;
import static org.junit.Assert.*;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import smile.wide.data.DataSetReader;
			assertEquals(columnNames_.length, fileReaderFilter_.split(",").length);
			
			try {
				Object r = Class.forName(fileReaderClass_).newInstance();			
				reader_  = (DataSetReader<Integer,String>) r;  
			} catch (InstantiationException e) {
				s_logger.error("Instantiation exception for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			} catch (IllegalAccessException e) {
				s_logger.error("IllegalAccess exception for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			} catch (ClassNotFoundException e) {			 
				s_logger.error("ClassDefNotFoundException for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			} catch (ClassCastException e) {
				s_logger.error("ClassCastException for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			}		
			reader_.setFilter(fileReaderFilter_);
			reader_.setInstanceIDColumn(1);	// doesn't matter, won't use
			
			initializing_ = false;			
		}
		
		// we're initialized
		
// Path: src/main/java/smile/wide/data/DataSetReader.java
// public interface DataSetReader<K,V> {
// 
// 	// ==========================================
// 	// this part about configuring the reader
// 
// 	/**
// 	 * 
// 	 * @param filter - a string like 1,2,4-5, all - weka-style
// 	 * 
// 	 * 1-based index of the column in the un-filtered dataset
// 	 * 
// 	 */
// 	void setFilter(String filter);
// 	
// 	/**
// 	 * Which column represents the unique instance ID.
// 	 * This is required, because the map may require
// 	 * the instance ID for output to reduce.
// 	 * 
// 	 * 1-based index of the column in the un-filtered dataset
// 	 * So if filter is 1,3,5 and instanceID = 2, the second 
// 	 * column is used, and not part of the data presented to the
// 	 * Bayes network.
// 	 */
// 	void setInstanceIDColumn(int instanceIDcolumn);
// 	
// 	// ==========================================
// 	// this part about reading from a text file
// 	
// 	/** 
// 	 *	open the file to read from.
// 	 *  close previous file if open
// 	 *  
// 	 *  @return file successfully opened
// 	 */
// 	boolean setFile(String fileName);
// 	
// 	/** 
// 	 *	set file pointer back to start
// 	 *  
// 	 *  @return file successfully rewound
// 	 */
// 	boolean rewind();
// 	
// 	/** 
// 	 * 
// 	 * @return the next record as an instance
// 	 *         or null if end of file
// 	 * 
// 	 */
// 	Instance<K, V> nextRecord();
// 	
// 	// ==========================================
// 	// this part about parsing lines one by one
// 		
// 	Instance<K, V> parseLine(String value);
// 
// 	// ==========================================
// 	// this part about interpreting the values	
// 	
// 	/** 
// 	 * Interpret a raw string value as a BN outcome.
// 	 * Must guarantee that output is a valid SMILE BN outcome identifier, 
// 	 * but need not specifically check that it is valid for a particular network.
// 	 * 
// 	 * @param value
// 	 * @return A Bayesian network outcome valid for the attribute.
// 	 */
// 	public abstract String interpret(String value, String forAttribute);
// 	
// 	/** 
// 	 * Does the given string represents a missing value for the given attribute?
// 	 * 
// 	 * @param value
// 	 * @param forAtribute
// 	 * @return	True iff the given string represent a missing value for the given attribute.
// 	 */
// 	public abstract boolean isMissingValue(String value, String forAtribute);
// 	
// }
// 
// Path: src/main/java/smile/wide/data/Instance.java
// public class Instance<ID,Value> {
// 	
// 	    private ID _id;
// 	    private Value[] _val;
// 	    
// 	    public Instance(ID id, Value[] v){
// 	        this._id = id;
// 	        this._val = v;
// 	    }
// 	    
// 	    public ID getID()
// 	    { 
// 	    	return _id; 
// 	    }
// 	    	    
// 	    public Value[] getValue()
// 	    { 
// 	    	return _val; 
// 	    }
// 	    
// 	    public void setID(ID id)
// 	    { 
// 	    	this._id = id; 
// 	    }
// 	    
// 	    public void setValue(Value[] v)
// 	    { 
// 	    	this._val = v; 
// 	    }
// 
// }


// Path: src/main/java/smile/wide/AttributeValueHistogramMapper.java
import smile.wide.data.Instance;
import static org.junit.Assert.*;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import smile.wide.data.DataSetReader;

			assertEquals(columnNames_.length, fileReaderFilter_.split(",").length);
			
			try {
				Object r = Class.forName(fileReaderClass_).newInstance();			
				reader_  = (DataSetReader<Integer,String>) r;  
			} catch (InstantiationException e) {
				s_logger.error("Instantiation exception for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			} catch (IllegalAccessException e) {
				s_logger.error("IllegalAccess exception for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			} catch (ClassNotFoundException e) {			 
				s_logger.error("ClassDefNotFoundException for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			} catch (ClassCastException e) {
				s_logger.error("ClassCastException for DataSetReader " + fileReaderClass_);
				e.printStackTrace();
				System.exit(1);
			}		
			reader_.setFilter(fileReaderFilter_);
			reader_.setInstanceIDColumn(1);	// doesn't matter, won't use
			
			initializing_ = false;			
		}
		
		// we're initialized
		
		Instance<Integer,String> inst = reader_.parseLine(value.toString());				