package dfatool.strategy.elements;

import java.net.URI;

import org.eclipse.core.runtime.IPath;

import patterns.Subject;

public class Configuration extends Subject{
	
	private Description description;
	private Context context;
	private Network network;
	private static Configuration instance;
	
	private Configuration(IPath projectPath) {
		description = new Description(projectPath);
		network = new Network(projectPath);
		context = new Context(description);
	}
	
	public static void update(IPath projectPath){
		instance = new Configuration(projectPath);
	}
	
	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 update(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(){
		return instance;
	}
	
	
}
