package sample;

import java.util.LinkedList;

import FMM.BusinessProcessBuildingBlock;
import FMM.BusinessStrategy;
import FMM.ElementLink;
import FMM.PF;
import FMM.GoalModelBuildingBlock;
import FMM.Intention;
import FMM.Pattern;
import FMM.ProcessElement;
import FMM.EvaluationStrategy;
import algorithms.Action;
import algorithms.Modification;
import algorithms.XMLutility;

import com.thoughtworks.xstream.XStream;

public class ExamplesInputs 
{
	private static PF pfExtentionEx2;
	private static PF pfEliminationEx1;

	
	public static Pattern extensionEx1In2()
	{
		Pattern p1 = new Pattern("Increase Patient Safety");
		
		GoalModelBuildingBlock g1 = new GoalModelBuildingBlock("Increase Patient Safety Goal Template");
		
		BusinessStrategy bs1_1 = new BusinessStrategy("Basic Imporvement");
		BusinessStrategy bs1_2 = new BusinessStrategy("Advanced Imporvement");
		BusinessProcessBuildingBlock bpt1_1 = new BusinessProcessBuildingBlock("Basic Imporvement");
		BusinessProcessBuildingBlock bpt1_2 = new BusinessProcessBuildingBlock("Advanced Imporvement");
		
		EvaluationStrategy s1_1 = new EvaluationStrategy("Basic Imporvement");
		EvaluationStrategy s1_2 = new EvaluationStrategy("Advanced Imporvement");
		
		ProcessElement CPs1_1 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_1 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement CPs1_2 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_2 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_2 = new ProcessElement("Making Decision");
		ProcessElement APs1_2 = new ProcessElement("Applying knowledge");
		
		Intention I = new Intention("Increase Patient Safety");
		I.leaf= false;
		I.mainGoal = true;
		Intention C = new Intention("Collect Data");
		C.leaf = true;
		C.mainGoal = false;
		Intention G = new Intention("Generate Informative Outcome Information");
		G.leaf = true;
		G.mainGoal = false;
		Intention M = new Intention("Make Safety Decision");
		M.leaf = true;
		M.mainGoal = false;
		Intention A = new Intention("Adopt Decision");
		A.leaf = true;
		A.mainGoal = false;
		
		//create links for p1 (maybe links are not needed for this example)
		CPs1_1.realizingIntention = C;
		GPs1_1.realizingIntention = G;
		
		CPs1_2.realizingIntention = C;
		GPs1_2.realizingIntention = G;
		MPs1_2.realizingIntention = M;
		APs1_2.realizingIntention = A;

		g1.add(I);
		g1.add(C);
		g1.add(G);
		g1.add(M);
		g1.add(A);
		
		bs1_1.bpt = bpt1_1;
		bs1_1.st = s1_1;
		
		bs1_2.bpt = bpt1_2;
		bs1_2.st = s1_2;
		
		p1.GT = g1;
		p1.add(bs1_1);
		p1.add(bs1_2);
		
		return p1;


	}
	public static LinkedList<Modification> extensionEx1In3() 
	{
		LinkedList<Modification> modifications = new LinkedList<Modification>();
		return modifications;
	}

