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

import java.util.Iterator;
import java.util.List;

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

public class ResultingResourceCompare
{

//	 resourceRef 	 xsd:IDREF 	 Yes
//		any 	namespace="##other" 	 ?
//	DescriptionGroup 		DescriptionGroup 	Merge
//	Condition 		<ConditionType> 	Yes
//	Name 		<VariableExpressionType> 	Merge
//	Version 		<VersionType> 	Yes
//	FixName 		xsd:string 	Merge
//	Property 		<ResultingPropertyType> 	Merge
//	Relationship 		<RelationshipType> 	Merge
//	any 		namespace="##other" 	 ? 
	
	public static boolean equals(List<ResultingResourceType> r1, List<ResultingResourceType> r2)
	{
		if (r1.size()!=r2.size())
			return false;
		
		Iterator <ResultingResourceType> iter = r1.iterator();
		
		while (iter.hasNext())
		{
			ResultingResourceType o = iter.next();
			
			Iterator <ResultingResourceType> iter2 = r2.iterator();
			boolean notfound = true;
			ResultingResourceType o2 = null;
			while (iter2.hasNext()&&notfound)
			{
				o2 = iter2.next();
				if (equals(o,o2))
					notfound = false;
			}
			if (notfound)
				return false;
			else
				r2.remove(o2);
		}
		
		return true;
	}
	
	private static boolean equals(ResultingResourceType o, ResultingResourceType o2)
	{
		
		return true;
	}

}
