KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > CompositeConstraint


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;
11
12 import java.util.*;
13
14 /**
15  * A constraint combining several child constraints, using either logical AND or OR.
16  * <p>
17  * This corresponds to a AND- or OR-expression in SQL SELECT-syntax.
18  *
19  * @author Rob van Maris
20  * @version $Id: CompositeConstraint.java,v 1.3 2005/04/25 14:56:57 pierre Exp $
21  * @since MMBase-1.7
22  */

23 public interface CompositeConstraint extends Constraint {
24
25     /** Logical operator 'and' */
26     public final static int LOGICAL_AND = 2;
27     /** Logical operator 'or' */
28     public final static int LOGICAL_OR = 1;
29
30     /**
31      * Operator descriptions corresponding to the operator values:
32      * {@link #LOGICAL_AND}, and {@link #LOGICAL_OR}
33      */

34     public final static String JavaDoc[] LOGICAL_OPERATOR_DESCRIPTIONS = new String JavaDoc[] {
35          null, // not specified
36
"or",
37          "and"
38     };
39     /**
40      * Gets the child constraints.
41      */

42     List getChilds();
43
44     /**
45      * Gets the logical operator used to combine the child constraints. This must be either LOGICAL_AND or LOGICAL_OR.
46      */

47     int getLogicalOperator();
48
49     /**
50      * Compares this constraint to the specified object. The result is
51      * <code>true</code> if and only if the argument is a non-null
52      * CompositeConstraint object representing the same constraint(s).
53      *
54      * @param obj The object to compare with.
55      * @return <code>true</code> if the objects are equal,
56      * <code>false</code> otherwise.
57      */

58     public boolean equals(Object JavaDoc obj);
59
60     // javadoc is inherited
61
public int hashCode();
62
63     /**
64      * Returns a string representation of this CompositeConstraint.
65      * The string representation has the form
66      * "CompositeConstraint(inverse:&lt:inverse&gt;, operator:&lt;operator&gt;,
67      * childs:&lt;childs&gt;)"
68      * where
69      * <ul>
70      * <li><em>&lt;inverse&gt;</em>is the value returned by
71      * {@link #isInverse isInverse()}
72      * <li><em>&lt;operator&gt;</em> is the value returned by
73      * {@link #getLogicalOperator getLogicalOperator()}
74      * <li><em>&lt;childs&gt;</em> is the value returned by
75      * {@link #getChilds getChilds()}
76      * </ul>
77      *
78      * @return A string representation of this CompositeConstraint.
79      */

80     public String JavaDoc toString();
81
82     /** @link dependency
83      * @label child
84      * @supplierRole **/

85     /*#Constraint lnkConstraint;*/
86 }
87
Popular Tags