	public static PF extensionEx2In1()
	{

		/********************************************************* the following is the old working version****************************************************
		 ****************************************************************all patterns are together*************************************************************
		 ******************************************************************************************************************************************************
	
		
		GPF pf = new GPF("Healthcare Pattern Family");


		Pattern p1 = new Pattern("Increase Patient Safety");
		Pattern p2 = new Pattern("Data Collection");
		Pattern p3 = new Pattern("Outcome Data Collection"); 
	
		GoalTemplate gt1 = new GoalTemplate("Increase Patient Safety");
		GoalTemplate gt2 = new GoalTemplate("Data Collection");
		GoalTemplate gt3 = new GoalTemplate("Outcome Data Collection");
		
		p1.add(gt1);
		p2.add(gt2);
		p3.add(gt3);

		Intention I = new Intention("Increase Patient Safety");
		I.leaf= false;
		I.mainGoal = true;
		Intention C = new Intention("Collect Data");
		C.leaf = true;
		C.mainGoal = false;
		Intention G = new Intention("Generate Informative Outcome Information");
		G.leaf = true;
		G.mainGoal = false;
		Intention M = new Intention("Make Safety Decision");
		M.leaf = true;
		M.mainGoal = false;
		Intention A = new Intention("Adopt Decision");
		A.leaf = true;
		A.mainGoal = false;

		Intention C2 = new Intention("Collect Data");
		C2.leaf = false;
		C2.mainGoal = true;
		Intention O = new Intention("Collect Outcome Data");
		O.leaf = true;
		O.mainGoal = false;
		Intention P = new Intention("Collect Process Data");
		P.leaf = true;
		P.mainGoal = false;
		
		Intention O2 = new Intention("Collect Outcome Data");
		O2.leaf = false;
		O2.mainGoal = true;
		Intention L = new Intention("Look for Outcome Data");
		L.leaf = true;
		L.mainGoal = false;
		Intention N = new Intention("Analyse Data Observation");
		N.leaf = true;
		N.mainGoal = false;
		Intention R = new Intention("Record Outcome Data");
		R.leaf = true;
		R.mainGoal = false;

		
		gt1.add(I);
		gt1.add(C);
		gt1.add(G);
		gt1.add(M);
		gt1.add(A);
		
		
		gt2.add(C2);
		gt2.add(O);
		gt2.add(P);
		
		gt3.add(O2);
		gt3.add(L);
		gt3.add(N);
		gt3.add(R);
		
		ElementLink l1_1 = new ElementLink(C,I,"CtoI");
		ElementLink l1_2 = new ElementLink(G,I,"GtoI");		
		ElementLink l1_3 = new ElementLink(M,I,"MtoI");
		ElementLink l1_4 = new ElementLink(A,I,"AtoI");
		
		ElementLink l2_1 = new ElementLink(O,C2,"OtoC2");
		ElementLink l2_2 = new ElementLink(P,C2,"PtoC2");
		
		ElementLink l3_1 = new ElementLink(L,O2,"LtoO2");
		ElementLink l3_2 = new ElementLink(N,O2,"NtoO2");
		ElementLink l3_3 = new ElementLink(R,O2,"RtoO2");
		
		gt1.add(l1_1);
		gt1.add(l1_2);
		gt1.add(l1_3);
		gt1.add(l1_4);
		
		gt2.add(l2_1);
		gt2.add(l2_2);
		
		gt3.add(l3_1);
		gt3.add(l3_2);
		gt3.add(l3_3);

		
		BusinessStrategy bs1_1 = new BusinessStrategy("Basic Improvement");
		BusinessStrategy bs1_2 = new BusinessStrategy("Advanced Improvement");
		BusinessStrategy bs2_1 = new BusinessStrategy("Basic Outcome");
		BusinessStrategy bs2_2 = new BusinessStrategy("Basic Process");
		BusinessStrategy bs2_3 = new BusinessStrategy("Complete Collection");
		BusinessStrategy bs3_1 = new BusinessStrategy("Basic Recoding");
		BusinessStrategy bs3_2 = new BusinessStrategy("Preprocessed Recording");



		p1.add(bs1_1);
		p1.add(bs1_2);
		p2.add(bs2_1);
		p2.add(bs2_2);
		p2.add(bs2_3);
		p3.add(bs3_1);
		p3.add(bs3_2);
	


		Strategy s1_1 = new Strategy("Basic Improvement");
		Strategy s1_2 = new Strategy("Advanced Improvement");
		Strategy s2_1 = new Strategy("Basic Outcome");
		Strategy s2_2 = new Strategy("Basic Process");
		Strategy s2_3 = new Strategy("Complete Collection");
		Strategy s3_1 = new Strategy("Basic Recoding");
		Strategy s3_2 = new Strategy("Preprocessed Recording");

	
		bs1_1.st = s1_1;
		bs1_2.st = s1_2;
		bs2_1.st = s2_1;
		bs2_2.st = s2_2;
		bs2_3.st = s2_3;
		bs3_1.st = s3_1;
		bs3_2.st = s3_2;
		
		BusinessProcessTemplate bpt1_1 = new BusinessProcessTemplate("Basic Improvement");
		BusinessProcessTemplate bpt1_2 = new BusinessProcessTemplate("Advanced Improvement");
		BusinessProcessTemplate bpt2_1 = new BusinessProcessTemplate("Basic Outcome");
		BusinessProcessTemplate bpt2_2 = new BusinessProcessTemplate("Basic Process");
		BusinessProcessTemplate bpt2_3 = new BusinessProcessTemplate("Complete Collection");
		BusinessProcessTemplate bpt3_1 = new BusinessProcessTemplate("Basic Recoding");
		BusinessProcessTemplate bpt3_2 = new BusinessProcessTemplate("Preprocessed Recording");

		
	

		bs1_1.bpt = bpt1_1;
		bs1_2.bpt = bpt1_2;
		bs2_1.bpt = bpt2_1;
		bs2_2.bpt = bpt2_2;
		bs2_3.bpt = bpt2_3;
		bs3_1.bpt = bpt3_1;
		bs3_2.bpt = bpt3_2;
		

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates
	
		ProcessElement CPs1_1 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_1 = new ProcessElement("Generating Informative Outcome Information");
		bpt1_1.add(CPs1_1);
		bpt1_1.add(GPs1_1);

		ProcessElement CPs1_2 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_2 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_2 = new ProcessElement("Making Decision");
		ProcessElement APs1_2 = new ProcessElement("Applying Knowledge");
		bpt1_2.add(CPs1_2);
		bpt1_2.add(GPs1_2);
		bpt1_2.add(MPs1_2);
		bpt1_2.add(APs1_2);

		ProcessElement OPs2_1 = new ProcessElement("Collecting Outcome Data");
		bpt2_1.add(OPs2_1);

		ProcessElement PPs2_2 = new ProcessElement("Collecting Process Data");
		bpt2_2.add(PPs2_2);

		ProcessElement OPs2_3 = new ProcessElement("Collecting Outcome Data");
		ProcessElement PPs2_3 = new ProcessElement("Collecting Process Data");
		bpt2_3.add(OPs2_3);
		bpt2_3.add(PPs2_3);

		ProcessElement LPs3_1 = new ProcessElement("Looking for Outcome");
		ProcessElement RPs3_1 = new ProcessElement("Recording Outcome");
		bpt3_1.add(LPs3_1);
		bpt3_1.add(RPs3_1);

		ProcessElement LPs3_2 = new ProcessElement("Looking for Outcome");
		ProcessElement NPs3_2 = new ProcessElement("Analysing Observation");
		ProcessElement RPs3_2 = new ProcessElement("Recording Outcome");
		bpt3_2.add(LPs3_2);
		bpt3_2.add(NPs3_2);
		bpt3_2.add(RPs3_2);

		// Intention Realization
		CPs1_1.realizingIntention = C;
		GPs1_1.realizingIntention = G;


		CPs1_2.realizingIntention = C;
		GPs1_2.realizingIntention = G;
		MPs1_2.realizingIntention = M;
		APs1_2.realizingIntention = A;

		OPs2_1.realizingIntention = O;


		PPs2_2.realizingIntention = P;


		OPs2_3.realizingIntention = O;
		PPs2_3.realizingIntention = P;


		LPs3_1.realizingIntention = L;
		RPs3_1.realizingIntention = R;


		LPs3_2.realizingIntention = L;
		NPs3_2.realizingIntention = N;
		RPs3_2.realizingIntention = R;

		// Intention Pattern Linking 
		C.patternDef = p2;
		O.patternDef = p3;
		
		pf.insert(p3);
		pf.insert(p2);
		pf.insert(p1);
		pfExtentionEx2 = pf;
		return pf;
		
		 ***********************************************************************************************************************************************************
		 **********************************************************************************************************************************************************/

		
	 
		/*********************************
		 ***P1: Increase Patient Safety***
		 ********************************/	
		
		Pattern p1 = new Pattern("Increase Patient Safety");

		GoalModelBuildingBlock gt1 = new GoalModelBuildingBlock("Increase Patient Safety");
		
		p1.add(gt1);

		Intention I = new Intention("Increase Patient Safety");
		I.leaf= false;
		I.mainGoal = true;
		Intention C = new Intention("Collect Data");
		C.leaf = true;
		C.mainGoal = false;
		Intention G = new Intention("Generate Informative Outcome Information");
		G.leaf = true;
		G.mainGoal = false;
		Intention M = new Intention("Make Safety Decision");
		M.leaf = true;
		M.mainGoal = false;
		Intention A = new Intention("Adopt Decision");
		A.leaf = true;
		A.mainGoal = false;
		
		gt1.add(I);
		gt1.add(C);
		gt1.add(G);
		gt1.add(M);
		gt1.add(A);
		
		ElementLink l1_1 = new ElementLink(C,I,"CtoI");
		ElementLink l1_2 = new ElementLink(G,I,"GtoI");		
		ElementLink l1_3 = new ElementLink(M,I,"MtoI");
		ElementLink l1_4 = new ElementLink(A,I,"AtoI");
		
		gt1.add(l1_1);
		gt1.add(l1_2);
		gt1.add(l1_3);
		gt1.add(l1_4);		
		
		BusinessStrategy bs1_1 = new BusinessStrategy("Basic Improvement");
		BusinessStrategy bs1_2 = new BusinessStrategy("Advanced Improvement");

		p1.add(bs1_1);
		p1.add(bs1_2);		

		EvaluationStrategy s1_1 = new EvaluationStrategy("Basic Improvement");
		EvaluationStrategy s1_2 = new EvaluationStrategy("Advanced Improvement");		

		bs1_1.st = s1_1;
		bs1_2.st = s1_2;
		
		BusinessProcessBuildingBlock bpt1_1 = new BusinessProcessBuildingBlock("Basic Improvement");
		BusinessProcessBuildingBlock bpt1_2 = new BusinessProcessBuildingBlock("Advanced Improvement");
		
		bs1_1.bpt = bpt1_1;
		bs1_2.bpt = bpt1_2;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates
	
		ProcessElement CPs1_1 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_1 = new ProcessElement("Generating Informative Outcome Information");
		bpt1_1.add(CPs1_1);
		bpt1_1.add(GPs1_1);

		ProcessElement CPs1_2 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_2 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_2 = new ProcessElement("Making Decision");
		ProcessElement APs1_2 = new ProcessElement("Applying Knowledge");
		bpt1_2.add(CPs1_2);
		bpt1_2.add(GPs1_2);
		bpt1_2.add(MPs1_2);
		bpt1_2.add(APs1_2);


		// Intention Realization
		CPs1_1.realizingIntention = C;
		GPs1_1.realizingIntention = G;


		CPs1_2.realizingIntention = C;
		GPs1_2.realizingIntention = G;
		MPs1_2.realizingIntention = M;
		APs1_2.realizingIntention = A;


		/*********************************
		 *****P2:Data Collection *********
		 ********************************/
	
		Pattern p2 = new Pattern("Data Collection");

		GoalModelBuildingBlock gt2 = new GoalModelBuildingBlock("Data Collection");

		p2.add(gt2);

		Intention C2 = new Intention("Collect Data");
		C2.leaf = false;
		C2.mainGoal = true;
		Intention O = new Intention("Collect Outcome Data");
		O.leaf = true;
		O.mainGoal = false;
		Intention P = new Intention("Collect Process Data");
		P.leaf = true;
		P.mainGoal = false;
		
		gt2.add(C2);
		gt2.add(O);
		gt2.add(P);
		
		
		ElementLink l2_1 = new ElementLink(O,C2,"OtoC2");
		ElementLink l2_2 = new ElementLink(P,C2,"PtoC2");
		
		gt2.add(l2_1);
		gt2.add(l2_2);		

		
		
		BusinessStrategy bs2_1 = new BusinessStrategy("Basic Outcome");
		BusinessStrategy bs2_2 = new BusinessStrategy("Basic Process");
		BusinessStrategy bs2_3 = new BusinessStrategy("Complete Collection");



		p2.add(bs2_1);
		p2.add(bs2_2);
		p2.add(bs2_3);

		EvaluationStrategy s2_1 = new EvaluationStrategy("Basic Outcome");
		EvaluationStrategy s2_2 = new EvaluationStrategy("Basic Process");
		EvaluationStrategy s2_3 = new EvaluationStrategy("Complete Collection");

		bs2_1.st = s2_1;
		bs2_2.st = s2_2;
		bs2_3.st = s2_3;

		BusinessProcessBuildingBlock bpt2_1 = new BusinessProcessBuildingBlock("Basic Outcome");
		BusinessProcessBuildingBlock bpt2_2 = new BusinessProcessBuildingBlock("Basic Process");
		BusinessProcessBuildingBlock bpt2_3 = new BusinessProcessBuildingBlock("Complete Collection");
		
		bs2_1.bpt = bpt2_1;
		bs2_2.bpt = bpt2_2;
		bs2_3.bpt = bpt2_3;

		
		ProcessElement OPs2_1 = new ProcessElement("Collecting Outcome Data");
		bpt2_1.add(OPs2_1);

		ProcessElement PPs2_2 = new ProcessElement("Collecting Process Data");
		bpt2_2.add(PPs2_2);

		ProcessElement OPs2_3 = new ProcessElement("Collecting Outcome Data");
		ProcessElement PPs2_3 = new ProcessElement("Collecting Process Data");
		bpt2_3.add(OPs2_3);
		bpt2_3.add(PPs2_3);


		OPs2_1.realizingIntention = O;


		PPs2_2.realizingIntention = P;


		OPs2_3.realizingIntention = O;
		PPs2_3.realizingIntention = P;


		/*********************************
		 ****P3: Outcome Data Collection**
		 ********************************/
		
		Pattern p3 = new Pattern("Outcome Data Collection");
		
		GoalModelBuildingBlock gt3 = new GoalModelBuildingBlock("Outcome Data Collection");
		
		p3.add(gt3);	
	
		Intention O2 = new Intention("Collect Outcome Data");
		O2.leaf = false;
		O2.mainGoal = true;
		Intention L = new Intention("Look for Outcome Data");
		L.leaf = true;
		L.mainGoal = false;
		Intention N = new Intention("Analyse Data Observation");
		N.leaf = true;
		N.mainGoal = false;
		Intention R = new Intention("Record Outcome Data");
		R.leaf = true;
		R.mainGoal = false;
		
		gt3.add(O2);
		gt3.add(L);
		gt3.add(N);
		gt3.add(R);
		
		
		ElementLink l3_1 = new ElementLink(L,O2,"LtoO2");
		ElementLink l3_2 = new ElementLink(N,O2,"NtoO2");
		ElementLink l3_3 = new ElementLink(R,O2,"RtoO2");


		
		gt3.add(l3_1);
		gt3.add(l3_2);
		gt3.add(l3_3);
		
		BusinessStrategy bs3_1 = new BusinessStrategy("Basic Recoding");
		BusinessStrategy bs3_2 = new BusinessStrategy("Preprocessed Recording");
		
		p3.add(bs3_1);
		p3.add(bs3_2);
		
		EvaluationStrategy s3_1 = new EvaluationStrategy("Basic Recoding");
		EvaluationStrategy s3_2 = new EvaluationStrategy("Preprocessed Recording");
		

		bs3_1.st = s3_1;
		bs3_2.st = s3_2;
		
		BusinessProcessBuildingBlock bpt3_1 = new BusinessProcessBuildingBlock("Basic Recoding");
		BusinessProcessBuildingBlock bpt3_2 = new BusinessProcessBuildingBlock("Preprocessed Recording");

		bs3_1.bpt = bpt3_1;
		bs3_2.bpt = bpt3_2;
		
		ProcessElement LPs3_1 = new ProcessElement("Looking for Outcome");
		ProcessElement RPs3_1 = new ProcessElement("Recording Outcome");
		bpt3_1.add(LPs3_1);
		bpt3_1.add(RPs3_1);

		ProcessElement LPs3_2 = new ProcessElement("Looking for Outcome");
		ProcessElement NPs3_2 = new ProcessElement("Analysing Observation");
		ProcessElement RPs3_2 = new ProcessElement("Recording Outcome");
		bpt3_2.add(LPs3_2);
		bpt3_2.add(NPs3_2);
		bpt3_2.add(RPs3_2);
		

		LPs3_1.realizingIntention = L;
		RPs3_1.realizingIntention = R;


		LPs3_2.realizingIntention = L;
		NPs3_2.realizingIntention = N;
		RPs3_2.realizingIntention = R;

		
		
	
		//create GPF
		PF pf = new PF("Healthcare Pattern Family");

		
		
		// patternDef Configurations
		C.patternDef = p2;
		O.patternDef = p3;
		
		pf.insert(p3);
		pf.insert(p2);
		pf.insert(p1);

		pfExtentionEx2 = pf;
		return pf;
		
	}
	public static Pattern extensionEx2In2() 
	{

		Pattern xp = new Pattern("Action Taking");
		
		GoalModelBuildingBlock xg = new GoalModelBuildingBlock("Action Taking");
	

		Intention T = new Intention("Take Action");
		Intention Z = new Intention("Prioritize Outcomes");
		Intention V = new Intention("Prevent Outcome");

		T.leaf = false;
		T.mainGoal = true;

		Z.leaf = true;
		Z.mainGoal = false;

		V.leaf = true;
		V.mainGoal = false;
		
		
		xg.add(T);
		xg.add(Z);
		xg.add(V);

		ElementLink xl1_1 = new ElementLink(Z,T,"ZtoT");
		ElementLink xl1_2 = new ElementLink(V,T,"VtoT");
		xg.add(xl1_1);
		xg.add(xl1_2);
		
		
		xp.GT = xg;

		BusinessStrategy bs4_1 = new BusinessStrategy("Immediate Prevention");
		BusinessStrategy bs4_2 = new BusinessStrategy("Prioritized Prevention");


		xp.add(bs4_1);
		xp.add(bs4_2);


		EvaluationStrategy s4_1 = new EvaluationStrategy("Immediate Prevention");
		EvaluationStrategy s4_2 = new EvaluationStrategy("Prioritized Prevention");



		bs4_1.st = s4_1;
		bs4_2.st = s4_2;

		BusinessProcessBuildingBlock bpt4_1 = new BusinessProcessBuildingBlock("Immediate Prevention");
		BusinessProcessBuildingBlock bpt4_2 = new BusinessProcessBuildingBlock("Prioritized Prevention");


		bs4_1.bpt = bpt4_1;
		bs4_2.bpt = bpt4_2;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates

		ProcessElement VPs4_1 = new ProcessElement("Prevent Outcome");

		bpt4_1.add(VPs4_1);


		ProcessElement ZPs4_2 = new ProcessElement("Prioritize Outcomes");
		ProcessElement VPs4_2 = new ProcessElement("Prevent Outcome");

		bpt4_2.add(ZPs4_2);
		bpt4_2.add(VPs4_2);

		VPs4_1.realizingIntention = V;

		ZPs4_2.realizingIntention = Z;
		VPs4_2.realizingIntention = V;

		return xp;
	}
	public static LinkedList<Modification> extensionEx2In3() 
	{
		LinkedList<Modification> modifications = new LinkedList<Modification>();

		//find the pattern that must be modified
		Pattern patternToBeModified = null;
		for (Pattern p : pfExtentionEx2.patternCollection())
		{
			if (p.name.equals("Increase Patient Safety"))
			{
				patternToBeModified = p;
				break;
			}
		}
		
		//create the link to be added
		Intention ICopy = new Intention("Increase Patient Safety");
		Intention T2 = new Intention("Take Action");
		ElementLink l = new ElementLink(T2, ICopy, "T2toI");
		
		//because there no old business strategy exist, we don't create oldbst
		
		//create the new business startegy to be added to pattern
		BusinessStrategy newbst = new BusinessStrategy("Advanced With Immediate Action");
		BusinessProcessBuildingBlock newbpt = new BusinessProcessBuildingBlock("Advanced With Immediate Action");
		EvaluationStrategy newst = new EvaluationStrategy("Advanced With Immediate Action");
		ProcessElement CPs1_3 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_3 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_3 = new ProcessElement("Making Decision");
		ProcessElement APs1_3 = new ProcessElement("Applying Knowledge");
		ProcessElement T2Ps1_3 = new ProcessElement("Taking Action");
		CPs1_3.realizingIntention = new Intention("Collect Data");
		GPs1_3.realizingIntention = new Intention("Generate Informative Outcome Information");
		MPs1_3.realizingIntention = new Intention("Make Safety Decision");
		APs1_3.realizingIntention = new Intention("Adopt Decision");
		T2Ps1_3.realizingIntention = new Intention("Take Action");
		newbpt.add(CPs1_3);
		newbpt.add(GPs1_3);
		newbpt.add(MPs1_3);
		newbpt.add(APs1_3);
		newbpt.add(T2Ps1_3);
		
		newbst.bpt = newbpt;
		newbst.st = newst;
		
		//create modifications set
		Modification m  = new Modification(patternToBeModified,l,Action.Add,newbst,null);
		modifications.add(m);
		return modifications;
	}

