public void Measure(IVertexEnumerable vertices) { if (vertices == null) { throw new ArgumentNullException("vertices"); } this.Clear(); int num = 0; IVertexEnumerator enumerator = vertices.GetEnumerator(); while (enumerator.MoveNext()) { VertexIntDictionary dictionary; IVertex vertex2; IVertex vertex = enumerator.get_Current(); if (this.passCounts.get_Item(vertex) == 0) { num++; } (dictionary = this.passCounts).set_Item(vertex2 = vertex, dictionary.get_Item(vertex2) + 1); } if (this.graph.get_VerticesEmpty()) { this.coverage = 0.0; } else { this.coverage = ((double) num) / ((double) this.graph.get_VerticesCount()); } }
/// <summary> /// Returns the first vertex of the enumerable /// </summary> /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param> /// <returns>first vertex if any, otherwise a null reference</returns> public static IVertex LastVertex(IVertexEnumerable vertices) { if (vertices == null) { throw new ArgumentNullException("vertices"); } IVertexEnumerator en = vertices.GetEnumerator(); IVertex current = null; while (en.MoveNext()) { current = en.Current; } return(current); }
/// <summary> /// Returns the first vertex of the enumerable /// </summary> /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param> /// <returns>first vertex if any, otherwise a null reference</returns> public static IVertex FirstVertex(IVertexEnumerable vertices) { if (vertices == null) { throw new ArgumentNullException("vertices"); } IVertexEnumerator en = vertices.GetEnumerator(); if (!en.MoveNext()) { return(null); } else { return(en.Current); } }
/// <summary> /// Returns the first vertex of the enumerable that matches the predicate. /// </summary> /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param> /// <param name="pred">vertex predicate</param> /// <returns>first vertex if any, otherwise a null reference</returns> public static IVertex FirstVertexIf(IVertexEnumerable vertices, IVertexPredicate pred) { if (vertices == null) { throw new ArgumentNullException("vertices"); } if (pred == null) { throw new ArgumentNullException("pred"); } IVertexEnumerator en = vertices.GetEnumerator(); while (en.MoveNext()) { if (pred.Test(en.Current)) { return(en.Current); } } return(null); }
/// <summary> /// Returns the first vertex of the enumerable /// </summary> /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param> /// <returns>first vertex if any, otherwise a null reference</returns> public static IVertex FirstVertex(IVertexEnumerable vertices) { if (vertices==null) throw new ArgumentNullException("vertices"); IVertexEnumerator en = vertices.GetEnumerator(); if (!en.MoveNext()) return null; else return en.Current; }
/// <summary> /// Returns the first vertex of the enumerable /// </summary> /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param> /// <returns>first vertex if any, otherwise a null reference</returns> public static IVertex LastVertex(IVertexEnumerable vertices) { if (vertices==null) throw new ArgumentNullException("vertices"); IVertexEnumerator en = vertices.GetEnumerator(); IVertex current = null; while(en.MoveNext()) { current = en.Current; } return current; }
/// <summary> /// Returns the first vertex of the enumerable that matches the predicate. /// </summary> /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param> /// <param name="pred">vertex predicate</param> /// <returns>first vertex if any, otherwise a null reference</returns> public static IVertex FirstVertexIf(IVertexEnumerable vertices, IVertexPredicate pred) { if (vertices==null) throw new ArgumentNullException("vertices"); if (pred==null) throw new ArgumentNullException("pred"); IVertexEnumerator en = vertices.GetEnumerator(); while(en.MoveNext()) { if (pred.Test(en.Current)) return en.Current; } return null; }