001/** 002 * Equal.java 003 * jCOLIBRI2 framework. 004 * @author Juan A. Recio-Garc�a. 005 * GAIA - Group for Artificial Intelligence Applications 006 * http://gaia.fdi.ucm.es 007 * 28/10/2007 008 */ 009package es.ucm.fdi.gaia.jcolibri.method.retrieve.FilterBasedRetrieval.predicates; 010 011 012import es.ucm.fdi.gaia.jcolibri.exception.NoApplicableFilterPredicateException; 013 014/** 015 * Predicate that compares if the case object is different to a fixed value. 016 * @author Juan A. Recio-Garcia 017 * @author Developed at University College Cork (Ireland) in collaboration with Derek Bridge. 018 * @version 1.0 019 * @see FilterBasedRetrievalMethod 020 * @see FilterConfig 021 */ 022public class NotEqualTo implements FilterPredicate 023{ 024 private Object fqo; 025 026 public NotEqualTo(Object fixedQueryObject) 027 { 028 fqo = fixedQueryObject; 029 } 030 031 public boolean compute(Object caseObject, Object queryObject) throws NoApplicableFilterPredicateException { 032 if((caseObject == null)&&(fqo==null)) 033 return false; 034 else if(caseObject == null) 035 return false; 036 else if(fqo == null) 037 return true; 038 else 039 return !caseObject.equals(fqo); 040 } 041 042}