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;
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.5 2007/12/06 08:13:36 michiel 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[] LOGICAL_OPERATOR_DESCRIPTIONS = new String[] {
35: null, // not specified
36: "or", "and" };
37:
38: /**
39: * Gets the child constraints.
40: */
41: List<Constraint> getChilds();
42:
43: /**
44: * Gets the logical operator used to combine the child constraints. This must be either LOGICAL_AND or LOGICAL_OR.
45: */
46: int getLogicalOperator();
47:
48: /**
49: * Compares this constraint to the specified object. The result is
50: * <code>true</code> if and only if the argument is a non-null
51: * CompositeConstraint object representing the same constraint(s).
52: *
53: * @param obj The object to compare with.
54: * @return <code>true</code> if the objects are equal,
55: * <code>false</code> otherwise.
56: */
57: public boolean equals(Object obj);
58:
59: // javadoc is inherited
60: public int hashCode();
61:
62: /**
63: * Returns a string representation of this CompositeConstraint.
64: * The string representation has the form
65: * "CompositeConstraint(inverse:<:inverse>, operator:<operator>,
66: * childs:<childs>)"
67: * where
68: * <ul>
69: * <li><em><inverse></em>is the value returned by
70: * {@link #isInverse isInverse()}
71: * <li><em><operator></em> is the value returned by
72: * {@link #getLogicalOperator getLogicalOperator()}
73: * <li><em><childs></em> is the value returned by
74: * {@link #getChilds getChilds()}
75: * </ul>
76: *
77: * @return A string representation of this CompositeConstraint.
78: */
79: public String toString();
80:
81: }
|