	public static PF eliminationEx1In1()
	{
		XStream xstream = new XStream();
		PF inputPF = XMLutility.deserializeGPFfromXMLfile(xstream, "C:\\PATH\\elmEx1\\eliminationEx1In1.xml");
		pfEliminationEx1 = inputPF;
		return inputPF;
	}
	public static Pattern eliminationEx1In2() {
		Pattern obsoletePattern = null;
		XStream xstream = new XStream();
		//alternative 1 : import obsolete pattern
		obsoletePattern = XMLutility.deserializePatternfromXML(xstream, "C:\\PATH\\elmEx1\\eliminationEx1In2.xml");
		return obsoletePattern;
	}
	public static LinkedList<Modification> eliminationEx1In3()
	{
		LinkedList<Modification> modifications = new LinkedList<Modification>();

		//find the pattern that must be modified
		Pattern patternToBeModified = null;
		for (Pattern p : pfEliminationEx1.patternCollection())
		{
			if (p.name.equals("Increase Patient Safety"))
			{
				patternToBeModified = p;
				break;
			}
		}
		
		//the link that must be delete
		Intention ICopy = new Intention("Increase Patient Safety");
		Intention T2 = new Intention("Take Action");
		ElementLink l = new ElementLink(T2, ICopy, "T2toI");
		
		//because there no new business strategy to be added, we don't create newbst
		
		//create the old business startegy to be removed from pattern
		BusinessStrategy oldbst = new BusinessStrategy("Advanced With Immediate Action");
		BusinessProcessBuildingBlock oldbpt = new BusinessProcessBuildingBlock("Advanced With Immediate Action");
		EvaluationStrategy oldst = new EvaluationStrategy("Advanced With Immediate Action");
		ProcessElement CPs1_3 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_3 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_3 = new ProcessElement("Making Decision");
		ProcessElement APs1_3 = new ProcessElement("Applying Knowledge");
		ProcessElement T2Ps1_3 = new ProcessElement("Taking Action");
		CPs1_3.realizingIntention = new Intention("Collect Data");
		GPs1_3.realizingIntention = new Intention("Generate Informative Outcome Information");
		MPs1_3.realizingIntention = new Intention("Make Safety Decision");
		APs1_3.realizingIntention = new Intention("Adopt Decision");
		T2Ps1_3.realizingIntention = new Intention("Take Action");
		oldbpt.add(CPs1_3);
		oldbpt.add(GPs1_3);
		oldbpt.add(MPs1_3);
		oldbpt.add(APs1_3);
		oldbpt.add(T2Ps1_3);
		
		oldbst.bpt = oldbpt;
		oldbst.st = oldst;
		
		//create modifications set
		Modification m  = new Modification(patternToBeModified,l,Action.Delete,null,oldbst);
		modifications.add(m);
		return modifications;
	}
	public static void eliminationEx1In2CreateXML()
	{
		// this method create the XML file that is consumed in the eleminationEx1In2
		Pattern op = new Pattern("Action Taking");
		
		GoalModelBuildingBlock og = new GoalModelBuildingBlock("Action Taking");
	

		Intention T = new Intention("Take Action");
		Intention Z = new Intention("Prioritize Outcomes");
		Intention V = new Intention("Prevent Outcome");

		T.leaf = false;
		T.mainGoal = true;

		Z.leaf = true;
		Z.mainGoal = false;

		V.leaf = true;
		V.mainGoal = false;
		
		
		og.add(T);
		og.add(Z);
		og.add(V);

		ElementLink ol1_1 = new ElementLink(Z,T,"ZtoT");
		ElementLink ol1_2 = new ElementLink(V,T,"VtoT");
		og.add(ol1_1);
		og.add(ol1_2);
		
		
		op.GT = og;

		BusinessStrategy bs4_1 = new BusinessStrategy("Immediate Prevention");
		BusinessStrategy bs4_2 = new BusinessStrategy("Prioritized Prevention");


		op.add(bs4_1);
		op.add(bs4_2);


		EvaluationStrategy s4_1 = new EvaluationStrategy("Immediate Prevention");
		EvaluationStrategy s4_2 = new EvaluationStrategy("Prioritized Prevention");



		bs4_1.st = s4_1;
		bs4_2.st = s4_2;

		BusinessProcessBuildingBlock bpt4_1 = new BusinessProcessBuildingBlock("Immediate Prevention");
		BusinessProcessBuildingBlock bpt4_2 = new BusinessProcessBuildingBlock("Prioritized Prevention");


		bs4_1.bpt = bpt4_1;
		bs4_2.bpt = bpt4_2;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates

		ProcessElement VPs4_1 = new ProcessElement("Prevent Outcome");

		bpt4_1.add(VPs4_1);


		ProcessElement ZPs4_2 = new ProcessElement("Prioritize Outcomes");
		ProcessElement VPs4_2 = new ProcessElement("Prevent Outcome");

		bpt4_2.add(ZPs4_2);
		bpt4_2.add(VPs4_2);

		VPs4_1.realizingIntention = V;

		ZPs4_2.realizingIntention = Z;
		VPs4_2.realizingIntention = V;

		//create xml file for the obsolete pattern
		XStream xstream = new XStream();
		XMLutility.serializePatterntoXMLfile(op, xstream, "C:\\PATH\\elmEx1\\eliminationEx1In2.xml");
		
		
	}
	
	public static PF combinationEx1In1() 
	{
		XStream xstream = new XStream();
		PF inputPF1 = XMLutility.deserializeGPFfromXMLfile(xstream, "C:\\PATH\\cmbEx1\\combinationEx1In1.xml");
		//pfCombinationEx1 = inputPF; //do I need this? I don't think so
		return inputPF1;

	}
	public static PF combinationEx1In2() 
	{
		XStream xstream = new XStream();
		PF inputPF2 = XMLutility.deserializeGPFfromXMLfile(xstream, "C:\\PATH\\cmbEx1\\combinationEx1In2.xml");
		//pfCombinationEx1 = inputPF; //do I need this? I don't think so
		return inputPF2;

	}
	public static Pattern combinationEx1In3()
	{
		

		/*********************************
		 ***P1: Increase Patient Safety***
		 ********************************/	
		
		Pattern p1 = new Pattern("Increase Patient Safety");

		GoalModelBuildingBlock gt1 = new GoalModelBuildingBlock("Increase Patient Safety");
		
		p1.add(gt1);

		Intention I = new Intention("Increase Patient Safety");
		I.leaf= false;
		I.mainGoal = true;
		Intention C = new Intention("Collect Data");
		C.leaf = true;
		C.mainGoal = false;
		Intention G = new Intention("Generate Informative Outcome Information");
		G.leaf = true;
		G.mainGoal = false;
		Intention M = new Intention("Make Safety Decision");
		M.leaf = true;
		M.mainGoal = false;
		Intention A = new Intention("Adopt Decision");
		A.leaf = true;
		A.mainGoal = false;
		Intention T = new Intention("Take Action");
		T.leaf = true;
		T.mainGoal = false;
		
		gt1.add(I);
		gt1.add(C);
		gt1.add(G);
		gt1.add(M);
		gt1.add(A);
		gt1.add(T);
		
		ElementLink l1_1 = new ElementLink(C,I,"CtoI");
		ElementLink l1_2 = new ElementLink(G,I,"GtoI");		
		ElementLink l1_3 = new ElementLink(M,I,"MtoI");
		ElementLink l1_4 = new ElementLink(A,I,"AtoI");
		ElementLink l1_5 = new ElementLink(T,I,"TtoI");
		
		gt1.add(l1_1);
		gt1.add(l1_2);
		gt1.add(l1_3);
		gt1.add(l1_4);		
		gt1.add(l1_5);
		
		BusinessStrategy bs1_1 = new BusinessStrategy("Basic Improvement");
		BusinessStrategy bs1_2 = new BusinessStrategy("Advanced Improvement");
		BusinessStrategy bs1_3 = new BusinessStrategy("Advanced With Immediate Action");

		p1.add(bs1_1);
		p1.add(bs1_2);
		p1.add(bs1_3);

		EvaluationStrategy s1_1 = new EvaluationStrategy("Basic Improvement");
		EvaluationStrategy s1_2 = new EvaluationStrategy("Advanced Improvement");		
		EvaluationStrategy s1_3 = new EvaluationStrategy("Advanced With Immediate Action");

		bs1_1.st = s1_1;
		bs1_2.st = s1_2;
		bs1_3.st = s1_3;
		
		BusinessProcessBuildingBlock bpt1_1 = new BusinessProcessBuildingBlock("Basic Improvement");
		BusinessProcessBuildingBlock bpt1_2 = new BusinessProcessBuildingBlock("Advanced Improvement");
		BusinessProcessBuildingBlock bpt1_3 = new BusinessProcessBuildingBlock("Advanced With Immediate Action");
		
		bs1_1.bpt = bpt1_1;
		bs1_2.bpt = bpt1_2;
		bs1_3.bpt = bpt1_3;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates
	
		ProcessElement CPs1_1 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_1 = new ProcessElement("Generating Informative Outcome Information");
		bpt1_1.add(CPs1_1);
		bpt1_1.add(GPs1_1);

		CPs1_1.realizingIntention = C;
		GPs1_1.realizingIntention = G;

		
		
		ProcessElement CPs1_2 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_2 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_2 = new ProcessElement("Making Decision");
		ProcessElement APs1_2 = new ProcessElement("Applying Knowledge");

		bpt1_2.add(CPs1_2);
		bpt1_2.add(GPs1_2);
		bpt1_2.add(MPs1_2);
		bpt1_2.add(APs1_2);

		CPs1_2.realizingIntention = C;
		GPs1_2.realizingIntention = G;
		MPs1_2.realizingIntention = M;
		APs1_2.realizingIntention = A;


		ProcessElement CPs1_3 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_3 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_3 = new ProcessElement("Making Decision");
		ProcessElement APs1_3 = new ProcessElement("Applying Knowledge");
		ProcessElement TPs1_3 = new ProcessElement("Taking Action");
		CPs1_3.realizingIntention = C;
		GPs1_3.realizingIntention = G;
		MPs1_3.realizingIntention = M;
		APs1_3.realizingIntention = A;
		TPs1_3.realizingIntention = T;
		bpt1_3.add(CPs1_3);
		bpt1_3.add(GPs1_3);
		bpt1_3.add(MPs1_3);
		bpt1_3.add(APs1_3);
		bpt1_3.add(TPs1_3);
		

		return p1;
	}

