// Path: src/individualBasedModel/DemeType.java
// public enum DemeType {
// 	MIGRATION_OF_INFECTEDS, INFECTION_OVER_NETWORK
// }
// 
// Path: src/individualBasedModel/JustBeforeRecoverySampler.java
// public class JustBeforeRecoverySampler implements Sampler {
// 	
// 	protected double justBefore = 1e-16;
// 
// 	public JustBeforeRecoverySampler() {
// 		
// 	}
// 	
// 	public void setJustBefore(double d) {
// 		this.justBefore = d;
// 	}
// 
// 	/** 
// 	 * never does population sampling
// 	 */
// 	@Override
// 	public List<Event> generateSamplingEvents(Population thePopulation,
// 			double actionTime) {
// 		// TODO Auto-generated method stub
// 		return null;
// 	}
// 
// 	@Override
// 	public List<Event> generateSamplingEvents(Event eventPerformed) {
// 		
// 		List<Event> samplingEvents = null;
// 		
// 		if ((eventPerformed.success) && (eventPerformed.type == EventType.RECOVERY)) {
// 				//System.out.println("Attempt to set sampling from "+eventPerformed.toOutput());
// 			
// 				samplingEvents 	= new ArrayList<Event>();
// 				Event e 		= new Event();
// 				
// 				e.setSamplingEvent(eventPerformed.toHost, eventPerformed.creationTime, eventPerformed.actionTime - justBefore);
// 				samplingEvents.add(e);
// 			
// 				//System.out.println("Sampling: "+e.toOutput());
// 		}
// 		
// 		return samplingEvents;
// 	}
// 	
// 	@Override
// 	public List<String[]> getSamplerParameterList() {
// 		List<String[]> params = new ArrayList<String[]>();
// 
// 		String className = this.getClass().getName(); 
// 		params.add(new String[]{"SamplerType", className});
// 		params.add(new String[]{"justBefore",""+justBefore});
// 		
// 		return params;
// 	}
// 	
// 	/*
// 	@Override
// 	
// 	public void setSamplerParameters(List<String[]> params) {
// 		
// 		int i 				= 0;
// 		boolean found 		= false;
// 		String className 	= this.getClass().getName(); 
// 		
// 		while ( (i < params.size()) && (!found) ) {
// 			String[] pairs = params.get(i);
// 			
// 			if (pairs[0].equals("SamplerType")) {
// 				found = (pairs[1].equals(className));
// 			}
// 			
// 			i++;
// 		}
// 		
// 		if (found) {
// 			while (i < params.size()) {
// 				String[] pairs = params.get(i);
// 				
// 				if (pairs[0].equals("justBefore")) {
// 					justBefore = Double.parseDouble(pairs[1]);
// 				}
// 				i++;
// 			}
// 		}
// 	}
// 	*/
// 	
// 	@Override
// 	public void setSamplerParameters(List<Parameter> params) {
// 		int i			    = 0;
// 		boolean found 		= false;
// 		String className 	= this.getClass().getName(); 
// 		
// 		while ( (i < params.size()) && (!found) ) {
// 			Parameter p = params.get(i);
// 			if ( (p.getParentTag().equals("Sampler")) && (p.getId().equals("SamplerType")) ) {
// 				found = (p.getValue().equals(className));
// 			}
// 			i++;
// 		}
// 		
// 		if (found) {
// 			while (i < params.size()) {
// 				Parameter p = params.get(i);
// 				
// 				if (p.getId().equals("justBefore")) {
// 					justBefore = Double.parseDouble(p.getValue());
// 				}
// 				
// 				i++;
// 			}
// 		}
// 	}
// 	
// }
// 
// Path: src/individualBasedModel/ModelType.java
// public enum ModelType {
// 	SI, SIR, SEIR
// }
// 
// Path: src/individualBasedModel/PopulationType.java
// public enum PopulationType {
// 	FULL, RANDOM, LINE, STAR, NETWORK
// }
// 
// Path: src/individualBasedModel/Sampler.java
// public interface Sampler {
// 
// 	/**
// 	 * generate sampling events from the population
// 	 * @param thePopulation
// 	 * @param actionTime
// 	 * @return
// 	 */
// 	List<Event> generateSamplingEvents(Population thePopulation, double actionTime);
// 	
// 	/**
// 	 * generated sampling events based on this event (e.g. infection, recovery)
// 	 * @param e
// 	 * @return
// 	 */
// 	List<Event> generateSamplingEvents(Event e);
// 	
// 	/**
// 	 * return parameter,value pairs for use with Logger etc
// 	 * @return
// 	 */
// 	List<String[]> getSamplerParameterList();
// 	
// 	/**
// 	 * set parameters from parameter,value pairs
// 	 * @param params
// 	 */
// 	//void setSamplerParameters( List<String[]> params);
// 	void setSamplerParameters( List<Parameter> params);
// }


