本文整理汇总了C#中Set.iterator方法的典型用法代码示例。如果您正苦于以下问题:C# Set.iterator方法的具体用法?C# Set.iterator怎么用?C# Set.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Set
的用法示例。
在下文中一共展示了Set.iterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: boundary
/**
* Report the boundary of a Set of Simplices.
* The boundary is a Set of facets where each facet is a Set of vertices.
* @return an Iterator for the facets that make up the boundary
*/
public static Set boundary(Set simplexSet)
{
Set theBoundary = new HashSet();
for (Iterator it = simplexSet.iterator(); it.hasNext(); )
{
Simplex simplex = (Simplex)it.next();
for (Iterator otherIt = simplex.facets().iterator(); otherIt.hasNext(); )
{
Set facet = (Set)otherIt.next();
if (theBoundary.contains(facet)) theBoundary.remove(facet);
else theBoundary.add(facet);
}
}
return theBoundary;
}
示例2: update
/* Modification */
/**
* Update by replacing one set of Simplices with another.
* Both sets of simplices must fill the same "hole" in the
* Triangulation.
* @param oldSet set of Simplices to be replaced
* @param newSet set of replacement Simplices
*/
public void update(Set oldSet,
Set newSet)
{
// Collect all simplices neighboring the oldSet
Set allNeighbors = new HashSet();
for (Iterator it = oldSet.iterator(); it.hasNext(); )
allNeighbors.addAll((Set)_neighbors.get((Simplex)it.next()));
// Delete the oldSet
for (Iterator it = oldSet.iterator(); it.hasNext(); )
{
Simplex simplex = (Simplex)it.next();
for (Iterator otherIt = ((Set)_neighbors.get(simplex)).iterator();
otherIt.hasNext(); )
((Set)_neighbors.get(otherIt.next())).remove(simplex);
_neighbors.remove(simplex);
allNeighbors.remove(simplex);
}
// Include the newSet simplices as possible neighbors
allNeighbors.addAll(newSet);
// Create entries for the simplices in the newSet
for (Iterator it = newSet.iterator(); it.hasNext(); )
_neighbors.put((Simplex)it.next(), new HashSet());
// Update all the neighbors info
for (Iterator it = newSet.iterator(); it.hasNext(); )
{
Simplex s1 = (Simplex)it.next();
for (Iterator otherIt = allNeighbors.iterator(); otherIt.hasNext(); )
{
Simplex s2 = (Simplex)otherIt.next();
if (!s1.isNeighbor(s2)) continue;
((Set)_neighbors.get(s1)).add(s2);
((Set)_neighbors.get(s2)).add(s1);
}
}
}