01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.storage.search.implementation;
11:
12: import org.mmbase.storage.search.*;
13:
14: /**
15: * Basic implementation.
16: *
17: * @author Rob van Maris
18: * @version $Id: BasicConstraint.java,v 1.5 2005/10/02 16:18:15 michiel Exp $
19: * @since MMBase-1.7
20: */
21:
22: // this class would logically be abstract, but test-cases are instantiating it.
23: public class BasicConstraint implements Constraint {
24:
25: /** Inverse property. */
26: private boolean inverse = false;
27:
28: /** Default constructor. */
29: protected BasicConstraint() {
30: }
31:
32: /**
33: * Sets inverse.
34: *
35: * @return This <code>BasicConstraint</code> instance.
36: * @param inverse The inverse value.
37: */
38: public BasicConstraint setInverse(boolean inverse) {
39: this .inverse = inverse;
40: return this ;
41: }
42:
43: // javadoc is inherited
44: public boolean isInverse() {
45: return inverse;
46: }
47:
48: // javadoc is inherited
49: public int getBasicSupportLevel() {
50: return SearchQueryHandler.SUPPORT_OPTIMAL;
51: }
52:
53: // javadoc is inherited
54: public boolean equals(Object obj) {
55: // Must be same class (subclasses should override this)!
56: if (obj != null && obj.getClass() == getClass()) {
57: BasicConstraint constraint = (BasicConstraint) obj;
58: return inverse == constraint.isInverse();
59: } else {
60: return false;
61: }
62: }
63:
64: // javadoc is inherited
65: public int hashCode() {
66: return (inverse ? 0 : 107);
67: }
68: }
|