Example #1
0
        public virtual Lot <T> Rotate <T>(
            IEnumerable <T> finiteSource,
            int cycles,
            bool goRight = truth)
        {
            var ll = new LinkedListLot <T>();

            if (finiteSource == null)
            {
                return(ll);
            }

            foreach (var item in finiteSource)
            {
                ll.AddLast(item);
            }

            const byte
                zero    = 0,
                one     = 1;
            Lot <T> lot = ll;

            if (lot.Count < one)
            {
                return(lot);
            }

            if (goRight)
            {
                for (int i = zero; i < cycles; ++i)
                {
                    var node = ll.Last;
                    ll.RemoveLast();
                    ll.AddFirst(node);
                }

                return(lot);
            }

            for (int i = zero; i < cycles; ++i)
            {
                var node = ll.First;
                ll.RemoveFirst();
                ll.AddLast(node);
            }

            return(lot);
        }
        public virtual Lot <T> Repeat <T>(
            IEnumerable <T> source,
            int times)
        {
            const byte
                zero       = 0,
                one        = 1;
            var collection = new LinkedListLot <T>();

            if (source == null)
            {
                return(collection);
            }

            if (times < one)
            {
                return(collection);
            }

            foreach (var item in source)
            {
                collection.AddLast(item);
            }

            var result = new ListLot <T>();

            for (int i = zero; i < times; ++i)
            {
                result.AddRange(collection);
            }

            return(result);
        }
Example #3
0
        public virtual Lot <T> Connect <T>(
            params IEnumerable <T>[] finiteSources)
        {
            var connection = new LinkedListLot <T>();

            if (finiteSources == null)
            {
                return(connection);
            }

            const byte zero = 0;
            var        l    = finiteSources.Length;

            for (int sourceIndex = zero;
                 sourceIndex < l;
                 ++sourceIndex)
            {
                var source = finiteSources[sourceIndex];
                if (source == null)
                {
                    continue;
                }

                using (var e = source.GetEnumerator())
                {
                    while (e?.MoveNext() ?? false)
                    {
                        connection.AddLast(e.Current);
                    }
                }
            }

            return(connection);
        }
Example #4
0
        public override Lot <string> LocatorNames()
        {
            var lll = new LinkedListLot <string>();

            foreach (var locatorName in EH.Select(
                         this.locators,
                         locatorHolder => locatorHolder?.Name))
            {
                lll.AddLast(
                    locatorName);
            }

            return(lll);
        }
Example #5
0
        public override Lot <string> LeechNames()
        {
            var lll = new LinkedListLot <string>();

            foreach (var leechName in EH.Select(
                         this.leeches,
                         leechHolder => leechHolder?.Name))
            {
                lll.AddLast(
                    leechName);
            }

            return(lll);
        }
Example #6
0
        public override Lot <string> ManagerNames()
        {
            var lll = new LinkedListLot <string>();

            foreach (var managerName in EH.Select(
                         this.managers,
                         nmh => nmh?.Name))
            {
                lll.AddLast(
                    managerName);
            }

            return(lll);
        }
Example #7
0
        public override Lot <string> WebNames()
        {
            var lll = new LinkedListLot <string>();

            lock (this.locker)
            {
                foreach (var webName in EH.Select(
                             this.webs,
                             webHolder => webHolder?.Name))
                {
                    lll.AddLast(
                        webName);
                }
            }

            return(lll);
        }
Example #8
0
        public virtual Lot <string> ManagerNames()
        {
            var lll = new LinkedListLot <string>();

            lock (this.locker)
            {
                foreach (var managerName in EH.Select(
                             this.managers,
                             nmh => nmh?.Name))
                {
                    lll.AddLast(
                        managerName);
                }
            }

            return(lll);
        }
Example #9
0
        public virtual Lot <string> LocatorNames()
        {
            var lll = new LinkedListLot <string>();

            lock (this.locker)
            {
                foreach (var locatorName in EH.Select(
                             this.locators,
                             locatorHolder => locatorHolder?.Name))
                {
                    lll.AddLast(
                        locatorName);
                }
            }

            return(lll);
        }