Пример #1
0
        /// <summary>
        /// Returns the number of elements in this enumerator.
        /// </summary>
        public static int Count(this DirectedDynamicGraph.EdgeEnumerator enumerator)
        {
            var c = 0;

            enumerator.Reset();

            while (enumerator.MoveNext())
            {
                c++;
            }
            return(c);
        }
Пример #2
0
        /// <summary>
        /// Moves the enumerator until the given condition is true or throws an exception if the condition is never true.
        /// </summary>
        public static DirectedDynamicGraph.EdgeEnumerator First(this DirectedDynamicGraph.EdgeEnumerator enumerator,
                                                                Func <DirectedDynamicGraph.EdgeEnumerator, bool> stop)
        {
            enumerator.Reset();

            while (enumerator.MoveNext())
            {
                if (stop(enumerator))
                {
                    return(enumerator);
                }
            }
            throw new Exception("No edge found that satisfies the given condition.");
        }