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 step refers to a table in a search request. Several steps may refer to the same table, therefore each step has an unique alias to identify it.
16: * <p>
17: * This corresponds to a table name and alias in SQL SELECT-syntax.
18: *
19: * @author Rob van Maris
20: * @version $Id: Step.java,v 1.5 2007/12/06 08:13:36 michiel Exp $
21: * @since MMBase-1.7
22: */
23: public interface Step {
24: /**
25: * Gets the name of the table referred to by this step.
26: * <p>
27: * This corresponds to a table name in SQL SELECT-syntax.
28: */
29: String getTableName();
30:
31: /**
32: * Gets the alias associated with this step.
33: * <p>
34: * This corresponds to a table alias in SQL SELECT-syntax.
35: */
36: String getAlias();
37:
38: /**
39: * Gets nodenumbers for nodes that must be included in this step.
40: * A null value indicates that no such constraint is applied.
41: * <p>
42: * This corresponds to a "number IN (....)" constraint in SQL SELECT syntax.
43: * <p>
44: * Note that this can also be achieved by using a FieldValueInConstraint on the "number" field.
45: */
46: SortedSet<Integer> getNodes();
47:
48: /**
49: * Adds node to nodes.
50: *
51: * @param nodeNumber The nodenumber of the node.
52: * @return This <code>BasicStep</code> instance.
53: * @throws IllegalArgumentException when an invalid argument is supplied.
54: */
55: public Step addNode(int nodeNumber);
56:
57: /**
58: * Compares this step to the specified object. The result is
59: * <code>true</code> if and only if the argument is a non-null
60: * Step, but not RelationStep, object associated with the same tablename,
61: * using the same alias and including the same nodes.
62: *
63: * @param obj The object to compare with.
64: * @return <code>true</code> if the objects are equal,
65: * <code>false</code> otherwise.
66: * @see RelationStep#equals
67: */
68: public boolean equals(Object obj);
69:
70: // javadoc is inherited
71: public int hashCode();
72:
73: /**
74: * Returns a string representation of this Step.
75: * The string representation has the form
76: * "Step(tablename:<tablename>, alias:<alias>, nodes:<nodes>)"
77: * where
78: * <ul>
79: * <li><em><tablename></em> is the tablename returnedby
80: * {@link #getTableName getTableName()}
81: * <li><em><alias></em> is the alias returned by {@link #getAlias getAlias()}
82: * <li><em><nodes></em> is the string representation of the ordered list
83: * of nodenumbers returned by {@link #getNodes getNodes()}
84: * </ul>
85: *
86: * @return A string representation of this Step.
87: */
88: public String toString();
89:
90: }
|