1 package prefuse.data.expression; 2 3 import java.util.Iterator ; 4 5 import prefuse.data.Tuple; 6 7 12 public class AndPredicate extends CompositePredicate { 13 14 18 public AndPredicate() { 19 } 20 21 25 public AndPredicate(Predicate p1) { 26 add(p1); 27 } 28 29 34 public AndPredicate(Predicate p1, Predicate p2) { 35 super(p1, p2); 36 } 37 38 41 public boolean getBoolean(Tuple t) { 42 if ( m_clauses.size() == 0 ) 43 return false; 44 45 Iterator iter = m_clauses.iterator(); 46 while ( iter.hasNext() ) { 47 Predicate p = (Predicate)iter.next(); 48 if ( !p.getBoolean(t) ) { 49 return false; 50 } 51 } 52 return true; 53 } 54 55 58 public String toString() { 59 return ( size() == 0 ? "FALSE" : toString("AND") ); 60 } 61 62 } | Popular Tags |