本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}