// Path: src/main/java/com/clematis/core/episode/Episode.java
// @XmlRootElement
// public class Episode {
// 	// private EpisodeSource source;
// 	private TraceObject source;
// 	private EpisodeTrace trace;
// 	private String dom;
// 	private boolean isBookmarked;
// 
// 	public Episode() {
// 
// 	}
// 
// 	/*
// 	 * public Episode(EpisodeSource source) { trace = new EpisodeTrace(); }
// 	 */
// 	public Episode(TraceObject source) {
// 		trace = new EpisodeTrace();
// 		this.source = source;
// 	}
// 
// 	public void addToTrace(TraceObject to) {
// 		trace.addToTrace(to);
// 	}
// 
// 	/*
// 	 * public EpisodeSource getSource() { return source; } public void setSource(EpisodeSource
// 	 * source) { this.source = source; }
// 	 */public EpisodeTrace getTrace() {
// 		return trace;
// 	}
// 
// 	public void setTrace(EpisodeTrace trace) {
// 		this.trace = trace;
// 	}
// 
// 	public String getDom() {
// 		return dom;
// 	}
// 
// 	public void setDom(String dom) {
// 		this.dom = dom;
// 	}
// 
// 	public TraceObject getSource() {
// 		return source;
// 	}
// 
// 	public void setSource(TraceObject source) {
// 		this.source = source;
// 	}
// 	
// 	public boolean getIsBookmarked() {
// 		return isBookmarked;
// 	}
// 
// 	public void setIsBookmarked(boolean isBookmarked) {
// 		this.isBookmarked = isBookmarked;
// 	}
// }
// 
// Path: src/main/java/com/clematis/core/trace/TraceObject.java
// @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
// public class TraceObject implements Comparable<TraceObject> {
// 	private int id;
// 	private int counter;
// 	private String messageType;
// 	private long timeStamp;
// 	private boolean isEpisodeSource;
// //	private boolean isBookmarked;
// 	
// 	public TraceObject() {
// 		isEpisodeSource = false;
// //		isBookmarked = false;
// 	}
// 	
// 	public int getCounter() {
// 		return counter;
// 	}
// 	public void setCounter(int counter) {
// 		this.counter = counter;
// 	}
// 	public int getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getMessageType() {
// 		return messageType;
// 	}
// 	public void setMessageType(String messageType) {
// 		this.messageType = messageType;
// 	}
// 	public long getTimeStamp() {
// 		return timeStamp;
// 	}
// 	public void setTimeStamp(long timeStamp) {
// 		this.timeStamp = timeStamp;
// 	}
// 	public int compareTo(TraceObject o) {
// 		if (counter < o.getCounter())
// 			return -1;
// 		else if (counter > o.getCounter())
// 			return 1;
// 		return 0;
// 	}
// 	
// 	public boolean isEpisodeSource() {
// 		return isEpisodeSource;
// 	}
// 	
// 	public void setEpisodeSource(boolean isEpisodeSource) {
// 		this.isEpisodeSource = isEpisodeSource;
// 	}
// /*
// 	public boolean getIsBookmarked() {
// 		return isBookmarked;
// 	}
// 
// 	public void setIsBookmarked(boolean isBookmarked) {
// 		this.isBookmarked = isBookmarked;
// 	}
// 	*/
// }


