1 19 20 package soot.jimple.toolkits.callgraph; 21 import soot.*; 22 import soot.util.queue.*; 23 import java.util.*; 24 25 29 public class Filter implements Iterator 30 { 31 private Iterator source; 32 private EdgePredicate pred; 33 private Edge next = null; 34 public Filter( EdgePredicate pred ) { 35 this.pred = pred; 36 } 37 public Iterator wrap( Iterator source ) { 38 this.source = source; 39 advance(); 40 return this; 41 } 42 private void advance() { 43 while( source.hasNext() ) { 44 next = (Edge) source.next(); 45 if( pred.want( next ) ) { 46 return; 47 } 48 } 49 next = null; 50 } 51 public boolean hasNext() { 52 return next != null; 53 } 54 public Object next() { 55 Object ret = next; 56 advance(); 57 return ret; 58 } 59 public void remove() { 60 throw new UnsupportedOperationException (); 61 } 62 } 63 64 | Popular Tags |