package queryParser.executor;

import java.io.File;
import java.util.Map;

import queryParser.parser.BracketDistributor;
import queryParser.parser.TempQueryInput;
import queryParser.vo.QueryFactory;
import queryParser.vo.QueryInfo;
import tempMain.ParsingTest;

public class Executor {
	public static QueryFactory execute() throws Exception{
		File path1 = new File("testQuery.txt");
		
		// 1. read QueryString
		String queryString = TempQueryInput.readQueryTextFile(path1.getAbsolutePath());
		
		// 2. seperate bracket(parenthesis) "(, )"
		BracketDistributor bracketDistributor = new BracketDistributor();
		bracketDistributor.splitSubQuery(queryString);
		
		// 분리된 SubQuery 목록 
		Map<String, QueryInfo> queryMap = bracketDistributor.getQueryMap();
		// 분리된 함수 목록 
		Map<String, String> functionMap = bracketDistributor.getFunctionMap();
		// 분리된 기타 (연산자 관련 소괄호)
		Map<String, String> otherBracketMap = bracketDistributor.getOtherBracketMap();
		
		// 3. set QueryFactory
		QueryFactory visualQueryInfo = new QueryFactory(queryMap, functionMap, otherBracketMap);
		
		return visualQueryInfo;
	}
}

@@ -1127,11 +1127,691 @@
 o;%0D%0A%09%7D%0D%0A
+%09%0D%0A%09public static QueryFactory execute(String queryString)%7B%0D%0A%09%09// 1. seperate bracket(parenthesis) %22(, )%22%0D%0A%09%09BracketDistributor bracketDistributor = new BracketDistributor();%0D%0A%09%09bracketDistributor.splitSubQuery(queryString);%0D%0A%09%09%0D%0A%09%09// %EB%B6%84%EB%A6%AC%EB%90%9C SubQuery %EB%AA%A9%EB%A1%9D %0D%0A%09%09Map%3CString, QueryInfo%3E queryMap = bracketDistributor.getQueryMap();%0D%0A%09%09// %EB%B6%84%EB%A6%AC%EB%90%9C %ED%95%A8%EC%88%98 %EB%AA%A9%EB%A1%9D %0D%0A%09%09Map%3CString, String%3E functionMap = bracketDistributor.getFunctionMap();%0D%0A%09%09// %EB%B6%84%EB%A6%AC%EB%90%9C %EA%B8%B0%ED%83%80 (%EC%97%B0%EC%82%B0%EC%9E%90 %EA%B4%80%EB%A0%A8 %EC%86%8C%EA%B4%84%ED%98%B8)%0D%0A%09%09Map%3CString, String%3E otherBracketMap = bracketDistributor.getOtherBracketMap();%0D%0A%09%09%0D%0A%09%09// 2. set QueryFactory%0D%0A%09%09QueryFactory visualQueryInfo = new QueryFactory(queryMap, functionMap, otherBracketMap);%0D%0A%09%09%0D%0A%09%09return visualQueryInfo;%0D%0A%09%7D%0D%0A
 %7D%0D%0A

add new method in Executor (run with String query parameter)