	public static void combincationEx1In1CreateXML()
	{

		

		/*********************************
		 ***P1: Increase Patient Safety***
		 ********************************/	
		
		Pattern p1 = new Pattern("Increase Patient Safety");

		GoalModelBuildingBlock gt1 = new GoalModelBuildingBlock("Increase Patient Safety");
		
		p1.add(gt1);

		Intention I = new Intention("Increase Patient Safety");
		I.leaf= false;
		I.mainGoal = true;
		Intention C = new Intention("Collect Data");
		C.leaf = true;
		C.mainGoal = false;
		Intention G = new Intention("Generate Informative Outcome Information");
		G.leaf = true;
		G.mainGoal = false;
		Intention M = new Intention("Make Safety Decision");
		M.leaf = true;
		M.mainGoal = false;
		Intention A = new Intention("Adopt Decision");
		A.leaf = true;
		A.mainGoal = false;
		Intention T = new Intention("Take Action");
		T.leaf = true;
		T.mainGoal = false;
		
		gt1.add(I);
		gt1.add(C);
		gt1.add(G);
		gt1.add(M);
		gt1.add(A);
		gt1.add(T);
		
		ElementLink l1_1 = new ElementLink(C,I,"CtoI");
		ElementLink l1_2 = new ElementLink(G,I,"GtoI");		
		ElementLink l1_3 = new ElementLink(M,I,"MtoI");
		ElementLink l1_4 = new ElementLink(A,I,"AtoI");
		ElementLink l1_5 = new ElementLink(T,I,"TtoI");
		
		gt1.add(l1_1);
		gt1.add(l1_2);
		gt1.add(l1_3);
		gt1.add(l1_4);		
		gt1.add(l1_5);
		
		BusinessStrategy bs1_1 = new BusinessStrategy("Basic Improvement");
		BusinessStrategy bs1_2 = new BusinessStrategy("Advanced Improvement");
		BusinessStrategy bs1_3 = new BusinessStrategy("Advanced With Immediate Action");

		p1.add(bs1_1);
		p1.add(bs1_2);
		p1.add(bs1_3);

		EvaluationStrategy s1_1 = new EvaluationStrategy("Basic Improvement");
		EvaluationStrategy s1_2 = new EvaluationStrategy("Advanced Improvement");		
		EvaluationStrategy s1_3 = new EvaluationStrategy("Advanced With Immediate Action");

		bs1_1.st = s1_1;
		bs1_2.st = s1_2;
		bs1_3.st = s1_3;
		
		BusinessProcessBuildingBlock bpt1_1 = new BusinessProcessBuildingBlock("Basic Improvement");
		BusinessProcessBuildingBlock bpt1_2 = new BusinessProcessBuildingBlock("Advanced Improvement");
		BusinessProcessBuildingBlock bpt1_3 = new BusinessProcessBuildingBlock("Advanced With Immediate Action");
		
		bs1_1.bpt = bpt1_1;
		bs1_2.bpt = bpt1_2;
		bs1_3.bpt = bpt1_3;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates
	
		ProcessElement CPs1_1 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_1 = new ProcessElement("Generating Informative Outcome Information");
		bpt1_1.add(CPs1_1);
		bpt1_1.add(GPs1_1);

		CPs1_1.realizingIntention = C;
		GPs1_1.realizingIntention = G;

		
		
		ProcessElement CPs1_2 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_2 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_2 = new ProcessElement("Making Decision");
		ProcessElement APs1_2 = new ProcessElement("Applying Knowledge");

		bpt1_2.add(CPs1_2);
		bpt1_2.add(GPs1_2);
		bpt1_2.add(MPs1_2);
		bpt1_2.add(APs1_2);

		CPs1_2.realizingIntention = C;
		GPs1_2.realizingIntention = G;
		MPs1_2.realizingIntention = M;
		APs1_2.realizingIntention = A;


		ProcessElement CPs1_3 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_3 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_3 = new ProcessElement("Making Decision");
		ProcessElement APs1_3 = new ProcessElement("Applying Knowledge");
		ProcessElement TPs1_3 = new ProcessElement("Taking Action");
		CPs1_3.realizingIntention = C;
		GPs1_3.realizingIntention = G;
		MPs1_3.realizingIntention = M;
		APs1_3.realizingIntention = A;
		TPs1_3.realizingIntention = T;
		bpt1_3.add(CPs1_3);
		bpt1_3.add(GPs1_3);
		bpt1_3.add(MPs1_3);
		bpt1_3.add(APs1_3);
		bpt1_3.add(TPs1_3);
		

		/*********************************
		 *****P2:Data Collection *********
		 ********************************/	
	
		Pattern p2 = new Pattern("Data Collection");

		GoalModelBuildingBlock gt2 = new GoalModelBuildingBlock("Data Collection");

		p2.add(gt2);

		Intention C2 = new Intention("Collect Data");
		C2.leaf = false;
		C2.mainGoal = true;
		Intention O = new Intention("Collect Outcome Data");
		O.leaf = true;
		O.mainGoal = false;
		Intention P = new Intention("Collect Process Data");
		P.leaf = true;
		P.mainGoal = false;
		
		gt2.add(C2);
		gt2.add(O);
		gt2.add(P);
		
		
		ElementLink l2_1 = new ElementLink(O,C2,"OtoC2");
		ElementLink l2_2 = new ElementLink(P,C2,"PtoC2");
		
		gt2.add(l2_1);
		gt2.add(l2_2);		

		
		
		BusinessStrategy bs2_1 = new BusinessStrategy("Basic Outcome");
		BusinessStrategy bs2_2 = new BusinessStrategy("Basic Process");
		BusinessStrategy bs2_3 = new BusinessStrategy("Complete Collection");



		p2.add(bs2_1);
		p2.add(bs2_2);
		p2.add(bs2_3);

		EvaluationStrategy s2_1 = new EvaluationStrategy("Basic Outcome");
		EvaluationStrategy s2_2 = new EvaluationStrategy("Basic Process");
		EvaluationStrategy s2_3 = new EvaluationStrategy("Complete Collection");

		bs2_1.st = s2_1;
		bs2_2.st = s2_2;
		bs2_3.st = s2_3;

		BusinessProcessBuildingBlock bpt2_1 = new BusinessProcessBuildingBlock("Basic Outcome");
		BusinessProcessBuildingBlock bpt2_2 = new BusinessProcessBuildingBlock("Basic Process");
		BusinessProcessBuildingBlock bpt2_3 = new BusinessProcessBuildingBlock("Complete Collection");
		
		bs2_1.bpt = bpt2_1;
		bs2_2.bpt = bpt2_2;
		bs2_3.bpt = bpt2_3;

		
		ProcessElement OPs2_1 = new ProcessElement("Collecting Outcome Data");
		bpt2_1.add(OPs2_1);
		OPs2_1.realizingIntention = O;
		
		ProcessElement PPs2_2 = new ProcessElement("Collecting Process Data");
		bpt2_2.add(PPs2_2);
		PPs2_2.realizingIntention = P;
		
		ProcessElement OPs2_3 = new ProcessElement("Collecting Outcome Data");
		ProcessElement PPs2_3 = new ProcessElement("Collecting Process Data");
		bpt2_3.add(OPs2_3);
		bpt2_3.add(PPs2_3);
		OPs2_3.realizingIntention = O;
		PPs2_3.realizingIntention = P;


		/*********************************
		 *****P3: Information Generation**
		 ********************************/	
		
		Pattern p3 = new Pattern("Information Generation");
		
		GoalModelBuildingBlock gt3 = new GoalModelBuildingBlock("Information Generation");
		
		p3.add(gt3);	
	
		Intention G2 = new Intention("Generate Informative Outcome Information");
		G2.leaf = false;
		G2.mainGoal = true;
		Intention AOD = new Intention("Analyze Outcome Data");
		AOD.leaf = true;
		AOD.mainGoal = false;
		Intention GEO = new Intention("Generate Expert Opinion");
		GEO.leaf = true;
		GEO.mainGoal = false;
		
		gt3.add(G2);
		gt3.add(AOD);
		gt3.add(GEO);		
		
		ElementLink l3_1 = new ElementLink(AOD,G2,"AODtoG2");
		ElementLink l3_2 = new ElementLink(GEO,G2,"GEOtoG2");

		
		gt3.add(l3_1);
		gt3.add(l3_2);
		
		BusinessStrategy bs3_1 = new BusinessStrategy("Data Analyzing");
		BusinessStrategy bs3_2 = new BusinessStrategy("Expert Evaluation");
		BusinessStrategy bs3_3 = new BusinessStrategy("Analysis Based Expert Evaluation");
		
		p3.add(bs3_1);
		p3.add(bs3_2);
		p3.add(bs3_3);
		
		EvaluationStrategy s3_1 = new EvaluationStrategy("Data Analyzing");
		EvaluationStrategy s3_2 = new EvaluationStrategy("Expert Evaluation");
		EvaluationStrategy s3_3 = new EvaluationStrategy("Analysis Based Expert Evaluation");

		bs3_1.st = s3_1;
		bs3_2.st = s3_2;
		bs3_3.st = s3_3;
		
		BusinessProcessBuildingBlock bpt3_1 = new BusinessProcessBuildingBlock("Data Analyzing");
		BusinessProcessBuildingBlock bpt3_2 = new BusinessProcessBuildingBlock("Expert Evaluation");
		BusinessProcessBuildingBlock bpt3_3 = new BusinessProcessBuildingBlock("Analysis Based Expert Evaluation");
		
		bs3_1.bpt = bpt3_1;
		bs3_2.bpt = bpt3_2;
		bs3_3.bpt = bpt3_3;
		
		ProcessElement AODPs3_1 = new ProcessElement("Analyzing Data");
		bpt3_1.add(AODPs3_1);
		AODPs3_1.realizingIntention = AOD;		

		ProcessElement GEOPs3_2 = new ProcessElement("Generating Expert Opinion");
		bpt3_2.add(GEOPs3_2);
		GEOPs3_2.realizingIntention = GEO;
		
		ProcessElement AODPs3_3 = new ProcessElement("Analyzing Data");
		ProcessElement GEOPs3_3 = new ProcessElement("Generating Expert Opinion");
		bpt3_3.add(AODPs3_3);
		bpt3_3.add(GEOPs3_3);
		AODPs3_3.realizingIntention = AOD;
		GEOPs3_3.realizingIntention = GEO;		


		




		
		/*********************************
		 *****P4: Knowledge Generation****
		 ********************************/		
		Pattern p4 = new Pattern("Knowledge Generation");		
		
		GoalModelBuildingBlock g4 = new GoalModelBuildingBlock("Knowledge Generation");
		
		p4.GT = g4;
		
		Intention MSD = new Intention("Make Safety Decision");
		Intention AOIA = new Intention("Analyze Outcome Inofrmation Database by Analysts");
		Intention AOIE = new Intention("Analyze Outcome Information by Healthcare Experts");
		Intention IDM = new Intention("Inform Decision Makers");
		Intention DID = new Intention("Discuss the Issue by Decision Makers");
		Intention DIDM = new Intention("Decide about Issues by Decision Makers");
		MSD.leaf = false;
		MSD.mainGoal = true;
		AOIA.leaf = true;
		AOIA.mainGoal = false;
		AOIE.leaf = true;
		AOIE.mainGoal = false;
		IDM.leaf = true;
		IDM.mainGoal = false;
		DID.leaf = true;
		DID.mainGoal = false;
		DIDM.leaf = true;
		DIDM.mainGoal = false;
		
		g4.add(MSD);
		g4.add(AOIA);
		g4.add(AOIE);
		g4.add(IDM);
		g4.add(DID);
		g4.add(DIDM);
		
		ElementLink l4_1 = new ElementLink(AOIA,MSD,"AOIAtoMSD");
		ElementLink l4_2 = new ElementLink(AOIE,MSD,"AOIEtoMSD");
		ElementLink l4_3 = new ElementLink(IDM,MSD,"IDMtoMSD");
		ElementLink l4_4 = new ElementLink(DID,MSD,"DIDtoMSD");
		ElementLink l4_5 = new ElementLink(DIDM,MSD,"DIDMtoMSD");
		
		g4.add(l4_1);
		g4.add(l4_2);
		g4.add(l4_3);
		g4.add(l4_4);
		g4.add(l4_5);
		
		

		
		
		BusinessStrategy bs4_1 = new BusinessStrategy("Data Based Decision Making");
		BusinessStrategy bs4_2 = new BusinessStrategy("Expert Based Decision Making");
		BusinessStrategy bs4_3 = new BusinessStrategy("Comprehensive Decision Making");

		p4.add(bs4_1);
		p4.add(bs4_2);
		p4.add(bs4_3);
		
		EvaluationStrategy s4_1 = new EvaluationStrategy("Data Based Decision Making");
		EvaluationStrategy s4_2 = new EvaluationStrategy("Expert Based Decision Making");
		EvaluationStrategy s4_3 = new EvaluationStrategy("Comprehensive Decision Making");


		bs4_1.st = s4_1;
		bs4_2.st = s4_2;
		bs4_3.st = s4_3;
	
		BusinessProcessBuildingBlock bpt4_1 = new BusinessProcessBuildingBlock("Data Based Decision Making");
		BusinessProcessBuildingBlock bpt4_2 = new BusinessProcessBuildingBlock("Expert Based Decision Making");
		BusinessProcessBuildingBlock bpt4_3 = new BusinessProcessBuildingBlock("Comprehensive Decision Making");

		bs4_1.bpt = bpt4_1;
		bs4_2.bpt = bpt4_2;
		bs4_3.bpt = bpt4_3;
		
		
		
		ProcessElement AOIEPs4_1 = new ProcessElement("Analyze Outcome Information by Healthcare Experts");
		ProcessElement IDMPs4_1 = new ProcessElement("Inform Decision Makers");
		ProcessElement DIDMPs4_1 = new ProcessElement("Decide about Issues by Decision Makers");
		
		bpt4_1.add(AOIEPs4_1);
		bpt4_1.add(IDMPs4_1);
		bpt4_1.add(DIDMPs4_1);
		
		AOIEPs4_1.realizingIntention = AOIE;
		IDMPs4_1.realizingIntention = IDM;
		DIDMPs4_1.realizingIntention =DIDM;
		
		
		ProcessElement AOIEPs4_2 = new ProcessElement("Analyze Outcome Information by Healthcare Experts");
		ProcessElement IDMPs4_2 = new ProcessElement("Inform Decision Makers");
		ProcessElement DIDPs4_2 = new ProcessElement("Discuss the Issue by Decision Makers");
		ProcessElement DIDMPs4_2 = new ProcessElement("Decide about Issues by Decision Makers");
		

		bpt4_2.add(AOIEPs4_2);
		bpt4_2.add(IDMPs4_2);
		bpt4_2.add(DIDPs4_2);
		bpt4_2.add(DIDMPs4_2);
		

		AOIEPs4_2.realizingIntention = AOIE;
		IDMPs4_2.realizingIntention = IDM;
		DIDPs4_2.realizingIntention =DID;
		DIDMPs4_2.realizingIntention =DIDM;
		
		
		ProcessElement AOIAPs4_3 = new ProcessElement("Analyze Outcome Inofrmation Database by Analysts");
		ProcessElement AOIEPs4_3 = new ProcessElement("Analyze Outcome Information by Healthcare Experts");
		ProcessElement IDMPs4_3 = new ProcessElement("Inform Decision Makers");
		ProcessElement DIDPs4_3 = new ProcessElement("Discuss the Issue by Decision Makers");
		ProcessElement DIDMPs4_3 = new ProcessElement("Decide about Issues by Decision Makers");
		
		bpt4_3.add(AOIAPs4_3);
		bpt4_3.add(AOIEPs4_3);
		bpt4_3.add(IDMPs4_3);
		bpt4_3.add(DIDPs4_3);
		bpt4_3.add(DIDMPs4_3);
		
		AOIAPs4_3.realizingIntention = AOIA ;
		AOIEPs4_3.realizingIntention = AOIE;
		IDMPs4_3.realizingIntention = IDM;
		DIDPs4_3.realizingIntention =DID;
		DIDMPs4_3.realizingIntention =DIDM;
		
		/*********************************
		 *****P5: Knowledge Application****
		 ********************************/
		Pattern p5 = new Pattern("Knowledge Application");		
		
		GoalModelBuildingBlock g5 = new GoalModelBuildingBlock("Knowledge Application");
		
		p5.GT = g5;
		
		Intention ADD = new Intention("Adopt Decision");
		Intention SHD = new Intention("Share Decision");
		Intention APD = new Intention("Apply Decision");
		Intention CFD = new Intention("Collect Feedback about Decision");
		Intention MDD = new Intention("Modify Decisions");
		
		ADD.leaf = false;
		ADD.mainGoal = true;
		SHD.leaf = true;
		SHD.mainGoal = false;
		APD.leaf = true;
		APD.mainGoal = false;
		CFD.leaf = true;
		CFD.mainGoal = false;
		MDD.leaf = true;
		MDD.mainGoal = false;
		
		g5.add(ADD);
		g5.add(SHD);
		g5.add(APD);
		g5.add(CFD);
		g5.add(MDD);
		
		
		ElementLink l5_1 = new ElementLink(SHD,ADD,"SHDtoADD");
		ElementLink l5_2 = new ElementLink(APD,ADD,"APDtoADD");
		ElementLink l5_3 = new ElementLink(CFD,ADD,"CFDtoADD");
		ElementLink l5_4 = new ElementLink(MDD,ADD,"MDDtoADD");
				
		g5.add(l5_1);
		g5.add(l5_2);
		g5.add(l5_3);
		g5.add(l5_4);
				
		

		
		
		BusinessStrategy bs5_1 = new BusinessStrategy("Basic Decision Adoption");
		BusinessStrategy bs5_2 = new BusinessStrategy("Comprehensive Decision Adoption");

		p5.add(bs5_1);
		p5.add(bs5_2);
		
		EvaluationStrategy s5_1 = new EvaluationStrategy("Basic Decision Adoption");
		EvaluationStrategy s5_2 = new EvaluationStrategy("Comprehensive Decision Adoption");



		bs5_1.st = s5_1;
		bs5_2.st = s5_2;
		
	
		BusinessProcessBuildingBlock bpt5_1 = new BusinessProcessBuildingBlock("Basic Decision Adoption");
		BusinessProcessBuildingBlock bpt5_2 = new BusinessProcessBuildingBlock("Comprehensive Decision Adoption");
		
		bs5_1.bpt = bpt5_1;
		bs5_2.bpt = bpt5_2;
				
		ProcessElement SHDPs5_1 = new ProcessElement("Share Decision");
		ProcessElement APDPs5_1 = new ProcessElement("Apply Decision");

		
		bpt5_1.add(SHDPs5_1);
		bpt5_1.add(APDPs5_1);

		

		SHDPs5_1.realizingIntention = SHD ;
		APDPs5_1.realizingIntention =  APD;

		
		
		ProcessElement SHDPs5_2 = new ProcessElement("Share Decision");
		ProcessElement APDPs5_2 = new ProcessElement("Apply Decision");
		ProcessElement CFDPs5_2 = new ProcessElement("Collect Feedback about Decision");
		ProcessElement MDDMPs5_2 = new ProcessElement("Modify Decisions");
		
		bpt5_2.add(SHDPs5_2);
		bpt5_2.add(APDPs5_2);
		bpt5_2.add(CFDPs5_2);
		bpt5_2.add(MDDMPs5_2);
		

		SHDPs5_2.realizingIntention = SHD ;
		APDPs5_2.realizingIntention =  APD;
		CFDPs5_2.realizingIntention =  CFD;
		MDDMPs5_2.realizingIntention =  MDD;
		
	
		/*********************************
		 *****P6: Action Taking****
		 ********************************/
		
		Pattern p6 = new Pattern("Action Taking");
		
		GoalModelBuildingBlock g6 = new GoalModelBuildingBlock("Action Taking");
	
		p6.GT = g6;

		Intention T1 = new Intention("Take Action");
		Intention Z = new Intention("Prioritize Outcomes");
		Intention V = new Intention("Prevent Outcome");

		T1.leaf = false;
		T1.mainGoal = true;

		Z.leaf = true;
		Z.mainGoal = false;

		V.leaf = true;
		V.mainGoal = false;
		
		
		g6.add(T1);
		g6.add(Z);
		g6.add(V);

		ElementLink l6_1 = new ElementLink(Z,T1,"ZtoT1");
		ElementLink l6_2 = new ElementLink(V,T1,"VtoT1");
		g6.add(l6_1);
		g6.add(l6_2);

		BusinessStrategy bs6_1 = new BusinessStrategy("Immediate Prevention");
		BusinessStrategy bs6_2 = new BusinessStrategy("Prioritized Prevention");


		p6.add(bs6_1);
		p6.add(bs6_2);


		EvaluationStrategy s6_1 = new EvaluationStrategy("Immediate Prevention");
		EvaluationStrategy s6_2 = new EvaluationStrategy("Prioritized Prevention");



		bs6_1.st = s6_1;
		bs6_2.st = s6_2;

		BusinessProcessBuildingBlock bpt6_1 = new BusinessProcessBuildingBlock("Immediate Prevention");
		BusinessProcessBuildingBlock bpt6_2 = new BusinessProcessBuildingBlock("Prioritized Prevention");


		bs6_1.bpt = bpt6_1;
		bs6_2.bpt = bpt6_2;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates

		ProcessElement VPs6_1 = new ProcessElement("Prevent Outcome");

		bpt6_1.add(VPs6_1);

		VPs6_1.realizingIntention = V;
		
		ProcessElement ZPs6_2 = new ProcessElement("Prioritize Outcomes");
		ProcessElement VPs6_2 = new ProcessElement("Prevent Outcome");

		bpt6_2.add(ZPs6_2);
		bpt6_2.add(VPs6_2);

		ZPs6_2.realizingIntention = Z;
		VPs6_2.realizingIntention = V;
		
	
		//create GPF
		PF pf = new PF("Healthcare Pattern Family");

		
		
		// patternDef Configurations
		C.patternDef = p2;
		G.patternDef = p3;
		M.patternDef = p4;
		A.patternDef = p5;
		T.patternDef = p6;
		
		pf.insert(p6);
		pf.insert(p5);
		pf.insert(p4);		
		pf.insert(p3);
		pf.insert(p2);
		pf.insert(p1);

		
		//create xml file for the obsolete pattern
		XStream xstream = new XStream();
		XMLutility.serializePFtoXMLfile(pf, xstream, "C:\\PATH\\cmbEx1\\combinationEx1In1.xml");

		//pfCombinationEx1 = pf;
		//return pf;
	}
	public static void combincationEx1In2CreateXML()
	{

		

		/*********************************
		 ***P1: Increase Patient Safety***
		 ********************************/	
		
		Pattern p1 = new Pattern("Increase Patient Safety");

		GoalModelBuildingBlock gt1 = new GoalModelBuildingBlock("Increase Patient Safety");
		
		p1.add(gt1);

		Intention I = new Intention("Increase Patient Safety");
		I.leaf= false;
		I.mainGoal = true;
		Intention C = new Intention("Collect Data");
		C.leaf = true;
		C.mainGoal = false;
		Intention G = new Intention("Generate Informative Outcome Information");
		G.leaf = true;
		G.mainGoal = false;
		Intention M = new Intention("Make Safety Decision");
		M.leaf = true;
		M.mainGoal = false;
		Intention A = new Intention("Adopt Decision");
		A.leaf = true;
		A.mainGoal = false;
		Intention T = new Intention("Take Action");
		T.leaf = true;
		T.mainGoal = false;
		
		gt1.add(I);
		gt1.add(C);
		gt1.add(G);
		gt1.add(M);
		gt1.add(A);
		gt1.add(T);
		
		ElementLink l1_1 = new ElementLink(C,I,"CtoI");
		ElementLink l1_2 = new ElementLink(G,I,"GtoI");		
		ElementLink l1_3 = new ElementLink(M,I,"MtoI");
		ElementLink l1_4 = new ElementLink(A,I,"AtoI");
		ElementLink l1_5 = new ElementLink(T,I,"TtoI");
		
		gt1.add(l1_1);
		gt1.add(l1_2);
		gt1.add(l1_3);
		gt1.add(l1_4);		
		gt1.add(l1_5);
		
		BusinessStrategy bs1_1 = new BusinessStrategy("Basic Improvement");
		BusinessStrategy bs1_2 = new BusinessStrategy("Advanced Improvement");
		BusinessStrategy bs1_3 = new BusinessStrategy("Advanced With Immediate Action");

		p1.add(bs1_1);
		p1.add(bs1_2);
		p1.add(bs1_3);

		EvaluationStrategy s1_1 = new EvaluationStrategy("Basic Improvement");
		EvaluationStrategy s1_2 = new EvaluationStrategy("Advanced Improvement");		
		EvaluationStrategy s1_3 = new EvaluationStrategy("Advanced With Immediate Action");

		bs1_1.st = s1_1;
		bs1_2.st = s1_2;
		bs1_3.st = s1_3;
		
		BusinessProcessBuildingBlock bpt1_1 = new BusinessProcessBuildingBlock("Basic Improvement");
		BusinessProcessBuildingBlock bpt1_2 = new BusinessProcessBuildingBlock("Advanced Improvement");
		BusinessProcessBuildingBlock bpt1_3 = new BusinessProcessBuildingBlock("Advanced With Immediate Action");
		
		bs1_1.bpt = bpt1_1;
		bs1_2.bpt = bpt1_2;
		bs1_3.bpt = bpt1_3;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates
	
		ProcessElement CPs1_1 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_1 = new ProcessElement("Generating Informative Outcome Information");
		bpt1_1.add(CPs1_1);
		bpt1_1.add(GPs1_1);

		CPs1_1.realizingIntention = C;
		GPs1_1.realizingIntention = G;

		
		
		ProcessElement CPs1_2 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_2 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_2 = new ProcessElement("Making Decision");
		ProcessElement APs1_2 = new ProcessElement("Applying Knowledge");

		bpt1_2.add(CPs1_2);
		bpt1_2.add(GPs1_2);
		bpt1_2.add(MPs1_2);
		bpt1_2.add(APs1_2);

		CPs1_2.realizingIntention = C;
		GPs1_2.realizingIntention = G;
		MPs1_2.realizingIntention = M;
		APs1_2.realizingIntention = A;


		ProcessElement CPs1_3 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_3 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_3 = new ProcessElement("Making Decision");
		ProcessElement APs1_3 = new ProcessElement("Applying Knowledge");
		ProcessElement TPs1_3 = new ProcessElement("Taking Action");
		CPs1_3.realizingIntention = C;
		GPs1_3.realizingIntention = G;
		MPs1_3.realizingIntention = M;
		APs1_3.realizingIntention = A;
		TPs1_3.realizingIntention = T;
		bpt1_3.add(CPs1_3);
		bpt1_3.add(GPs1_3);
		bpt1_3.add(MPs1_3);
		bpt1_3.add(APs1_3);
		bpt1_3.add(TPs1_3);
		
	

		/*********************************
		 *****P2:Data Collection *********
		 ********************************/	
	
		Pattern p2 = new Pattern("Data Collection");

		GoalModelBuildingBlock gt2 = new GoalModelBuildingBlock("Data Collection");

		p2.add(gt2);

		Intention C2 = new Intention("Collect Data");
		C2.leaf = false;
		C2.mainGoal = true;
		Intention O = new Intention("Collect Outcome Data");
		O.leaf = true;
		O.mainGoal = false;
		Intention P = new Intention("Collect Process Data");
		P.leaf = true;
		P.mainGoal = false;
		
		gt2.add(C2);
		gt2.add(O);
		gt2.add(P);
		
		
		ElementLink l2_1 = new ElementLink(O,C2,"OtoC2");
		ElementLink l2_2 = new ElementLink(P,C2,"PtoC2");
		
		gt2.add(l2_1);
		gt2.add(l2_2);		

		
		
		BusinessStrategy bs2_1 = new BusinessStrategy("Basic Outcome");
		BusinessStrategy bs2_2 = new BusinessStrategy("Basic Process");
		BusinessStrategy bs2_3 = new BusinessStrategy("Complete Collection");



		p2.add(bs2_1);
		p2.add(bs2_2);
		p2.add(bs2_3);

		EvaluationStrategy s2_1 = new EvaluationStrategy("Basic Outcome");
		EvaluationStrategy s2_2 = new EvaluationStrategy("Basic Process");
		EvaluationStrategy s2_3 = new EvaluationStrategy("Complete Collection");

		bs2_1.st = s2_1;
		bs2_2.st = s2_2;
		bs2_3.st = s2_3;

		BusinessProcessBuildingBlock bpt2_1 = new BusinessProcessBuildingBlock("Basic Outcome");
		BusinessProcessBuildingBlock bpt2_2 = new BusinessProcessBuildingBlock("Basic Process");
		BusinessProcessBuildingBlock bpt2_3 = new BusinessProcessBuildingBlock("Complete Collection");
		
		bs2_1.bpt = bpt2_1;
		bs2_2.bpt = bpt2_2;
		bs2_3.bpt = bpt2_3;

		
		ProcessElement OPs2_1 = new ProcessElement("Collecting Outcome Data");
		bpt2_1.add(OPs2_1);
		OPs2_1.realizingIntention = O;
		
		ProcessElement PPs2_2 = new ProcessElement("Collecting Process Data");
		bpt2_2.add(PPs2_2);
		PPs2_2.realizingIntention = P;
		
		ProcessElement OPs2_3 = new ProcessElement("Collecting Outcome Data");
		ProcessElement PPs2_3 = new ProcessElement("Collecting Process Data");
		bpt2_3.add(OPs2_3);
		bpt2_3.add(PPs2_3);
		OPs2_3.realizingIntention = O;
		PPs2_3.realizingIntention = P;


		/*********************************
		 *****P3: Information Generation**
		 ********************************/	
		
		Pattern p3 = new Pattern("Information Generation");
		
		GoalModelBuildingBlock gt3 = new GoalModelBuildingBlock("Information Generation");
		
		p3.add(gt3);	
	
		Intention G2 = new Intention("Generate Informative Outcome Information");
		G2.leaf = false;
		G2.mainGoal = true;
		Intention AOD = new Intention("Analyze Outcome Data");
		AOD.leaf = true;
		AOD.mainGoal = false;
		Intention GEO = new Intention("Generate Expert Opinion");
		GEO.leaf = true;
		GEO.mainGoal = false;
		
		gt3.add(G2);
		gt3.add(AOD);
		gt3.add(GEO);		
		
		ElementLink l3_1 = new ElementLink(AOD,G2,"AODtoG2");
		ElementLink l3_2 = new ElementLink(GEO,G2,"GEOtoG2");

		
		gt3.add(l3_1);
		gt3.add(l3_2);
		
		BusinessStrategy bs3_1 = new BusinessStrategy("Data Analyzing");
		BusinessStrategy bs3_2 = new BusinessStrategy("Expert Evaluation");
		BusinessStrategy bs3_3 = new BusinessStrategy("Analysis Based Expert Evaluation");
		
		p3.add(bs3_1);
		p3.add(bs3_2);
		p3.add(bs3_3);
		
		EvaluationStrategy s3_1 = new EvaluationStrategy("Data Analyzing");
		EvaluationStrategy s3_2 = new EvaluationStrategy("Expert Evaluation");
		EvaluationStrategy s3_3 = new EvaluationStrategy("Analysis Based Expert Evaluation");

		bs3_1.st = s3_1;
		bs3_2.st = s3_2;
		bs3_3.st = s3_3;
		
		BusinessProcessBuildingBlock bpt3_1 = new BusinessProcessBuildingBlock("Data Analyzing");
		BusinessProcessBuildingBlock bpt3_2 = new BusinessProcessBuildingBlock("Expert Evaluation");
		BusinessProcessBuildingBlock bpt3_3 = new BusinessProcessBuildingBlock("Analysis Based Expert Evaluation");
		
		bs3_1.bpt = bpt3_1;
		bs3_2.bpt = bpt3_2;
		bs3_3.bpt = bpt3_3;
		
		ProcessElement AODPs3_1 = new ProcessElement("Analyzing Data");
		bpt3_1.add(AODPs3_1);
		AODPs3_1.realizingIntention = AOD;		

		ProcessElement GEOPs3_2 = new ProcessElement("Generating Expert Opinion");
		bpt3_2.add(GEOPs3_2);
		GEOPs3_2.realizingIntention = GEO;
		
		ProcessElement AODPs3_3 = new ProcessElement("Analyzing Data");
		ProcessElement GEOPs3_3 = new ProcessElement("Generating Expert Opinion");
		bpt3_3.add(AODPs3_3);
		bpt3_3.add(GEOPs3_3);
		AODPs3_3.realizingIntention = AOD;
		GEOPs3_3.realizingIntention = GEO;		


		
		
		/*********************************
		 ****P7: Outcome Data Collection**
		 ********************************/		

		
		Pattern p7 = new Pattern("Outcome Data Collection");
		
		GoalModelBuildingBlock g7 = new GoalModelBuildingBlock("Outcome Data Collection");
		
		p7.add(g7);	
	
		Intention O2 = new Intention("Collect Outcome Data");
		O2.leaf = false;
		O2.mainGoal = true;
		Intention L = new Intention("Look for Outcome Data");
		L.leaf = true;
		L.mainGoal = false;
		Intention N = new Intention("Analyse Outcome Observation");
		N.leaf = true;
		N.mainGoal = false;
		Intention R = new Intention("Record Outcome Data");
		R.leaf = true;
		R.mainGoal = false;
		
		g7.add(O2);
		g7.add(L);
		g7.add(N);
		g7.add(R);
		
		
		ElementLink l7_1 = new ElementLink(L,O2,"LtoO2");
		ElementLink l7_2 = new ElementLink(N,O2,"NtoO2");
		ElementLink l7_3 = new ElementLink(R,O2,"RtoO2");


		
		g7.add(l7_1);
		g7.add(l7_2);
		g7.add(l7_3);
		
		BusinessStrategy bs7_1 = new BusinessStrategy("Basic Outcome Recoding");
		BusinessStrategy bs7_2 = new BusinessStrategy("Preprocessed Outcome Recording");
		
		p7.add(bs7_1);
		p7.add(bs7_2);
		
		EvaluationStrategy s7_1 = new EvaluationStrategy("Basic Outcome Recoding");
		EvaluationStrategy s7_2 = new EvaluationStrategy("Preprocessed Outcome Recording");
		

		bs7_1.st = s7_1;
		bs7_2.st = s7_2;
		
		BusinessProcessBuildingBlock bpt7_1 = new BusinessProcessBuildingBlock("Basic Outcome Recoding");
		BusinessProcessBuildingBlock bpt7_2 = new BusinessProcessBuildingBlock("Preprocessed Outcome Recording");

		bs7_1.bpt = bpt7_1;
		bs7_2.bpt = bpt7_2;
		
		ProcessElement LPs7_1 = new ProcessElement("Looking for Outcome Data");
		ProcessElement RPs7_1 = new ProcessElement("Recording Outcome Data");
		bpt7_1.add(LPs7_1);
		bpt7_1.add(RPs7_1);
		LPs7_1.realizingIntention = L;
		RPs7_1.realizingIntention = R;
		
		
		ProcessElement LPs7_2 = new ProcessElement("Looking for Outcome Data");
		ProcessElement NPs7_2 = new ProcessElement("Analysing Outcome Observation");
		ProcessElement RPs7_2 = new ProcessElement("Recording Outcome Data");
		bpt7_2.add(LPs7_2);
		bpt7_2.add(NPs7_2);
		bpt7_2.add(RPs7_2);
		LPs7_2.realizingIntention = L;
		NPs7_2.realizingIntention = N;
		RPs7_2.realizingIntention = R;

		
		
		/*********************************
		 ***P8: Process Data Collection***
		 ********************************/
		
		Pattern p8 = new Pattern("Process Data Collection");
		
		GoalModelBuildingBlock g8 = new GoalModelBuildingBlock("Process Data Collection");
		
		p8.add(g8);	
	
		Intention P2 = new Intention("Collect Process Data");
		P2.leaf = false;
		P2.mainGoal = true;
		Intention L2 = new Intention("Look for Process Data");
		L2.leaf = true;
		L2.mainGoal = false;
		Intention N2 = new Intention("Analyse Process Observation");
		N2.leaf = true;
		N2.mainGoal = false;
		Intention R2 = new Intention("Record Process Data");
		R2.leaf = true;
		R2.mainGoal = false;
		
		g8.add(P2);
		g8.add(L2);
		g8.add(N2);
		g8.add(R2);
		
		
		ElementLink l8_1 = new ElementLink(L2,P2,"L2toP2");
		ElementLink l8_2 = new ElementLink(N2,P2,"N2toP2");
		ElementLink l8_3 = new ElementLink(R,P2,"R2toP2");


		
		g8.add(l8_1);
		g8.add(l8_2);
		g8.add(l8_3);
		
		BusinessStrategy bs8_1 = new BusinessStrategy("Basic Process Recoding");
		BusinessStrategy bs8_2 = new BusinessStrategy("Preprocessed Process Recording");
		
		p8.add(bs8_1);
		p8.add(bs8_2);
		
		EvaluationStrategy s8_1 = new EvaluationStrategy("Basic Process Recoding");
		EvaluationStrategy s8_2 = new EvaluationStrategy("Preprocessed Process Recording");
		

		bs8_1.st = s8_1;
		bs8_2.st = s8_2;
		
		BusinessProcessBuildingBlock bpt8_1 = new BusinessProcessBuildingBlock("Basic Process Recoding");
		BusinessProcessBuildingBlock bpt8_2 = new BusinessProcessBuildingBlock("Preprocessed Process Recording");

		bs8_1.bpt = bpt8_1;
		bs8_2.bpt = bpt8_2;
		
		ProcessElement L2Ps8_1 = new ProcessElement("Looking for Process Data");
		ProcessElement R2Ps8_1 = new ProcessElement("Recording Process Data");
		bpt8_1.add(L2Ps8_1);
		bpt8_1.add(R2Ps8_1);
		

		L2Ps8_1.realizingIntention = L2;
		R2Ps8_1.realizingIntention = R2;
		
		ProcessElement L2Ps8_2 = new ProcessElement("Looking for Process Data");
		ProcessElement N2Ps8_2 = new ProcessElement("Analysing Process Observation");
		ProcessElement R2Ps8_2 = new ProcessElement("Recording Process Data");
		bpt8_2.add(L2Ps8_2);
		bpt8_2.add(N2Ps8_2);
		bpt8_2.add(R2Ps8_2);



		L2Ps8_2.realizingIntention = L2;
		N2Ps8_2.realizingIntention = N2;
		R2Ps8_2.realizingIntention = R2;

		
		
		
		//create GPF
		PF pf = new PF("Healthcare Pattern Family");

		
		
		// patternDef Configurations
		C.patternDef = p2;
		G.patternDef = p3;
		O.patternDef = p7;
		P.patternDef = p8;
		
		pf.insert(p8);
		pf.insert(p7);
		pf.insert(p3);
		pf.insert(p2);
		pf.insert(p1);

		
		//create xml file for the obsolete pattern
		XStream xstream = new XStream();
		XMLutility.serializePFtoXMLfile(pf, xstream, "C:\\PATH\\cmbEx1\\combinationEx1In2.xml");


	}


