package org.eclipse.cosmos.me.sdd.tooling.btg.aggregator.comparisons;

import java.util.Collection;
import java.util.List;

import org.eclipse.cosmos.me.sdd.schema.AlternativeRequirementType;

public class AlternativeRequirementCompare
{

	public static Collection<AlternativeRequirementType> merge(List<AlternativeRequirementType> alt, List<AlternativeRequirementType> alt2)
	{
		//TODO IMPROVE THIS
		alt.addAll(alt2);
		return alt;
	}
//		Vector <AlternativeRequirementType> toRemove = new Vector <AlternativeRequirementType> ();
//		Iterator <AlternativeRequirementType> iter1 = alt.iterator();		
//		//iterate through the items
//		while (iter1.hasNext())
//		{
//			AlternativeRequirementType o1 = (AlternativeRequirementType) iter1.next();
//			Iterator <AlternativeRequirementType> iter2 = alt2.iterator();
//			while (iter2.hasNext())
//			{
//				AlternativeRequirementType o2 = (AlternativeRequirementType) iter2.next();
//				//if you find a match that hasn't been found, note it
//				//one of the equals needs to be deleted with its children merged over
//				if (toRemove.contains(o2)==false)
//				{
//					if (equals(o1, o2))
//					{  
//						toRemove.add(o2);
//						o1 = merge(o1,o2);
//					}
//				}
//					
//			}
//		}
//		
//		alt2.removeAll(toRemove);
//		//remove all of the matches that were found
//		
//		Vector <AlternativeRequirementType> finals = new Vector <AlternativeRequirementType> ();
//		//create and return a new collection with all of the remaining items
//		finals.addAll(alt);
//		finals.addAll(alt2);		
//		
//		return finals;
//	}
//
////	 id 	 xsd:ID 	 Throw Away
////		priority 	xsd:positiveInteger 	Merge
////		any 	namespace="##other" 	 ?
////	DisplayElementGroup 		DisplayElementGroup 	Merge
////	ResourceConstraint 		<RequirementResourceConstraintType> 	Yes
////	Dependency 		<InternalDependencyType> 	Yes
////	any 		namespace="##other" 	 ? 
//	
//	protected static AlternativeRequirementType merge(AlternativeRequirementType o1,	AlternativeRequirementType o2)
//	{
//		ObjectFactory objectFactory = new ObjectFactory();
//		AlternativeRequirementType r = objectFactory.createAlternativeRequirementType();
//		r.setDescription(DisplayTextCompare.merge(o1.getDescription(), o2.getDescription()));
//		r.setDisplayName(DisplayTextCompare.merge(o1.getDisplayName(), o2.getDisplayName()));
//		r.setId(o1.getId());
//		r.setShortDescription(DisplayTextCompare.merge(o1.getShortDescription(), o2.getShortDescription()));
//		r.
//		return r;
//	}
//
//	protected static boolean equals(AlternativeRequirementType rc, AlternativeRequirementType rc2)
//	{
//		if (!ResourceCompare.equals((ResourceType)rc.getResourceRef(),(ResourceType)rc2.getResourceRef()))
//			return false;
//		if (rc.isTestValue()!=rc2.isTestValue())
//			return false;
//		return true;
//	}


}
