KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > implementation > BasicConstraint


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

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      * Sets inverse.
33      *
34      * @return This <code>BasicConstraint</code> instance.
35      * @param inverse The inverse value.
36      */

37     public BasicConstraint setInverse(boolean inverse) {
38         this.inverse = inverse;
39         return this;
40     }
41
42     // javadoc is inherited
43
public boolean isInverse() {
44         return inverse;
45     }
46
47     // javadoc is inherited
48
public int getBasicSupportLevel() {
49         return SearchQueryHandler.SUPPORT_OPTIMAL;
50     }
51
52     // javadoc is inherited
53
public boolean equals(Object JavaDoc obj) {
54         // Must be same class (subclasses should override this)!
55
if (obj != null && obj.getClass() == getClass()) {
56             BasicConstraint constraint = (BasicConstraint) obj;
57             return inverse == constraint.isInverse();
58         } else {
59             return false;
60         }
61     }
62
63     // javadoc is inherited
64
public int hashCode() {
65         return (inverse? 0: 107);
66     }
67 }
68
Popular Tags