Beispiel #1
0
        public CList <T> Zip(CList <T> secondList)
        {
            int       combinedListCount = count + secondList.count;
            int       j          = 0;
            CList <T> ZippedList = new CList <T>();

            for (int i = 0; i < combinedListCount; i++)
            {
                if (j < count && j < secondList.count)
                {
                    ZippedList.Add(this[j]);
                    i++;
                    ZippedList.Add(secondList[j]);
                }
                else if (j < this.count && j >= secondList.count)
                {
                    ZippedList.Add(this[j]);
                }
                else if (j >= count && j < secondList.count)
                {
                    ZippedList.Add(secondList[j]);
                }
                j++;
            }
            count = combinedListCount;
            return(ZippedList);
        }
Beispiel #2
0
        public CList <T> Zip(CList <T> secondList)
        {
            CList <T> firstList    = this;
            CList <T> combinedList = new CList <T>();

            for (int i = 0; i < secondList.count; i++)
            {
                combinedList.Add(firstList[i]);
                combinedList.Add(secondList[i]);
            }

            return(combinedList);
        }
Beispiel #3
0
        public static CList <T> operator +(CList <T> x, CList <T> y)
        {
            CList <T> Fraction = new CList <T>();

            for (int i = 0; i <= x.Count - 1; i++)
            {
                Fraction.Add(x[i]);
            }
            for (int i = 0; i <= y.Count - 1; i++)
            {
                Fraction.Add(y[i]);
            }
            return(Fraction);
        }
Beispiel #4
0
        public static CList <T> operator-(CList <T> first, CList <T> second)
        {
            CList <T> subtractedList = new CList <T>();

            for (int i = 0; i < second.count; i++)
            {
                for (int j = 0; j < first.count; j++)
                {
                    if (first[j].Equals(second[i]))
                    {
                        first[j] = second[second.count - 1];
                    }
                }
            }
            for (int i = 0; i < first.count; i++)
            {
                if (first[i].Equals(second[second.count - 1]))
                {
                    //do nothing
                }
                else
                {
                    subtractedList.Add(first[i]);
                }
            }
            return(subtractedList);
        }
Beispiel #5
0
        public static CList <T> operator -(CList <T> firstList, CList <T> secondList)
        {
            CList <T> ReducedList = new CList <T>();

            foreach (T input in firstList)
            {
                ReducedList.Add(input);
            }
            foreach (T input in secondList)
            {
                ReducedList.Remove(input);
            }
            return(ReducedList);
        }
Beispiel #6
0
        public static CList <T> operator -(CList <T> x, CList <T> y)
        {
            CList <T> Fraction = new CList <T>();

            for (int i = 0; i <= x.Count - 1; i++)
            {
                for (int j = 0; j <= y.Count - 1; j++)
                {
                    if (!x[i].Equals(y[j]))
                    {
                        Fraction.Add(x[i]);
                    }
                }
            }
            return(Fraction);
        }