Update of /var/cvs/src/org/mmbase/storage/search/implementation
In directory james.mmbase.org:/tmp/cvs-serv13541/implementation
Modified Files:
BasicRelationStep.java BasicSearchQuery.java BasicStep.java
Log Message:
MMB-1682. Made getNodes return null as advertised in javadoc
See also:
http://cvs.mmbase.org/viewcvs/src/org/mmbase/storage/search/implementation
See also: http://www.mmbase.org/jira/browse/MMB-1682
Index: BasicRelationStep.java
===================================================================
RCS file:
/var/cvs/src/org/mmbase/storage/search/implementation/BasicRelationStep.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- BasicRelationStep.java 16 Oct 2006 12:56:57 -0000 1.12
+++ BasicRelationStep.java 17 Jul 2008 12:55:23 -0000 1.13
@@ -20,7 +20,7 @@
* The directionality property defaults to DIRECTIONS_BOTH.
*
* @author Rob van Maris
- * @version $Id: BasicRelationStep.java,v 1.12 2006/10/16 12:56:57 pierre Exp $
+ * @version $Id: BasicRelationStep.java,v 1.13 2008/07/17 12:55:23 michiel Exp
$
* @since MMBase-1.7
*/
public class BasicRelationStep extends BasicStep implements RelationStep {
@@ -163,7 +163,7 @@
RelationStep step = (RelationStep) obj;
return getTableName().equals(step.getTableName())
&& (alias != null ? alias.equals(step.getAlias()) :
step.getAlias() == null)
- && getNodes().equals(step.getNodes())
+ && (nodes == null ? step.getNodes() == null :
nodes.equals(step.getNodes()))
&& step.getDirectionality() == directionality
&& (role == null? step.getRole() == null:
role.equals(step.getRole()));
} else {
@@ -175,7 +175,7 @@
public int hashCode() {
return 41 * (getTableName().hashCode()
+ 43 * ( (alias != null ? alias.hashCode() : 0)
- + 47 * (getNodes().hashCode()
+ + 47 * (nodes == null ? 1 : nodes.hashCode()
+ 113 * (directionality
+ 31 * (role != null ?
role.intValue() : 0)))));
}
Index: BasicSearchQuery.java
===================================================================
RCS file:
/var/cvs/src/org/mmbase/storage/search/implementation/BasicSearchQuery.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- BasicSearchQuery.java 22 Feb 2008 12:28:19 -0000 1.45
+++ BasicSearchQuery.java 17 Jul 2008 12:55:23 -0000 1.46
@@ -23,7 +23,7 @@
* Basic implementation.
*
* @author Rob van Maris
- * @version $Id: BasicSearchQuery.java,v 1.45 2008/02/22 12:28:19 michiel Exp $
+ * @version $Id: BasicSearchQuery.java,v 1.46 2008/07/17 12:55:23 michiel Exp $
* @since MMBase-1.7
*/
public class BasicSearchQuery implements SearchQuery, Cloneable {
@@ -155,25 +155,28 @@
newRelationStep.setCheckedDirectionality(relationStep.getCheckedDirectionality());
newRelationStep.setRole(relationStep.getRole());
newRelationStep.setAlias(relationStep.getAlias());
- Iterator<Integer> j = relationStep.getNodes().iterator();
- while (j.hasNext()) {
- newRelationStep.addNode( j.next().intValue());
+ if (relationStep.getNodes() != null) {
+ for (Integer j : relationStep.getNodes()) {
+ newRelationStep.addNode(j);
+ }
}
BasicStep next = (BasicStep) relationStep.getNext();
BasicStep newNext = (BasicStep) newRelationStep.getNext();
newNext.setAlias(next.getAlias());
- j = next.getNodes().iterator();
- while (j.hasNext()) {
- newNext.addNode( j.next().intValue());
+ if (next.getNodes() != null) {
+ for (Integer j : next.getNodes()) {
+ newNext.addNode(j);
+ }
}
i.next(); // dealt with that already
} else {
BasicStep newStep =
addStep(mmb.getBuilder(step.getTableName()));
newStep.setAlias(step.getAlias());
- Iterator<Integer> j = step.getNodes().iterator();
- while (j.hasNext()) {
- newStep.addNode( j.next().intValue());
+ if (step.getNodes() != null) {
+ for (Integer j : step.getNodes()) {
+ newStep.addNode(j);
+ }
}
}
}
Index: BasicStep.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/storage/search/implementation/BasicStep.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- BasicStep.java 11 Feb 2007 19:21:12 -0000 1.12
+++ BasicStep.java 17 Jul 2008 12:55:23 -0000 1.13
@@ -18,7 +18,7 @@
* The step alias is not set on default.
*
* @author Rob van Maris
- * @version $Id: BasicStep.java,v 1.12 2007/02/11 19:21:12 nklasens Exp $
+ * @version $Id: BasicStep.java,v 1.13 2008/07/17 12:55:23 michiel Exp $
* @since MMBase-1.7
*/
public class BasicStep implements Step {
@@ -31,7 +31,7 @@
* Nodenumber set for nodes to be included (ordered
* using integer comparison).
*/
- protected SortedSet<Integer> nodes = new TreeSet<Integer>();
+ protected SortedSet<Integer> nodes = null;
/**
* Constructor.
*
@@ -73,6 +73,7 @@
if (nodeNumber < 0) {
throw new IllegalArgumentException("Invalid nodeNumber value: " +
nodeNumber);
}
+ if (nodes == null) nodes = new TreeSet<Integer>();
nodes.add(nodeNumber);
return this;
}
@@ -98,7 +99,7 @@
// javadoc is inherited
public SortedSet<Integer> getNodes() {
- return Collections.unmodifiableSortedSet(nodes);
+ return nodes == null ? null : Collections.unmodifiableSortedSet(nodes);
}
// javadoc is inherited
@@ -110,7 +111,7 @@
Step step = (Step) obj;
return getTableName().equals(step.getTableName())
&& (alias == null ? step.getAlias() == null :
alias.equals(step.getAlias()))
- && nodes.equals(step.getNodes());
+ && (nodes == null ? step.getNodes() == null :
nodes.equals(step.getNodes()));
} else {
return false;
}
@@ -119,7 +120,7 @@
// javadoc is inherited
public int hashCode() {
return 41 * builder.getTableName().hashCode()
- + (alias == null? 0: 43 * alias.hashCode()) + 47 * nodes.hashCode();
+ + (alias == null? 0: 43 * alias.hashCode()) + 47 * (nodes == null
? 1 : nodes.hashCode());
}
// javadoc is inherited
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs