package net.toodarkpark.util.comparison; import java.util.*; import org.apache.commons.collections.Predicate; /* * NotPredicate is a implementation of Predicate that contains a single Predicate object, reversing its * return value. useful for eg "q = new NotPredicate( new InPredicate( listOfBadValues ) );" * which corresponds to SQL's "NOT IN (list)". */ public class NotPredicate implements Predicate { protected Predicate qualifier; private NotPredicate() { super(); qualifier = null; } public NotPredicate( Predicate aPredicate ) { this(); qualifier = aPredicate; } public boolean evaluate( Object obj ) { // negate whatever's returned return !qualifier.evaluate( obj ); } }