public static bool AnyVisible(this Sensor sensor, IEnumerable <IAspect> aspects)
        {
            if (sensor == null)
            {
                throw new System.ArgumentNullException("sensor");
            }
            if (aspects == null)
            {
                return(false);
            }

            var e = new LightEnumerator <IAspect>(aspects);

            while (e.MoveNext())
            {
                if (e.Current != null && e.Current.IsActive)
                {
                    if (sensor.Visible(e.Current))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #2
0
        public static IEnumerable <T> Append <T>(this IEnumerable <T> lst, T obj)
        {
            var e = new LightEnumerator <T>(lst);

            while (e.MoveNext())
            {
                yield return(e.Current);
            }
            yield return(obj);
        }
Пример #3
0
        public static void AddRange <T>(this ICollection <T> lst, IEnumerable <T> elements)
        {
            //foreach (var e in elements)
            //{
            //    lst.Add(e);
            //}
            var e = new LightEnumerator <T>(elements);

            while (e.MoveNext())
            {
                lst.Add(e.Current);
            }
        }
Пример #4
0
        public static IEnumerable <T> Append <T>(this IEnumerable <T> first, IEnumerable <T> next)
        {
            var e = new LightEnumerator <T>(first);

            while (e.MoveNext())
            {
                yield return(e.Current);
            }
            e = new LightEnumerator <T>(next);
            while (e.MoveNext())
            {
                yield return(e.Current);
            }
        }
Пример #5
0
        public static IEnumerable <T> Append <T>(this IEnumerable <T> lst, T obj)
        {
            //foreach (var o in lst)
            //{
            //    yield return o;
            //}
            var e = new LightEnumerator <T>(lst);

            while (e.MoveNext())
            {
                yield return(e.Current);
            }
            yield return(obj);
        }
Пример #6
0
        public static bool Contains(this IEnumerable lst, object obj)
        {
            //foreach (var o in lst)
            //{
            //    if (Object.Equals(o, obj)) return true;
            //}
            var e = new LightEnumerator(lst);

            while (e.MoveNext())
            {
                if (Object.Equals(e.Current, obj))
                {
                    return(true);
                }
            }
            return(false);
        }