	//TODO: the following method is not need any more. delete it.
	public static void combincationEx1In22CreateXML()
	{


		/*********************************
		 ***P1: Increase Patient Safety***
		 ********************************/	
		
		Pattern p1 = new Pattern("Increase Patient Safety");

		GoalModelBuildingBlock gt1 = new GoalModelBuildingBlock("Increase Patient Safety");
		
		p1.add(gt1);

		Intention I = new Intention("Increase Patient Safety");
		I.leaf= false;
		I.mainGoal = true;
		Intention C = new Intention("Collect Data");
		C.leaf = true;
		C.mainGoal = false;
		Intention G = new Intention("Generate Informative Outcome Information");
		G.leaf = true;
		G.mainGoal = false;
		Intention M = new Intention("Make Safety Decision");
		M.leaf = true;
		M.mainGoal = false;
		Intention A = new Intention("Adopt Decision");
		A.leaf = true;
		A.mainGoal = false;
		
		gt1.add(I);
		gt1.add(C);
		gt1.add(G);
		gt1.add(M);
		gt1.add(A);
		
		ElementLink l1_1 = new ElementLink(C,I,"CtoI");
		ElementLink l1_2 = new ElementLink(G,I,"GtoI");		
		ElementLink l1_3 = new ElementLink(M,I,"MtoI");
		ElementLink l1_4 = new ElementLink(A,I,"AtoI");
		
		gt1.add(l1_1);
		gt1.add(l1_2);
		gt1.add(l1_3);
		gt1.add(l1_4);		
		
		BusinessStrategy bs1_1 = new BusinessStrategy("Basic Improvement");
		BusinessStrategy bs1_2 = new BusinessStrategy("Advanced Improvement");

		p1.add(bs1_1);
		p1.add(bs1_2);		

		EvaluationStrategy s1_1 = new EvaluationStrategy("Basic Improvement");
		EvaluationStrategy s1_2 = new EvaluationStrategy("Advanced Improvement");		

		bs1_1.st = s1_1;
		bs1_2.st = s1_2;
		
		BusinessProcessBuildingBlock bpt1_1 = new BusinessProcessBuildingBlock("Basic Improvement");
		BusinessProcessBuildingBlock bpt1_2 = new BusinessProcessBuildingBlock("Advanced Improvement");
		
		bs1_1.bpt = bpt1_1;
		bs1_2.bpt = bpt1_2;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates
	
		ProcessElement CPs1_1 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_1 = new ProcessElement("Generating Informative Outcome Information");
		bpt1_1.add(CPs1_1);
		bpt1_1.add(GPs1_1);

		ProcessElement CPs1_2 = new ProcessElement("Collecting Data");
		ProcessElement GPs1_2 = new ProcessElement("Generating Informative Outcome Information");
		ProcessElement MPs1_2 = new ProcessElement("Making Decision");
		ProcessElement APs1_2 = new ProcessElement("Applying Knowledge");
		bpt1_2.add(CPs1_2);
		bpt1_2.add(GPs1_2);
		bpt1_2.add(MPs1_2);
		bpt1_2.add(APs1_2);


		// Intention Realization
		CPs1_1.realizingIntention = C;
		GPs1_1.realizingIntention = G;


		CPs1_2.realizingIntention = C;
		GPs1_2.realizingIntention = G;
		MPs1_2.realizingIntention = M;
		APs1_2.realizingIntention = A;


		/*********************************
		 *****P2:Data Collection *********
		 ********************************/	
	
		Pattern p2 = new Pattern("Data Collection");

		GoalModelBuildingBlock gt2 = new GoalModelBuildingBlock("Data Collection");

		p2.add(gt2);

		Intention C2 = new Intention("Collect Data");
		C2.leaf = false;
		C2.mainGoal = true;
		Intention O = new Intention("Collect Outcome Data");
		O.leaf = true;
		O.mainGoal = false;
		Intention P = new Intention("Collect Process Data");
		P.leaf = true;
		P.mainGoal = false;
		
		gt2.add(C2);
		gt2.add(O);
		gt2.add(P);
		
		
		ElementLink l2_1 = new ElementLink(O,C2,"OtoC2");
		ElementLink l2_2 = new ElementLink(P,C2,"PtoC2");
		
		gt2.add(l2_1);
		gt2.add(l2_2);		

		
		
		BusinessStrategy bs2_1 = new BusinessStrategy("Basic Outcome");
		BusinessStrategy bs2_2 = new BusinessStrategy("Basic Process");
		BusinessStrategy bs2_3 = new BusinessStrategy("Complete Collection");



		p2.add(bs2_1);
		p2.add(bs2_2);
		p2.add(bs2_3);

		EvaluationStrategy s2_1 = new EvaluationStrategy("Basic Outcome");
		EvaluationStrategy s2_2 = new EvaluationStrategy("Basic Process");
		EvaluationStrategy s2_3 = new EvaluationStrategy("Complete Collection");

		bs2_1.st = s2_1;
		bs2_2.st = s2_2;
		bs2_3.st = s2_3;

		BusinessProcessBuildingBlock bpt2_1 = new BusinessProcessBuildingBlock("Basic Outcome");
		BusinessProcessBuildingBlock bpt2_2 = new BusinessProcessBuildingBlock("Basic Process");
		BusinessProcessBuildingBlock bpt2_3 = new BusinessProcessBuildingBlock("Complete Collection");
		
		bs2_1.bpt = bpt2_1;
		bs2_2.bpt = bpt2_2;
		bs2_3.bpt = bpt2_3;

		
		ProcessElement OPs2_1 = new ProcessElement("Collecting Outcome Data");
		bpt2_1.add(OPs2_1);

		ProcessElement PPs2_2 = new ProcessElement("Collecting Process Data");
		bpt2_2.add(PPs2_2);

		ProcessElement OPs2_3 = new ProcessElement("Collecting Outcome Data");
		ProcessElement PPs2_3 = new ProcessElement("Collecting Process Data");
		bpt2_3.add(OPs2_3);
		bpt2_3.add(PPs2_3);


		OPs2_1.realizingIntention = O;


		PPs2_2.realizingIntention = P;


		OPs2_3.realizingIntention = O;
		PPs2_3.realizingIntention = P;


		/*********************************
		 *****P3: Information Generation**
		 ********************************/	
		
		Pattern p3 = new Pattern("Information Generation");
		
		GoalModelBuildingBlock gt3 = new GoalModelBuildingBlock("Information Generation");
		
		p3.add(gt3);	
	
		Intention G2 = new Intention("Generate Informative Outcome Information");
		G2.leaf = false;
		G2.mainGoal = true;
		Intention AOD = new Intention("Analyze Outcome Data");
		AOD.leaf = true;
		AOD.mainGoal = false;
		Intention GEO = new Intention("Generate Expert Opinion");
		GEO.leaf = true;
		GEO.mainGoal = false;
		
		gt3.add(G2);
		gt3.add(AOD);
		gt3.add(GEO);		
		
		ElementLink l3_1 = new ElementLink(AOD,G2,"AODtoG2");
		ElementLink l3_2 = new ElementLink(GEO,G2,"GEOtoG2");

		
		gt3.add(l3_1);
		gt3.add(l3_2);
		
		BusinessStrategy bs3_1 = new BusinessStrategy("Data Analyzing");
		BusinessStrategy bs3_2 = new BusinessStrategy("Expert Evaluation");
		BusinessStrategy bs3_3 = new BusinessStrategy("Analysis Based Expert Evaluation");
		
		p3.add(bs3_1);
		p3.add(bs3_2);
		p3.add(bs3_3);
		
		EvaluationStrategy s3_1 = new EvaluationStrategy("Data Analyzing");
		EvaluationStrategy s3_2 = new EvaluationStrategy("Expert Evaluation");
		EvaluationStrategy s3_3 = new EvaluationStrategy("Analysis Based Expert Evaluation");

		bs3_1.st = s3_1;
		bs3_2.st = s3_2;
		bs3_3.st = s3_3;
		
		BusinessProcessBuildingBlock bpt3_1 = new BusinessProcessBuildingBlock("Data Analyzing");
		BusinessProcessBuildingBlock bpt3_2 = new BusinessProcessBuildingBlock("Expert Evaluation");
		BusinessProcessBuildingBlock bpt3_3 = new BusinessProcessBuildingBlock("Analysis Based Expert Evaluation");
		
		bs3_1.bpt = bpt3_1;
		bs3_2.bpt = bpt3_2;
		bs3_3.bpt = bpt3_3;
		
		ProcessElement AODPs3_1 = new ProcessElement("Analyzing Data");
		bpt3_1.add(AODPs3_1);
		

		ProcessElement GEOPs3_2 = new ProcessElement("Generating Expert Opinion");
		bpt3_2.add(GEOPs3_2);

		ProcessElement AODPs3_3 = new ProcessElement("Analyzing Data");
		ProcessElement GEOPs3_3 = new ProcessElement("Generating Expert Opinion");
		bpt3_3.add(AODPs3_3);
		bpt3_3.add(GEOPs3_3);
		

		AODPs3_1.realizingIntention = AOD;
		
		GEOPs3_2.realizingIntention = GEO;

		AODPs3_3.realizingIntention = AOD;
		GEOPs3_3.realizingIntention = GEO;

		
		/*********************************
		 *****P4: Knowledge Generation****
		 ********************************/		
		Pattern p4 = new Pattern("Knowledge Generation");		
		
		GoalModelBuildingBlock g4 = new GoalModelBuildingBlock("Knowledge Generation");
		
		Intention MSD = new Intention("Make Safety Decision");
		Intention AOIA = new Intention("Analyze Outcome Inofrmation Database by Analysts");
		Intention AOIE = new Intention("Analyze Outcome Information by Healthcare Experts");
		Intention IDM = new Intention("Inform Decision Makers");
		Intention DID = new Intention("Discuss the Issue by Decision Makers");
		Intention DIDM = new Intention("Decide about Issues by Decision Makers");
		MSD.leaf = false;
		MSD.mainGoal = true;
		AOIA.leaf = true;
		AOIA.mainGoal = false;
		AOIE.leaf = true;
		AOIE.mainGoal = false;
		IDM.leaf = true;
		IDM.mainGoal = false;
		DID.leaf = true;
		DID.mainGoal = false;
		DIDM.leaf = true;
		DIDM.mainGoal = false;
		
		g4.add(MSD);
		g4.add(AOIA);
		g4.add(AOIE);
		g4.add(IDM);
		g4.add(DID);
		g4.add(DIDM);
		
		ElementLink l4_1 = new ElementLink(AOIA,MSD,"AOIAtoMSD");
		ElementLink l4_2 = new ElementLink(AOIE,MSD,"AOIEtoMSD");
		ElementLink l4_3 = new ElementLink(IDM,MSD,"IDMtoMSD");
		ElementLink l4_4 = new ElementLink(DID,MSD,"DIDtoMSD");
		ElementLink l4_5 = new ElementLink(DIDM,MSD,"DIDMtoMSD");
		
		g4.add(l4_1);
		g4.add(l4_2);
		g4.add(l4_3);
		g4.add(l4_4);
		g4.add(l4_5);
		
		
		p4.GT = g4;
		
		
		BusinessStrategy bs4_1 = new BusinessStrategy("Data Based Decision Making");
		BusinessStrategy bs4_2 = new BusinessStrategy("Expert Based Decision Making");
		BusinessStrategy bs4_3 = new BusinessStrategy("Comprehensive Decision Making");

		p4.add(bs4_1);
		p4.add(bs4_2);
		p4.add(bs4_3);
		
		EvaluationStrategy s4_1 = new EvaluationStrategy("Data Based Decision Making");
		EvaluationStrategy s4_2 = new EvaluationStrategy("Expert Based Decision Making");
		EvaluationStrategy s4_3 = new EvaluationStrategy("Comprehensive Decision Making");


		bs4_1.st = s4_1;
		bs4_2.st = s4_2;
		bs4_3.st = s4_3;
	
		BusinessProcessBuildingBlock bpt4_1 = new BusinessProcessBuildingBlock("Data Based Decision Making");
		BusinessProcessBuildingBlock bpt4_2 = new BusinessProcessBuildingBlock("Expert Based Decision Making");
		BusinessProcessBuildingBlock bpt4_3 = new BusinessProcessBuildingBlock("Comprehensive Decision Making");

		bs4_1.bpt = bpt4_1;
		bs4_2.bpt = bpt4_2;
		bs4_3.bpt = bpt4_3;
		
		
		
		ProcessElement AOIEPs4_1 = new ProcessElement("Analyze Outcome Information by Healthcare Experts");
		ProcessElement IDMPs4_1 = new ProcessElement("Inform Decision Makers");
		ProcessElement DIDMPs4_1 = new ProcessElement("Decide about Issues by Decision Makers");
		
		bpt4_1.add(AOIEPs4_1);
		bpt4_1.add(IDMPs4_1);
		bpt4_1.add(DIDMPs4_1);
		
		AOIEPs4_1.realizingIntention = AOIE;
		IDMPs4_1.realizingIntention = IDM;
		DIDMPs4_1.realizingIntention =DIDM;
		
		
		ProcessElement AOIEPs4_2 = new ProcessElement("Analyze Outcome Information by Healthcare Experts");
		ProcessElement IDMPs4_2 = new ProcessElement("Inform Decision Makers");
		ProcessElement DIDPs4_2 = new ProcessElement("Discuss the Issue by Decision Makers");
		ProcessElement DIDMPs4_2 = new ProcessElement("Decide about Issues by Decision Makers");
		

		bpt4_2.add(AOIEPs4_2);
		bpt4_2.add(IDMPs4_2);
		bpt4_2.add(DIDPs4_2);
		bpt4_2.add(DIDMPs4_2);
		

		AOIEPs4_2.realizingIntention = AOIE;
		IDMPs4_2.realizingIntention = IDM;
		DIDPs4_2.realizingIntention =DID;
		DIDMPs4_2.realizingIntention =DIDM;
		
		
		ProcessElement AOIAPs4_3 = new ProcessElement("Analyze Outcome Inofrmation Database by Analysts");
		ProcessElement AOIEPs4_3 = new ProcessElement("Analyze Outcome Information by Healthcare Experts");
		ProcessElement IDMPs4_3 = new ProcessElement("Inform Decision Makers");
		ProcessElement DIDPs4_3 = new ProcessElement("Discuss the Issue by Decision Makers");
		ProcessElement DIDMPs4_3 = new ProcessElement("Decide about Issues by Decision Makers");
		
		bpt4_3.add(AOIAPs4_3);
		bpt4_3.add(AOIEPs4_3);
		bpt4_3.add(IDMPs4_3);
		bpt4_3.add(DIDPs4_3);
		bpt4_3.add(DIDMPs4_3);
		
		AOIAPs4_3.realizingIntention = AOIA ;
		AOIEPs4_3.realizingIntention = AOIE;
		IDMPs4_3.realizingIntention = IDM;
		DIDPs4_3.realizingIntention =DID;
		DIDMPs4_3.realizingIntention =DIDM;
		
		/*********************************
		 *****P5: Knowledge Application****
		 ********************************/
		Pattern p5 = new Pattern("Knowledge Application");		
		
		GoalModelBuildingBlock g5 = new GoalModelBuildingBlock("Knowledge Application");
		
		Intention ADD = new Intention("Adopt Decision");
		Intention SHD = new Intention("Share Decision");
		Intention APD = new Intention("Apply Decision");
		Intention CFD = new Intention("Collect Feedback about Decision");
		Intention MDD = new Intention("Modify Decisions");
		
		ADD.leaf = false;
		ADD.mainGoal = true;
		SHD.leaf = true;
		SHD.mainGoal = false;
		APD.leaf = true;
		APD.mainGoal = false;
		CFD.leaf = true;
		CFD.mainGoal = false;
		MDD.leaf = true;
		MDD.mainGoal = false;
		
		g5.add(ADD);
		g5.add(SHD);
		g5.add(APD);
		g5.add(CFD);
		g5.add(MDD);
		
		
		ElementLink l5_1 = new ElementLink(SHD,ADD,"SHDtoADD");
		ElementLink l5_2 = new ElementLink(APD,ADD,"APDtoADD");
		ElementLink l5_3 = new ElementLink(CFD,ADD,"CFDtoADD");
		ElementLink l5_4 = new ElementLink(MDD,ADD,"MDDtoADD");
				
		g5.add(l5_1);
		g5.add(l5_2);
		g5.add(l5_3);
		g5.add(l5_4);
				
		
		p5.GT = g5;
		
		
		BusinessStrategy bs5_1 = new BusinessStrategy("Basic Decision Adoption");
		BusinessStrategy bs5_2 = new BusinessStrategy("Comprehensive Decision Adoption");

		p5.add(bs5_1);
		p5.add(bs5_2);
		
		EvaluationStrategy s5_1 = new EvaluationStrategy("Basic Decision Adoption");
		EvaluationStrategy s5_2 = new EvaluationStrategy("Comprehensive Decision Adoption");



		bs5_1.st = s5_1;
		bs5_2.st = s5_2;
		
	
		BusinessProcessBuildingBlock bpt5_1 = new BusinessProcessBuildingBlock("Basic Decision Adoption");
		BusinessProcessBuildingBlock bpt5_2 = new BusinessProcessBuildingBlock("Comprehensive Decision Adoption");
		
		bs5_1.bpt = bpt5_1;
		bs5_2.bpt = bpt5_2;
				
		ProcessElement SHDPs5_1 = new ProcessElement("Share Decision");
		ProcessElement APDPs5_1 = new ProcessElement("Apply Decision");

		
		bpt5_1.add(SHDPs5_1);
		bpt5_1.add(APDPs5_1);

		

		SHDPs5_1.realizingIntention = SHD ;
		APDPs5_1.realizingIntention =  APD;

		
		
		ProcessElement SHDPs5_2 = new ProcessElement("Share Decision");
		ProcessElement APDPs5_2 = new ProcessElement("Apply Decision");
		ProcessElement CFDPs5_2 = new ProcessElement("Collect Feedback about Decision");
		ProcessElement MDDMPs5_2 = new ProcessElement("Modify Decisions");
		
		bpt5_2.add(SHDPs5_2);
		bpt5_2.add(APDPs5_2);
		bpt5_2.add(CFDPs5_2);
		bpt5_2.add(MDDMPs5_2);
		

		SHDPs5_2.realizingIntention = SHD ;
		APDPs5_2.realizingIntention =  APD;
		CFDPs5_2.realizingIntention =  CFD;
		MDDMPs5_2.realizingIntention =  MDD;
		
	
		/*********************************
		 *****P6: Action Taking****
		 ********************************/
		
		Pattern p6 = new Pattern("Action Taking");
		
		GoalModelBuildingBlock g6 = new GoalModelBuildingBlock("Action Taking");
	

		Intention T = new Intention("Take Action");
		Intention Z = new Intention("Prioritize Outcomes");
		Intention V = new Intention("Prevent Outcome");

		T.leaf = false;
		T.mainGoal = true;

		Z.leaf = true;
		Z.mainGoal = false;

		V.leaf = true;
		V.mainGoal = false;
		
		
		g6.add(T);
		g6.add(Z);
		g6.add(V);

		ElementLink l6_1 = new ElementLink(Z,T,"ZtoT");
		ElementLink l6_2 = new ElementLink(V,T,"VtoT");
		g6.add(l6_1);
		g6.add(l6_2);
		
		
		p6.GT = g6;

		BusinessStrategy bs6_1 = new BusinessStrategy("Immediate Prevention");
		BusinessStrategy bs6_2 = new BusinessStrategy("Prioritized Prevention");


		p6.add(bs6_1);
		p6.add(bs6_2);


		EvaluationStrategy s6_1 = new EvaluationStrategy("Immediate Prevention");
		EvaluationStrategy s6_2 = new EvaluationStrategy("Prioritized Prevention");



		bs6_1.st = s6_1;
		bs6_2.st = s6_2;

		BusinessProcessBuildingBlock bpt6_1 = new BusinessProcessBuildingBlock("Immediate Prevention");
		BusinessProcessBuildingBlock bpt6_2 = new BusinessProcessBuildingBlock("Prioritized Prevention");


		bs6_1.bpt = bpt6_1;
		bs6_2.bpt = bpt6_2;

		// elements of BPT (UCM maps) are created and assigned to BusinessProcessTemplates

		ProcessElement VPs6_1 = new ProcessElement("Prevent Outcome");

		bpt6_1.add(VPs6_1);

		VPs6_1.realizingIntention = V;
		
		ProcessElement ZPs6_2 = new ProcessElement("Prioritize Outcomes");
		ProcessElement VPs6_2 = new ProcessElement("Prevent Outcome");

		bpt6_2.add(ZPs6_2);
		bpt6_2.add(VPs6_2);

		ZPs6_2.realizingIntention = Z;
		VPs6_2.realizingIntention = V;
		
	
		//create GPF
		PF pf = new PF("Healthcare Pattern Family");

		
		
		// patternDef Configurations
		C.patternDef = p2;
		G.patternDef = p3;
		M.patternDef = p4;
		A.patternDef = p5;
		T.patternDef = p6;
		
		pf.insert(p6);
		pf.insert(p5);
		pf.insert(p4);		
		pf.insert(p3);
		pf.insert(p2);
		pf.insert(p1);

		//pfCombinationEx1 = pf;
		//return pf;
	}


}
