package dfatool.strategy.elements;

import java.net.URI;

import org.eclipse.core.runtime.IPath;

import patterns.Subject;

public class Configuration extends Subject{
	
	private String datatypesFile;
	private String varsFile;
	private String atomsFile;
	private String channelsFile;
	private String networkFile;
	private String scriptsPath;
	private String logsPath;
	private String fdrHome;
	private Description description;
	private Context context;
	private static Configuration instance;
	private boolean isConfigured;
	
	private Configuration() {
		isConfigured = false;
	}
	
	public static void reInit(){
		instance = new Configuration();
	}
	
	public String getFdrHome() {
		return "/Users/pedroribeiro/Tools/fdr-2.94-academic-osx";
	}
	
	public void testConfiguration(){
		String path = "/Users/pedroribeiro/Dropbox/Mestrado/workspace/DFATool/Test";
		this.datatypesFile = path +"/datatypes.dfa";
		this.varsFile = path +"/vars.dfa";
		this.atomsFile = path +"/atoms.dfa";
		this.channelsFile = path +"/channels.dfa";
		this.networkFile = path +"/network.dfa";
		this.scriptsPath = path +"/FDR_Scripts/";
		this.logsPath = path +"/FDR_Logs/";
		isConfigured = true;
		alertAll();
	}
	
	
	public void updateConfiguration(IPath projectPath) {
		this.datatypesFile = projectPath.append("/datatypes.dfa").toString();
		this.varsFile = projectPath.append("/vars.dfa").toString();
		this.atomsFile = projectPath.append("/atoms.dfa").toString();
		this.channelsFile = projectPath.append("/channels.dfa").toString();
		this.networkFile = projectPath.append("/network.dfa").toString();
		this.scriptsPath = projectPath.append("/FDR_Scripts/").toString();
		this.logsPath = projectPath.append("/FDR_Logs/").toString();
		isConfigured = true;
		alertAll();
	}
	
	public static Configuration getInstance(){
		if(instance == null)
			instance = new Configuration();
		return instance;
	}



	public String getDatatypesFile() {
		return datatypesFile;
	}



	public String getVarsFile() {
		return varsFile;
	}



	public String getAtomsFile() {
		return atomsFile;
	}



	public String getChannelsFile() {
		return channelsFile;
	}


	public String getNetworkFile() {
		return networkFile;
	}
	
	public void setConfigured(boolean isConfigured) {
		this.isConfigured = isConfigured;
	}

	
	public boolean isConfigured() {
		return isConfigured;
	}

	public String getScriptsPath() {
		return scriptsPath;
	}

	public String getLogsPath() {
		return logsPath;
	}
	
	
	
}
