Esempio n. 1
0
        //TO DO: hard coded right now for 2 lists, generalize this to take any amount
        //of lists that coincides with the number of users in the party
        //NOTE: *** Can be done with use of params[] List<T> then indexing list number in function ***
        public void Comparator(List <string> Stef, List <string> Chris)
        {
            //Creates temporary combined list of songs to be used later in function
            var FullList = new List <string>();

            FullList.AddRange(Stef);
            FullList.AddRange(Chris);

            //Creates list of unmatched items: Target0
            var Target0        = new List <string>();
            var firstNotSecond = Stef.Except(Chris).ToList();
            var secondNotFirst = Chris.Except(Stef).ToList();

            Target0.AddRange(firstNotSecond);
            Target0.AddRange(secondNotFirst);

            var Target1 = FullList.Except(Target0).ToList();

            //List of Songs that match(1) and do not match(0) with 1's being first in the list
            TargetList.AddRange(Target1);
            TargetList.AddRange(Target0);

            var partition = Partition <string>(TargetList, 100);

            //Creates comma separated list of Ids to be used in GetFeatures function
            foreach (var item in partition)
            {
                TargetListIds.Add(string.Join(',', item.Select(e => e)));
            }

            //Adds to List of Target values that corresponds with the order of TargetList
            TargetValues.AddRange(Enumerable.Repeat(1, Target1.Count()));
            TargetValues.AddRange(Enumerable.Repeat(0, Target0.Count()));
        }