lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject RE: [Patch] Constructor instead of initialize in PriorityQueue implementations
Date Fri, 23 Jan 2004 16:07:49 GMT
Hello,

I'm not sure if anyone followed up on this.
It looks like me that initialize(int) is the right thing to call.
I also don't even see q PriorityQueue constructor that takes an int
parameter, so I am not sure if the code would compile after this patch.

Otis

--- liu ji <liujiboy@hotmail.com> wrote:
> I quite agree with you.The document said subclass constructors must
> call 
> initialize.And initialize is a protected method. 
> It seems initialize method can't be accessed by other method except
> the 
> subclass constructor.
> I don't think it is necessary to initialize a queue after the queue
> is 
> constructed. 
> Is there any queue need a method which reinitialize the queue?
> 
> 
> 
> >From: "Jean-Francois Halleux" <jfhalleux@signant.com>
> >Reply-To: <jfhalleux@signant.com>
> >To: <lucene-dev@jakarta.apache.org>
> >Subject: [Patch] Constructor instead of initialize in PriorityQueue 
> implementations
> >Date: Sat, 27 Dec 2003 21:30:06 +0100
> >
> >Hello,
> >
> >	I believe it would be preferable to use a call to super in the
> subclass 
> of
> >PriorityQueue.
> >
> >Patch follows.
> >
> >KR,
> >
> >Jean-Fran鏾is 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
> >
> 
> _________________________________________________________________
> 与联机的朋友进行交流,请使用 MSN Messenger: 
> http://messenger.msn.com/cn  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

---------------------------------------------------------------------
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