当前位置: 首页>>代码示例>>C#>>正文


C# IEdgePredicate.Test方法代码示例

本文整理汇总了C#中IEdgePredicate.Test方法的典型用法代码示例。如果您正苦于以下问题:C# IEdgePredicate.Test方法的具体用法?C# IEdgePredicate.Test怎么用?C# IEdgePredicate.Test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEdgePredicate的用法示例。


在下文中一共展示了IEdgePredicate.Test方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveOutEdgeIf

        /// <summary>
        /// Remove all the out-edges of vertex u for which the predicate pred 
        /// returns true.
        /// </summary>
        /// <param name="u">vertex</param>
        /// <param name="pred">edge predicate</param>
        public virtual void RemoveOutEdgeIf(IVertex u, IEdgePredicate pred)
        {
            if (u==null)
                throw new ArgumentNullException("vertex u");
            if (pred == null)
                throw new ArgumentNullException("predicate");

            EdgeCollection edges = VertexOutEdges[u];
            EdgeCollection removedEdges = new EdgeCollection();
            foreach(IEdge e in edges)
                if (pred.Test(e))
                    removedEdges.Add(e);

            foreach(IEdge e in removedEdges)
                RemoveEdge(e);
        }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:22,代码来源:PetriGraph.cs

示例2: RemoveEdgeIf

        /// <summary>
        /// Remove all the edges from graph g for which the predicate pred
        /// returns true.
        /// </summary>
        /// <param name="pred">edge predicate</param>
        public virtual void RemoveEdgeIf(IEdgePredicate pred)
        {
            if (pred == null)
                throw new ArgumentNullException("predicate");

            // marking edge for removal
            EdgeCollection removedEdges = new EdgeCollection();
            foreach(IEdge e in Edges)
            {
                if (pred.Test(e))
                    removedEdges.Add(e);
            }

            // removing edges
            foreach(IEdge e in removedEdges)
                RemoveEdge(e);
        }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:22,代码来源:PetriGraph.cs

示例3: RemoveInEdgeIf

 public void RemoveInEdgeIf(IVertex u, IEdgePredicate pred)
 {
     if (u == null)
     {
         throw new ArgumentNullException("vertex u");
     }
     if (pred == null)
     {
         throw new ArgumentNullException("predicate");
     }
     EdgeCollection edges = this.VertexInEdges.get_Item(u);
     EdgeCollection edges2 = new EdgeCollection();
     EdgeCollection.Enumerator enumerator = edges.GetEnumerator();
     while (enumerator.MoveNext())
     {
         IEdge edge = enumerator.get_Current();
         if (pred.Test(edge))
         {
             edges2.Add(edge);
         }
     }
     EdgeCollection.Enumerator enumerator2 = edges2.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         IEdge e = enumerator2.get_Current();
         this.RemoveEdge(e);
     }
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:28,代码来源:BidirectionalGraph.cs

示例4: RemoveEdgeIf

 public virtual void RemoveEdgeIf(IEdgePredicate pred)
 {
     if (pred == null)
     {
         throw new ArgumentNullException("predicate");
     }
     EdgeCollection edges = new EdgeCollection();
     VertexEdgesEnumerator enumerator = this.Edges.GetEnumerator();
     while (enumerator.MoveNext())
     {
         IEdge edge = enumerator.get_Current();
         if (pred.Test(edge))
         {
             edges.Add(edge);
         }
     }
     EdgeCollection.Enumerator enumerator2 = edges.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         IEdge e = enumerator2.get_Current();
         this.RemoveEdge(e);
     }
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:23,代码来源:AdjacencyGraph.cs

示例5: RemoveOutEdgeIf

        /// <summary>
        /// Remove all the out-edges of vertex u for which the predicate pred 
        /// returns true.
        /// </summary>
        /// <param name="u">vertex</param>
        /// <param name="pred">edge predicate</param>
        public virtual void RemoveOutEdgeIf(DataTableVertex u, IEdgePredicate pred)
        {
            if (u==null)
                throw new ArgumentNullException("u");
            if (pred == null)
                throw new ArgumentNullException("pred");

            DataRelationEdgeCollection edges = this.vertexOutEdges[u];
            DataRelationEdgeCollection removedEdges = new DataRelationEdgeCollection();
            foreach(DataRelationEdge e in edges)
            {
                if (pred.Test(e))
                    removedEdges.Add(e);
            }

            foreach(DataRelationEdge e in removedEdges)
                this.RemoveEdge(e);
        }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:24,代码来源:DataGraph.cs

示例6: RemoveInEdgeIf

        /// <summary>
        /// Remove all the out-edges of vertex u for which the predicate pred 
        /// returns true.
        /// </summary>
        /// <param name="u">vertex</param>
        /// <param name="pred">edge predicate</param>
        public void RemoveInEdgeIf(Vertex u, IEdgePredicate pred)
        {
            if (u==null)
                throw new ArgumentNullException("vertex u");
            if (pred == null)
                throw new ArgumentNullException("predicate");

            EdgeCollection edges = this.vertexInEdges[u];
            EdgeCollection removedEdges = new EdgeCollection();
            foreach(Edge e in edges)
            {
                if (pred.Test(e))
                    removedEdges.Add(e);
            }

            foreach(Edge e in removedEdges)
                this.RemoveEdge(e);
        }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:24,代码来源:CustomAdjacencyGraph.cs


注:本文中的IEdgePredicate.Test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。