lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Francois Halleux" <jfhall...@signant.com>
Subject [Patch] Constructor instead of initialize in PriorityQueue implementations
Date Sat, 27 Dec 2003 20:30:06 GMT
Hello,

	I believe it would be preferable to use a call to super in the subclass of
PriorityQueue.

Patch follows.

KR,

Jean-Fran├žois Halleux

----

Index: java/org/apache/lucene/index/MultipleTermPositions.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/MultipleTerm
Positions.java,v
retrieving revision 1.3
diff -u -r1.3 MultipleTermPositions.java
--- java/org/apache/lucene/index/MultipleTermPositions.java	21 Oct 2003
17:59:16 -0000	1.3
+++ java/org/apache/lucene/index/MultipleTermPositions.java	27 Dec 2003
20:26:14 -0000
@@ -78,7 +78,7 @@
 	TermPositionsQueue(List termPositions)
 	    throws IOException
 	{
-	    initialize(termPositions.size());
+	    super(termPositions.size());

 	    Iterator i = termPositions.iterator();
 	    while (i.hasNext())
Index: java/org/apache/lucene/index/SegmentMergeQueue.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/SegmentMerge
Queue.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 SegmentMergeQueue.java
--- java/org/apache/lucene/index/SegmentMergeQueue.java	18 Sep 2001
16:29:53 -0000	1.1.1.1
+++ java/org/apache/lucene/index/SegmentMergeQueue.java	27 Dec 2003
20:26:14 -0000
@@ -59,7 +59,7 @@

 final class SegmentMergeQueue extends PriorityQueue {
   SegmentMergeQueue(int size) {
-    initialize(size);
+    super(size);
   }

   protected final boolean lessThan(Object a, Object b) {
Index: java/org/apache/lucene/search/HitQueue.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/HitQueue.ja
va,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 HitQueue.java
--- java/org/apache/lucene/search/HitQueue.java	18 Sep 2001 16:29:56 -0000
1.1.1.1
+++ java/org/apache/lucene/search/HitQueue.java	27 Dec 2003 20:26:14 -0000
@@ -58,7 +58,7 @@

 final class HitQueue extends PriorityQueue {
   HitQueue(int size) {
-    initialize(size);
+    super(size);
   }

   protected final boolean lessThan(Object a, Object b) {
Index: java/org/apache/lucene/search/PhraseQueue.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/PhraseQueue
.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 PhraseQueue.java
--- java/org/apache/lucene/search/PhraseQueue.java	18 Sep 2001
16:29:57 -0000	1.1.1.1
+++ java/org/apache/lucene/search/PhraseQueue.java	27 Dec 2003
20:26:15 -0000
@@ -58,7 +58,7 @@

 final class PhraseQueue extends PriorityQueue {
   PhraseQueue(int size) {
-    initialize(size);
+    super(size);
   }

   protected final boolean lessThan(Object o1, Object o2) {
Index: java/org/apache/lucene/util/PriorityQueue.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/util/PriorityQueue
.java,v
retrieving revision 1.5
diff -u -r1.5 PriorityQueue.java
--- java/org/apache/lucene/util/PriorityQueue.java	20 Sep 2003
14:06:47 -0000	1.5
+++ java/org/apache/lucene/util/PriorityQueue.java	27 Dec 2003
20:26:15 -0000
@@ -67,7 +67,7 @@
   protected abstract boolean lessThan(Object a, Object b);

   /** Subclass constructors must call this. */
-  protected final void initialize(int maxSize) {
+  protected PriorityQueue(int maxSize) {
     size = 0;
     int heapSize = maxSize + 1;
     heap = new Object[heapSize];
Index: test/org/apache/lucene/util/TestPriorityQueue.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/test/org/apache/lucene/util/TestPriorityQ
ueue.java,v
retrieving revision 1.4
diff -u -r1.4 TestPriorityQueue.java
--- test/org/apache/lucene/util/TestPriorityQueue.java	11 Sep 2003
12:15:30 -0000	1.4
+++ test/org/apache/lucene/util/TestPriorityQueue.java	27 Dec 2003
20:26:16 -0000
@@ -71,8 +71,7 @@
     {
 	public IntegerQueue(int count)
 	{
-	    super();
-	    initialize(count);
+	    super(count);
 	}

 	protected boolean lessThan(Object a, Object b)


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message