package interactivefeaturelocator.test;

import interactivefeaturelocator.model.Feature;
import interactivefeaturelocator.model.DerivationManager;
import interactivefeaturelocator.model.DerivationUnit;
import interactivefeaturelocator.model.Pattern;




import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.xml.parsers.ParserConfigurationException;

import org.eclipse.core.commands.ITypedParameter;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.internal.compiler.ClassFile;
import org.eclipse.jdt.internal.core.builder.SourceFile;
import org.eclipse.swt.graphics.Path;
import org.ntlab.trace.Trace;
import org.xml.sax.SAXException;

public class Main {
	private static String featureFolderPath = "C:\\Users\\student\\Desktop\\fujioka\\workspace_FeatureLocation\\InteractiveFeatureLocator\\Feature\\Feature1593375";
	private static DerivationManager im = null;
	private static DerivationUnit unit = null;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("Test");
//		String dir = System.getProperty("user.dir");
//		System.out.println(dir);
//		ClassFile classFile = new ClassFil
//		ASTParser astParser = ASTParser.newParser(AST.JLS8);
//		astParser.setResolveBindings(true);
//		astParser.setEnvironment(Envs.get, sourcepathEntries, encodings, includeRunningVMBootclasspath);
		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IProject[] projects = root.getProjects();
//		IJavaProject javaProject = JavaCore.create(project);
		
		Trace plusTrace;
		Trace minusTrace;
		Constraint constraint = new Constraint();
		try {
			Feature feature = new Feature(featureFolderPath);
			for (Pattern pattern : feature.getPatterns()) {
				unit = new DerivationUnit(pattern);
			}
			plusTrace = unit.getPlusTrace();
			minusTrace = unit.getMinusTrace();
			for (String methodSignature : constraint.assumption6(plusTrace, minusTrace)){
				System.out.println(methodSignature);
			}
			
		} catch (ParserConfigurationException | SAXException | IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
