1 56 57 package org.jdom.filter; 58 59 66 final class NegateFilter extends AbstractFilter { 67 68 private static final String CVS_ID = 69 "@(#) $RCSfile: NegateFilter.java,v $ $Revision: 1.3 $ $Date: 2004/02/06 09:28:31 $"; 70 71 private Filter filter; 73 74 79 public NegateFilter(Filter filter) { 80 this.filter = filter; 81 } 82 83 public boolean matches(Object obj) { 84 return !filter.matches(obj); 85 } 86 87 public Filter negate() { 88 return filter; 89 } 90 91 public boolean equals(Object obj) { 92 if (this == obj) { 93 return true; 94 } 95 96 if (obj instanceof NegateFilter) { 97 return filter.equals(((NegateFilter) obj).filter); 98 } 99 return false; 100 } 101 102 public int hashCode() { 103 return ~filter.hashCode(); 104 } 105 106 public String toString() { 107 return new StringBuffer (64) 108 .append("[NegateFilter: ") 109 .append(filter.toString()) 110 .append("]") 111 .toString(); 112 } 113 } 114 | Popular Tags |