Removed InterfaceRestriction. Now introduced a friendlier API in
[utils] / system / general / src / main / java / org / wamblee / system / graph / Graph.java
index 387d5e4fd3ffc563d2690495078602d9928ccd6c..0e4f6ccb0b28c82020ed8dd0e17b8aab5c5f3164 100644 (file)
@@ -16,6 +16,7 @@
 package org.wamblee.system.graph;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -174,6 +175,18 @@ public class Graph {
             }
         }
     }
+    
+    /**
+     * Applies a filter to the graph for removing elements. 
+     * @param aFilter Filter to apply. 
+     */
+    public void applyFilter(EdgeFilter aFilter) {
+        for (Iterator<Edge> edge = _edges.iterator(); edge.hasNext(); ) { 
+            if (aFilter.isViolated(edge.next())) { 
+                edge.remove();
+            }
+        }
+    }
 
     /**
      * Finds all outgoing edges of a node. More specifically, finds