import individualBasedModel.DemeType;
import individualBasedModel.JustBeforeRecoverySampler;
import individualBasedModel.ModelType;
import individualBasedModel.PopulationType;
import individualBasedModel.Sampler;
import java.util.ArrayList;
import java.util.List;
package io;



/**
 * class to create the input xml for DiscreteSpatialPhyloSimulator,
 * specifically for a network.
 * It reads the edge list from edgeList.csv, assumes 1 host per deme, and infection parameters, and writes example_network_params.xml
 * @author Samantha Lycett
 * @version 29 Dec 2014
 *
 */
public class WriteNetworkConfigurationXML  implements ConfigurationXMLInterface {

	String path				= "test//";
	String rootname			= "example_network";
	
	String simpath			= "test//";
	String simname			= "example_network";
	long   seed  			= -1;
	int	   nreps 			=  1;
	double tauleap 			= 0;
	
	String	edgeListName	= "example_network_edgeList.csv";
	ReadEdgeList edgeList;
	String  dn				= "N";
	

	Sampler 		theSampler		= new JustBeforeRecoverySampler();
	PopulationType 	popType 		= PopulationType.NETWORK;
// Path: src/individualBasedModel/DemeType.java
// public enum DemeType {
// 	MIGRATION_OF_INFECTEDS, INFECTION_OVER_NETWORK
// }
// 
// Path: src/individualBasedModel/JustBeforeRecoverySampler.java
// public class JustBeforeRecoverySampler implements Sampler {
// 	
// 	protected double justBefore = 1e-16;
// 
// 	public JustBeforeRecoverySampler() {
// 		
// 	}
// 	
// 	public void setJustBefore(double d) {
// 		this.justBefore = d;
// 	}
// 
// 	/** 
// 	 * never does population sampling
// 	 */
// 	@Override
// 	public List<Event> generateSamplingEvents(Population thePopulation,
// 			double actionTime) {
// 		// TODO Auto-generated method stub
// 		return null;
// 	}
// 
// 	@Override
// 	public List<Event> generateSamplingEvents(Event eventPerformed) {
// 		
// 		List<Event> samplingEvents = null;
// 		
// 		if ((eventPerformed.success) && (eventPerformed.type == EventType.RECOVERY)) {
// 				//System.out.println("Attempt to set sampling from "+eventPerformed.toOutput());
// 			
// 				samplingEvents 	= new ArrayList<Event>();
// 				Event e 		= new Event();
// 				
// 				e.setSamplingEvent(eventPerformed.toHost, eventPerformed.creationTime, eventPerformed.actionTime - justBefore);
// 				samplingEvents.add(e);
// 			
// 				//System.out.println("Sampling: "+e.toOutput());
// 		}
// 		
// 		return samplingEvents;
// 	}
// 	
// 	@Override
// 	public List<String[]> getSamplerParameterList() {
// 		List<String[]> params = new ArrayList<String[]>();
// 
// 		String className = this.getClass().getName(); 
// 		params.add(new String[]{"SamplerType", className});
// 		params.add(new String[]{"justBefore",""+justBefore});
// 		
// 		return params;
// 	}
// 	
// 	/*
// 	@Override
// 	
// 	public void setSamplerParameters(List<String[]> params) {
// 		
// 		int i 				= 0;
// 		boolean found 		= false;
// 		String className 	= this.getClass().getName(); 
// 		
// 		while ( (i < params.size()) && (!found) ) {
// 			String[] pairs = params.get(i);
// 			
// 			if (pairs[0].equals("SamplerType")) {
// 				found = (pairs[1].equals(className));
// 			}
// 			
// 			i++;
// 		}
// 		
// 		if (found) {
// 			while (i < params.size()) {
// 				String[] pairs = params.get(i);
// 				
// 				if (pairs[0].equals("justBefore")) {
// 					justBefore = Double.parseDouble(pairs[1]);
// 				}
// 				i++;
// 			}
// 		}
// 	}
// 	*/
// 	
// 	@Override
// 	public void setSamplerParameters(List<Parameter> params) {
// 		int i			    = 0;
// 		boolean found 		= false;
// 		String className 	= this.getClass().getName(); 
// 		
// 		while ( (i < params.size()) && (!found) ) {
// 			Parameter p = params.get(i);
// 			if ( (p.getParentTag().equals("Sampler")) && (p.getId().equals("SamplerType")) ) {
// 				found = (p.getValue().equals(className));
// 			}
// 			i++;
// 		}
// 		
// 		if (found) {
// 			while (i < params.size()) {
// 				Parameter p = params.get(i);
// 				
// 				if (p.getId().equals("justBefore")) {
// 					justBefore = Double.parseDouble(p.getValue());
// 				}
// 				
// 				i++;
// 			}
// 		}
// 	}
// 	
// }
// 
// Path: src/individualBasedModel/ModelType.java
// public enum ModelType {
// 	SI, SIR, SEIR
// }
// 
// Path: src/individualBasedModel/PopulationType.java
// public enum PopulationType {
// 	FULL, RANDOM, LINE, STAR, NETWORK
// }
// 
// Path: src/individualBasedModel/Sampler.java
// public interface Sampler {
// 
// 	/**
// 	 * generate sampling events from the population
// 	 * @param thePopulation
// 	 * @param actionTime
// 	 * @return
// 	 */
// 	List<Event> generateSamplingEvents(Population thePopulation, double actionTime);
// 	
// 	/**
// 	 * generated sampling events based on this event (e.g. infection, recovery)
// 	 * @param e
// 	 * @return
// 	 */
// 	List<Event> generateSamplingEvents(Event e);
// 	
// 	/**
// 	 * return parameter,value pairs for use with Logger etc
// 	 * @return
// 	 */
// 	List<String[]> getSamplerParameterList();
// 	
// 	/**
// 	 * set parameters from parameter,value pairs
// 	 * @param params
// 	 */
// 	//void setSamplerParameters( List<String[]> params);
// 	void setSamplerParameters( List<Parameter> params);
// }


// Path: src/io/WriteNetworkConfigurationXML.java
import individualBasedModel.DemeType;
import individualBasedModel.JustBeforeRecoverySampler;
import individualBasedModel.ModelType;
import individualBasedModel.PopulationType;
import individualBasedModel.Sampler;
import java.util.ArrayList;
import java.util.List;

package io;



/**
 * class to create the input xml for DiscreteSpatialPhyloSimulator,
 * specifically for a network.
 * It reads the edge list from edgeList.csv, assumes 1 host per deme, and infection parameters, and writes example_network_params.xml
 * @author Samantha Lycett
 * @version 29 Dec 2014
 *
 */
public class WriteNetworkConfigurationXML  implements ConfigurationXMLInterface {

	String path				= "test//";
	String rootname			= "example_network";
	
	String simpath			= "test//";
	String simname			= "example_network";
	long   seed  			= -1;
	int	   nreps 			=  1;
	double tauleap 			= 0;
	
	String	edgeListName	= "example_network_edgeList.csv";
	ReadEdgeList edgeList;
	String  dn				= "N";
	

	Sampler 		theSampler		= new JustBeforeRecoverySampler();
	PopulationType 	popType 		= PopulationType.NETWORK;
	ModelType		modelType		= ModelType.SIR;