import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Date;
import org.jgrapht.ext.DOTExporter;
import org.jgrapht.ext.StringEdgeNameProvider;
import org.jgrapht.ext.StringNameProvider;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.DirectedMultigraph;
import com.crawljax.util.Helper;
import com.clematis.core.episode.Episode;
import com.clematis.core.trace.TraceObject;

			System.setOut(output);
			System.out.println("var causalLinks = new Array();");
			System.setOut(oldOut);

		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}

	@SuppressWarnings("unchecked")
	public void createGraph() {
		Date d = new Date();
		FileWriter fos;

		for (Episode e: el){
			// Populate graph with an edge for each episode
			addVertex(e);
		}

		for (int i = 0; i< el.size(); i++) {
			// Add causal edges between episodes
			Episode currentEpisode = el.get(i);

			// If the source is not included in the trace, add it
			if(!currentEpisode.getTrace().getTrace().contains(currentEpisode.getSource())) {
				// Need entire episode (including source) when looking for causality
				currentEpisode.getTrace().addToTrace(currentEpisode.getSource());
			}

// Path: src/main/java/com/clematis/core/episode/Episode.java
// @XmlRootElement
// public class Episode {
// 	// private EpisodeSource source;
// 	private TraceObject source;
// 	private EpisodeTrace trace;
// 	private String dom;
// 	private boolean isBookmarked;
// 
// 	public Episode() {
// 
// 	}
// 
// 	/*
// 	 * public Episode(EpisodeSource source) { trace = new EpisodeTrace(); }
// 	 */
// 	public Episode(TraceObject source) {
// 		trace = new EpisodeTrace();
// 		this.source = source;
// 	}
// 
// 	public void addToTrace(TraceObject to) {
// 		trace.addToTrace(to);
// 	}
// 
// 	/*
// 	 * public EpisodeSource getSource() { return source; } public void setSource(EpisodeSource
// 	 * source) { this.source = source; }
// 	 */public EpisodeTrace getTrace() {
// 		return trace;
// 	}
// 
// 	public void setTrace(EpisodeTrace trace) {
// 		this.trace = trace;
// 	}
// 
// 	public String getDom() {
// 		return dom;
// 	}
// 
// 	public void setDom(String dom) {
// 		this.dom = dom;
// 	}
// 
// 	public TraceObject getSource() {
// 		return source;
// 	}
// 
// 	public void setSource(TraceObject source) {
// 		this.source = source;
// 	}
// 	
// 	public boolean getIsBookmarked() {
// 		return isBookmarked;
// 	}
// 
// 	public void setIsBookmarked(boolean isBookmarked) {
// 		this.isBookmarked = isBookmarked;
// 	}
// }
// 
// Path: src/main/java/com/clematis/core/trace/TraceObject.java
// @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
// public class TraceObject implements Comparable<TraceObject> {
// 	private int id;
// 	private int counter;
// 	private String messageType;
// 	private long timeStamp;
// 	private boolean isEpisodeSource;
// //	private boolean isBookmarked;
// 	
// 	public TraceObject() {
// 		isEpisodeSource = false;
// //		isBookmarked = false;
// 	}
// 	
// 	public int getCounter() {
// 		return counter;
// 	}
// 	public void setCounter(int counter) {
// 		this.counter = counter;
// 	}
// 	public int getId() {
// 		return id;
// 	}
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 	public String getMessageType() {
// 		return messageType;
// 	}
// 	public void setMessageType(String messageType) {
// 		this.messageType = messageType;
// 	}
// 	public long getTimeStamp() {
// 		return timeStamp;
// 	}
// 	public void setTimeStamp(long timeStamp) {
// 		this.timeStamp = timeStamp;
// 	}
// 	public int compareTo(TraceObject o) {
// 		if (counter < o.getCounter())
// 			return -1;
// 		else if (counter > o.getCounter())
// 			return 1;
// 		return 0;
// 	}
// 	
// 	public boolean isEpisodeSource() {
// 		return isEpisodeSource;
// 	}
// 	
// 	public void setEpisodeSource(boolean isEpisodeSource) {
// 		this.isEpisodeSource = isEpisodeSource;
// 	}
// /*
// 	public boolean getIsBookmarked() {
// 		return isBookmarked;
// 	}
// 
// 	public void setIsBookmarked(boolean isBookmarked) {
// 		this.isBookmarked = isBookmarked;
// 	}
// 	*/
// }


// Path: src/main/java/com/clematis/visual/EpisodeGraph.java
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Date;
import org.jgrapht.ext.DOTExporter;
import org.jgrapht.ext.StringEdgeNameProvider;
import org.jgrapht.ext.StringNameProvider;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.DirectedMultigraph;
import com.crawljax.util.Helper;
import com.clematis.core.episode.Episode;
import com.clematis.core.trace.TraceObject;


			System.setOut(output);
			System.out.println("var causalLinks = new Array();");
			System.setOut(oldOut);

		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}

	@SuppressWarnings("unchecked")
	public void createGraph() {
		Date d = new Date();
		FileWriter fos;

		for (Episode e: el){
			// Populate graph with an edge for each episode
			addVertex(e);
		}

		for (int i = 0; i< el.size(); i++) {
			// Add causal edges between episodes
			Episode currentEpisode = el.get(i);

			// If the source is not included in the trace, add it
			if(!currentEpisode.getTrace().getTrace().contains(currentEpisode.getSource())) {
				// Need entire episode (including source) when looking for causality
				currentEpisode.getTrace().addToTrace(currentEpisode.getSource());
			}

			for (TraceObject to : currentEpisode.getTrace().getTrace()) {