/// <summary>
        /// Merges multiple ResultObjects of different categories to a single list of ContentObjects.
        /// The merge is based on a set of weights.
        /// </summary>
        /// <param name="results">An array of different ResultObjects for several categories</param>
        /// <param name="ratio">An array with weights for the different categories in the results array</param>
        /// <returns>A list of ContentObjects where the content's value is the weighted score per category. The list is sorted in descending order (the higher the value, the earlier in the list)</returns>
        public List <ContentObject> Merge(ResultObject[] results, CategoryRatio ratio)
        {
            // Attetion! No sanity checks: Must be different result.categories, ratios must sum up to 1.
            List <ContentObject>  totalResults = new List <ContentObject>();
            List <List <Triple> > scores       = Prepare(results);

            while (scores.Count > 0)
            {
                List <Triple> list = Pop(scores);
                while (list.Count > 0)
                {
                    Triple needle = Pop(list);
                    bool   lonely = true;
                    foreach (List <Triple> haystack in scores)
                    {
                        int size = haystack.Count;
                        for (int i = 0; i < size; i++)
                        {
                            if (needle.Equals(haystack[i]))
                            {
                                Triple t = haystack[i];
                                totalResults.Add(MergeWeighted(needle.Key, new [] { needle.Score, t.Score }, new [] { ratio.GetRatio(needle.Category), ratio.GetRatio(t.Category) }));
                                haystack.Remove(t);
                                size--;
                                lonely = false;
                            }
                        }
                    }
                    if (lonely)
                    {
                        double weightedScore = needle.Score * ratio.GetRatio(needle.Category);
                        totalResults.Add(new ContentObject(needle.Key, weightedScore.ToString()));
                    }
                }
            }
            totalResults.Sort((a, b) => - 1 * a.CompareTo(b));


            return(totalResults);
        }
 protected bool Equals(CategoryRatio other)
 {
     return(guid.Equals(other.guid));
 }