You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by mi...@apache.org on 2009/07/27 12:02:34 UTC

svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Author: mikemccand
Date: Mon Jul 27 10:02:34 2009
New Revision: 798091

URL: http://svn.apache.org/viewvc?rev=798091&view=rev
Log:
LUCENE-1754: add EmptyDocIdSetIterator

Added:
    lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java   (with props)

Added: lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java?rev=798091&view=auto
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java (added)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java Mon Jul 27 10:02:34 2009
@@ -0,0 +1,42 @@
+package org.apache.lucene.search;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+
+/**
+ * An empty implementation for {@link DocIdSetIterator}. This can be used by
+ * classes which receive a null {@link DocIdSet} from
+ * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
+ */
+public final class EmptyDocIdSetIterator extends DocIdSetIterator {
+
+  private static final DocIdSetIterator instance = new EmptyDocIdSetIterator();
+  
+  public static DocIdSetIterator getInstance() { return instance; }
+  
+  // to prevent instantiation
+  private EmptyDocIdSetIterator() { }
+  
+  public int advance(int target) throws IOException { return NO_MORE_DOCS; }
+  
+  public int docID() { return NO_MORE_DOCS; }
+  
+  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
+  
+}

Propchange: lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native



RE: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Uwe Schindler <uw...@thetaphi.de>.
I don't understand that. If you need an empty iterator, call:

 

DocIdSet.EMPTY_DOCIDSET.iterator()

 

- bingo. This is always empty.

 

Uwe

 

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
 <http://www.thetaphi.de> http://www.thetaphi.de
eMail: uwe@thetaphi.de

  _____  

From: Shai Erera [mailto:serera@gmail.com] 
Sent: Monday, July 27, 2009 12:29 PM
To: java-dev@lucene.apache.org
Subject: Re: svn commit: r798091 -
/lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.j
ava

 

I don't see this class in DISI. I created it for classes that get a null
iterator, but need to have some iterator to work w/, so now they can use
EmptyDISI.

It not like DocIdSet.EMPTY_DOCIDSET. While the latter allows an impl to
return EMPTY as its DocIdSet, the EmptyDISI is for instantiation by code
which received a null iterator. Sometimes the iterator will be null, and the
DocIdSet itself won't "know" that until its iterator() is called. Also,
instead of fixing all Filter impls to check if the DIS's iterator will be
null then return DIS.EMPTY, I think this is a useful class in and on itself.

Shai

On Mon, Jul 27, 2009 at 1:18 PM, Uwe Schindler <uw...@thetaphi.de> wrote:

Why do we need this class? There is already a static final empty iterator
available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something like
that name)?

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> From: mikemccand@apache.org [mailto:mikemccand@apache.org]
> Sent: Monday, July 27, 2009 12:03 PM
> To: java-commits@lucene.apache.org
> Subject: svn commit: r798091 -
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> .java
>
> Author: mikemccand
> Date: Mon Jul 27 10:02:34 2009
> New Revision: 798091
>
> URL: http://svn.apache.org/viewvc?rev=798091
<http://svn.apache.org/viewvc?rev=798091&view=rev> &view=rev
> Log:
> LUCENE-1754: add EmptyDocIdSetIterator
>
> Added:
>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java   (with props)
>
> Added:
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java
> URL:
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> search/EmptyDocIdSetIterator.java?rev=798091&view=auto
> ==========================================================================
> ====
> ---
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java (added)
> +++
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java Mon Jul 27 10:02:34 2009
> @@ -0,0 +1,42 @@
> +package org.apache.lucene.search;
> +
> +/**
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version
> 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License.  You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +import java.io.IOException;
> +
> +/**
> + * An empty implementation for {@link DocIdSetIterator}. This can be used
> by
> + * classes which receive a null {@link DocIdSet} from
> + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
> + */
> +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
> +
> +  private static final DocIdSetIterator instance = new
> EmptyDocIdSetIterator();
> +
> +  public static DocIdSetIterator getInstance() { return instance; }
> +
> +  // to prevent instantiation
> +  private EmptyDocIdSetIterator() { }
> +
> +  public int advance(int target) throws IOException { return
> NO_MORE_DOCS; }
> +
> +  public int docID() { return NO_MORE_DOCS; }
> +
> +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
> +
> +}
>
> Propchange:
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java
> --------------------------------------------------------------------------
> ----
>     svn:eol-style = native
>



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

 


Re: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Shai Erera <se...@gmail.com>.
I don't see this class in DISI. I created it for classes that get a null
iterator, but need to have some iterator to work w/, so now they can use
EmptyDISI.

It not like DocIdSet.EMPTY_DOCIDSET. While the latter allows an impl to
return EMPTY as its DocIdSet, the EmptyDISI is for instantiation by code
which received a null iterator. Sometimes the iterator will be null, and the
DocIdSet itself won't "know" that until its iterator() is called. Also,
instead of fixing all Filter impls to check if the DIS's iterator will be
null then return DIS.EMPTY, I think this is a useful class in and on itself.

Shai

On Mon, Jul 27, 2009 at 1:18 PM, Uwe Schindler <uw...@thetaphi.de> wrote:

> Why do we need this class? There is already a static final empty iterator
> available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something like
> that name)?
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
> > From: mikemccand@apache.org [mailto:mikemccand@apache.org]
> > Sent: Monday, July 27, 2009 12:03 PM
> > To: java-commits@lucene.apache.org
> > Subject: svn commit: r798091 -
> >
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> > .java
> >
> > Author: mikemccand
> > Date: Mon Jul 27 10:02:34 2009
> > New Revision: 798091
> >
> > URL: http://svn.apache.org/viewvc?rev=798091&view=rev
> > Log:
> > LUCENE-1754: add EmptyDocIdSetIterator
> >
> > Added:
> >
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > java   (with props)
> >
> > Added:
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > java
> > URL:
> >
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> > search/EmptyDocIdSetIterator.java?rev=798091&view=auto
> >
> ==========================================================================
> > ====
> > ---
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > java (added)
> > +++
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > java Mon Jul 27 10:02:34 2009
> > @@ -0,0 +1,42 @@
> > +package org.apache.lucene.search;
> > +
> > +/**
> > + * Licensed to the Apache Software Foundation (ASF) under one or more
> > + * contributor license agreements.  See the NOTICE file distributed with
> > + * this work for additional information regarding copyright ownership.
> > + * The ASF licenses this file to You under the Apache License, Version
> > 2.0
> > + * (the "License"); you may not use this file except in compliance with
> > + * the License.  You may obtain a copy of the License at
> > + *
> > + *     http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing, software
> > + * distributed under the License is distributed on an "AS IS" BASIS,
> > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > implied.
> > + * See the License for the specific language governing permissions and
> > + * limitations under the License.
> > + */
> > +
> > +import java.io.IOException;
> > +
> > +/**
> > + * An empty implementation for {@link DocIdSetIterator}. This can be
> used
> > by
> > + * classes which receive a null {@link DocIdSet} from
> > + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
> > + */
> > +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
> > +
> > +  private static final DocIdSetIterator instance = new
> > EmptyDocIdSetIterator();
> > +
> > +  public static DocIdSetIterator getInstance() { return instance; }
> > +
> > +  // to prevent instantiation
> > +  private EmptyDocIdSetIterator() { }
> > +
> > +  public int advance(int target) throws IOException { return
> > NO_MORE_DOCS; }
> > +
> > +  public int docID() { return NO_MORE_DOCS; }
> > +
> > +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
> > +
> > +}
> >
> > Propchange:
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > java
> >
> --------------------------------------------------------------------------
> > ----
> >     svn:eol-style = native
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Re: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Shai Erera <se...@gmail.com>.
Ok I wasn't aware of DIS.EMPTY - calling DIS.EMPTY.iterator() is also
acceptable.

EmptyDISI does conform to the spec, as the spec says about docID(): "returns
-1 or NO_MORE_DOCS if nextDoc() or advance(int) were not called yet".
Therefore it's ok to return NO_MORE_DOCS upfront.

How do you propose we make the change? I can attach another patch which
removes EmptyDISI and changes all places to call DIS.EMPTY.iterator(), and
also change DIS.EMPTY to impl iterator() like EmptyDISI. Would that work?

Shai

On Mon, Jul 27, 2009 at 1:38 PM, Uwe Schindler <uw...@thetaphi.de> wrote:

>  This was my second idea, if you really want to have this empty one.
> Instead of returing a SortedVIntList at all just create a subclass of the
> abstract one:
>
>
>
>   public static final DocIdSet EMPTY_DOCIDSET = new DocIdSet() {
>     public DocIdSetIterator iterator() {
>       return EmptyDocIdSetIterator.getInstance();
>     }
>   };
>
>  By the way, this iterator is not conformant to the spec, which says,
> before calling nextDoc() it should return -1!
>
>
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>   ------------------------------
>
> *From:* Shai Erera [mailto:serera@gmail.com]
> *Sent:* Monday, July 27, 2009 12:32 PM
> *To:* java-dev@lucene.apache.org
> *Subject:* Re: svn commit: r798091 -
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java
>
>
>
> And BTW, now that I look at DIS.EMPTY, I think it can be improved by
> defining it like this:
>
>   public static final DocIdSet EMPTY_DOCIDSET = new SortedVIntList(new
> int[0]) {
>     public DocIdSetIterator iterator() {
>       return EmptyDocIdSetIterator.getInstance();
>     }
>   };
>
> Instead of having its iterator() always creating a new instance, it can
> return EmptyDISI's single instance.
>
> I can open an issue, but I think this can be committed quite trivially by
> one of the committers.
>
> Shai
>
> On Mon, Jul 27, 2009 at 1:26 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
>
> Right, and you can simply get an iterator from it.
>
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
> > -----Original Message-----
> > From: Robert Muir [mailto:rcmuir@gmail.com]
> > Sent: Monday, July 27, 2009 12:24 PM
> > To: java-dev@lucene.apache.org
> > Subject: Re: svn commit: r798091 -
> >
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> > .java
> >
> > here it is: DocIdSet.EMPTY_DOCIDSET
> >
> > /** An empty {@code DocIdSet} instance for easy use (this is currently
> >    * implemented using a {@link SortedVIntList}). */
>
> >
> > On Mon, Jul 27, 2009 at 6:18 AM, Uwe Schindler<uw...@thetaphi.de> wrote:
> > > Why do we need this class? There is already a static final empty
> > iterator
> > > available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something
> like
> > > that name)?
> > >
> > > -----
> > > Uwe Schindler
> > > H.-H.-Meier-Allee 63, D-28213 Bremen
> > > http://www.thetaphi.de
> > > eMail: uwe@thetaphi.de
> > >
> > >> From: mikemccand@apache.org [mailto:mikemccand@apache.org]
> > >> Sent: Monday, July 27, 2009 12:03 PM
> > >> To: java-commits@lucene.apache.org
> > >> Subject: svn commit: r798091 -
> > >>
> >
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> > >> .java
> > >>
> > >> Author: mikemccand
> > >> Date: Mon Jul 27 10:02:34 2009
> > >> New Revision: 798091
> > >>
> > >> URL: http://svn.apache.org/viewvc?rev=798091&view=rev
> > >> Log:
> > >> LUCENE-1754: add EmptyDocIdSetIterator
> > >>
> > >> Added:
> > >>
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java   (with props)
> > >>
> > >> Added:
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java
> > >> URL:
> > >>
> >
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> > >> search/EmptyDocIdSetIterator.java?rev=798091&view=auto
> > >>
> >
> ==========================================================================
> > >> ====
> > >> ---
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java (added)
> > >> +++
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java Mon Jul 27 10:02:34 2009
> > >> @@ -0,0 +1,42 @@
> > >> +package org.apache.lucene.search;
> > >> +
> > >> +/**
> > >> + * Licensed to the Apache Software Foundation (ASF) under one or more
> > >> + * contributor license agreements.  See the NOTICE file distributed
> > with
> > >> + * this work for additional information regarding copyright
> ownership.
> > >> + * The ASF licenses this file to You under the Apache License,
> Version
> > >> 2.0
> > >> + * (the "License"); you may not use this file except in compliance
> > with
> > >> + * the License.  You may obtain a copy of the License at
> > >> + *
> > >> + *     http://www.apache.org/licenses/LICENSE-2.0
> > >> + *
> > >> + * Unless required by applicable law or agreed to in writing,
> software
> > >> + * distributed under the License is distributed on an "AS IS" BASIS,
> > >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > >> implied.
> > >> + * See the License for the specific language governing permissions
> and
> > >> + * limitations under the License.
> > >> + */
> > >> +
> > >> +import java.io.IOException;
> > >> +
> > >> +/**
> > >> + * An empty implementation for {@link DocIdSetIterator}. This can be
> > used
> > >> by
> > >> + * classes which receive a null {@link DocIdSet} from
> > >> + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
> > >> + */
> > >> +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
> > >> +
> > >> +  private static final DocIdSetIterator instance = new
> > >> EmptyDocIdSetIterator();
> > >> +
> > >> +  public static DocIdSetIterator getInstance() { return instance; }
> > >> +
> > >> +  // to prevent instantiation
> > >> +  private EmptyDocIdSetIterator() { }
> > >> +
> > >> +  public int advance(int target) throws IOException { return
> > >> NO_MORE_DOCS; }
> > >> +
> > >> +  public int docID() { return NO_MORE_DOCS; }
> > >> +
> > >> +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
> > >> +
> > >> +}
> > >>
> > >> Propchange:
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java
> > >>
> -----------------------------------------------------------------------
> > ---
> > >> ----
> > >>     svn:eol-style = native
> > >>
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-dev-help@lucene.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Robert Muir
> > rcmuir@gmail.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
>

RE: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Uwe Schindler <uw...@thetaphi.de>.
This was my second idea, if you really want to have this empty one. Instead
of returing a SortedVIntList at all just create a subclass of the abstract
one:

 

  public static final DocIdSet EMPTY_DOCIDSET = new DocIdSet() {
    public DocIdSetIterator iterator() {
      return EmptyDocIdSetIterator.getInstance();
    }
  };



By the way, this iterator is not conformant to the spec, which says, before
calling nextDoc() it should return -1!

 

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

  _____  

From: Shai Erera [mailto:serera@gmail.com] 
Sent: Monday, July 27, 2009 12:32 PM
To: java-dev@lucene.apache.org
Subject: Re: svn commit: r798091 -
/lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.j
ava

 

And BTW, now that I look at DIS.EMPTY, I think it can be improved by
defining it like this:

  public static final DocIdSet EMPTY_DOCIDSET = new SortedVIntList(new
int[0]) {
    public DocIdSetIterator iterator() {
      return EmptyDocIdSetIterator.getInstance();
    }
  };

Instead of having its iterator() always creating a new instance, it can
return EmptyDISI's single instance.

I can open an issue, but I think this can be committed quite trivially by
one of the committers.

Shai

On Mon, Jul 27, 2009 at 1:26 PM, Uwe Schindler <uw...@thetaphi.de> wrote:

Right, and you can simply get an iterator from it.


-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Robert Muir [mailto:rcmuir@gmail.com]
> Sent: Monday, July 27, 2009 12:24 PM
> To: java-dev@lucene.apache.org
> Subject: Re: svn commit: r798091 -
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> .java
>
> here it is: DocIdSet.EMPTY_DOCIDSET
>
> /** An empty {@code DocIdSet} instance for easy use (this is currently
>    * implemented using a {@link SortedVIntList}). */
>
> On Mon, Jul 27, 2009 at 6:18 AM, Uwe Schindler<uw...@thetaphi.de> wrote:
> > Why do we need this class? There is already a static final empty
> iterator
> > available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something like
> > that name)?
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> >
> >> From: mikemccand@apache.org [mailto:mikemccand@apache.org]
> >> Sent: Monday, July 27, 2009 12:03 PM
> >> To: java-commits@lucene.apache.org
> >> Subject: svn commit: r798091 -
> >>
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> >> .java
> >>
> >> Author: mikemccand
> >> Date: Mon Jul 27 10:02:34 2009
> >> New Revision: 798091
> >>
> >> URL: http://svn.apache.org/viewvc?rev=798091
<http://svn.apache.org/viewvc?rev=798091&view=rev> &view=rev
> >> Log:
> >> LUCENE-1754: add EmptyDocIdSetIterator
> >>
> >> Added:
> >>
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java   (with props)
> >>
> >> Added:
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java
> >> URL:
> >>
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> >> search/EmptyDocIdSetIterator.java?rev=798091&view=auto
> >>
> ==========================================================================
> >> ====
> >> ---
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java (added)
> >> +++
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java Mon Jul 27 10:02:34 2009
> >> @@ -0,0 +1,42 @@
> >> +package org.apache.lucene.search;
> >> +
> >> +/**
> >> + * Licensed to the Apache Software Foundation (ASF) under one or more
> >> + * contributor license agreements.  See the NOTICE file distributed
> with
> >> + * this work for additional information regarding copyright ownership.
> >> + * The ASF licenses this file to You under the Apache License, Version
> >> 2.0
> >> + * (the "License"); you may not use this file except in compliance
> with
> >> + * the License.  You may obtain a copy of the License at
> >> + *
> >> + *     http://www.apache.org/licenses/LICENSE-2.0
> >> + *
> >> + * Unless required by applicable law or agreed to in writing, software
> >> + * distributed under the License is distributed on an "AS IS" BASIS,
> >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >> implied.
> >> + * See the License for the specific language governing permissions and
> >> + * limitations under the License.
> >> + */
> >> +
> >> +import java.io.IOException;
> >> +
> >> +/**
> >> + * An empty implementation for {@link DocIdSetIterator}. This can be
> used
> >> by
> >> + * classes which receive a null {@link DocIdSet} from
> >> + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
> >> + */
> >> +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
> >> +
> >> +  private static final DocIdSetIterator instance = new
> >> EmptyDocIdSetIterator();
> >> +
> >> +  public static DocIdSetIterator getInstance() { return instance; }
> >> +
> >> +  // to prevent instantiation
> >> +  private EmptyDocIdSetIterator() { }
> >> +
> >> +  public int advance(int target) throws IOException { return
> >> NO_MORE_DOCS; }
> >> +
> >> +  public int docID() { return NO_MORE_DOCS; }
> >> +
> >> +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
> >> +
> >> +}
> >>
> >> Propchange:
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java
> >> -----------------------------------------------------------------------
> ---
> >> ----
> >>     svn:eol-style = native
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-dev-help@lucene.apache.org
> >
> >
>
>
>
> --
> Robert Muir
> rcmuir@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org



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

 


Re: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Shai Erera <se...@gmail.com>.
And BTW, now that I look at DIS.EMPTY, I think it can be improved by
defining it like this:

  public static final DocIdSet EMPTY_DOCIDSET = new SortedVIntList(new
int[0]) {
    public DocIdSetIterator iterator() {
      return EmptyDocIdSetIterator.getInstance();
    }
  };

Instead of having its iterator() always creating a new instance, it can
return EmptyDISI's single instance.

I can open an issue, but I think this can be committed quite trivially by
one of the committers.

Shai

On Mon, Jul 27, 2009 at 1:26 PM, Uwe Schindler <uw...@thetaphi.de> wrote:

> Right, and you can simply get an iterator from it.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
> > -----Original Message-----
> > From: Robert Muir [mailto:rcmuir@gmail.com]
> > Sent: Monday, July 27, 2009 12:24 PM
> > To: java-dev@lucene.apache.org
> > Subject: Re: svn commit: r798091 -
> >
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> > .java
> >
> > here it is: DocIdSet.EMPTY_DOCIDSET
> >
> > /** An empty {@code DocIdSet} instance for easy use (this is currently
> >    * implemented using a {@link SortedVIntList}). */
> >
> > On Mon, Jul 27, 2009 at 6:18 AM, Uwe Schindler<uw...@thetaphi.de> wrote:
> > > Why do we need this class? There is already a static final empty
> > iterator
> > > available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something
> like
> > > that name)?
> > >
> > > -----
> > > Uwe Schindler
> > > H.-H.-Meier-Allee 63, D-28213 Bremen
> > > http://www.thetaphi.de
> > > eMail: uwe@thetaphi.de
> > >
> > >> From: mikemccand@apache.org [mailto:mikemccand@apache.org]
> > >> Sent: Monday, July 27, 2009 12:03 PM
> > >> To: java-commits@lucene.apache.org
> > >> Subject: svn commit: r798091 -
> > >>
> >
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> > >> .java
> > >>
> > >> Author: mikemccand
> > >> Date: Mon Jul 27 10:02:34 2009
> > >> New Revision: 798091
> > >>
> > >> URL: http://svn.apache.org/viewvc?rev=798091&view=rev
> > >> Log:
> > >> LUCENE-1754: add EmptyDocIdSetIterator
> > >>
> > >> Added:
> > >>
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java   (with props)
> > >>
> > >> Added:
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java
> > >> URL:
> > >>
> >
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> > >> search/EmptyDocIdSetIterator.java?rev=798091&view=auto
> > >>
> >
> ==========================================================================
> > >> ====
> > >> ---
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java (added)
> > >> +++
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java Mon Jul 27 10:02:34 2009
> > >> @@ -0,0 +1,42 @@
> > >> +package org.apache.lucene.search;
> > >> +
> > >> +/**
> > >> + * Licensed to the Apache Software Foundation (ASF) under one or more
> > >> + * contributor license agreements.  See the NOTICE file distributed
> > with
> > >> + * this work for additional information regarding copyright
> ownership.
> > >> + * The ASF licenses this file to You under the Apache License,
> Version
> > >> 2.0
> > >> + * (the "License"); you may not use this file except in compliance
> > with
> > >> + * the License.  You may obtain a copy of the License at
> > >> + *
> > >> + *     http://www.apache.org/licenses/LICENSE-2.0
> > >> + *
> > >> + * Unless required by applicable law or agreed to in writing,
> software
> > >> + * distributed under the License is distributed on an "AS IS" BASIS,
> > >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > >> implied.
> > >> + * See the License for the specific language governing permissions
> and
> > >> + * limitations under the License.
> > >> + */
> > >> +
> > >> +import java.io.IOException;
> > >> +
> > >> +/**
> > >> + * An empty implementation for {@link DocIdSetIterator}. This can be
> > used
> > >> by
> > >> + * classes which receive a null {@link DocIdSet} from
> > >> + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
> > >> + */
> > >> +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
> > >> +
> > >> +  private static final DocIdSetIterator instance = new
> > >> EmptyDocIdSetIterator();
> > >> +
> > >> +  public static DocIdSetIterator getInstance() { return instance; }
> > >> +
> > >> +  // to prevent instantiation
> > >> +  private EmptyDocIdSetIterator() { }
> > >> +
> > >> +  public int advance(int target) throws IOException { return
> > >> NO_MORE_DOCS; }
> > >> +
> > >> +  public int docID() { return NO_MORE_DOCS; }
> > >> +
> > >> +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
> > >> +
> > >> +}
> > >>
> > >> Propchange:
> > >>
> >
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> > >> java
> > >>
> -----------------------------------------------------------------------
> > ---
> > >> ----
> > >>     svn:eol-style = native
> > >>
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-dev-help@lucene.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Robert Muir
> > rcmuir@gmail.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

RE: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Uwe Schindler <uw...@thetaphi.de>.
Right, and you can simply get an iterator from it.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Robert Muir [mailto:rcmuir@gmail.com]
> Sent: Monday, July 27, 2009 12:24 PM
> To: java-dev@lucene.apache.org
> Subject: Re: svn commit: r798091 -
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> .java
> 
> here it is: DocIdSet.EMPTY_DOCIDSET
> 
> /** An empty {@code DocIdSet} instance for easy use (this is currently
>    * implemented using a {@link SortedVIntList}). */
> 
> On Mon, Jul 27, 2009 at 6:18 AM, Uwe Schindler<uw...@thetaphi.de> wrote:
> > Why do we need this class? There is already a static final empty
> iterator
> > available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something like
> > that name)?
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> >
> >> From: mikemccand@apache.org [mailto:mikemccand@apache.org]
> >> Sent: Monday, July 27, 2009 12:03 PM
> >> To: java-commits@lucene.apache.org
> >> Subject: svn commit: r798091 -
> >>
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> >> .java
> >>
> >> Author: mikemccand
> >> Date: Mon Jul 27 10:02:34 2009
> >> New Revision: 798091
> >>
> >> URL: http://svn.apache.org/viewvc?rev=798091&view=rev
> >> Log:
> >> LUCENE-1754: add EmptyDocIdSetIterator
> >>
> >> Added:
> >>
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java   (with props)
> >>
> >> Added:
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java
> >> URL:
> >>
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> >> search/EmptyDocIdSetIterator.java?rev=798091&view=auto
> >>
> ==========================================================================
> >> ====
> >> ---
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java (added)
> >> +++
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java Mon Jul 27 10:02:34 2009
> >> @@ -0,0 +1,42 @@
> >> +package org.apache.lucene.search;
> >> +
> >> +/**
> >> + * Licensed to the Apache Software Foundation (ASF) under one or more
> >> + * contributor license agreements.  See the NOTICE file distributed
> with
> >> + * this work for additional information regarding copyright ownership.
> >> + * The ASF licenses this file to You under the Apache License, Version
> >> 2.0
> >> + * (the "License"); you may not use this file except in compliance
> with
> >> + * the License.  You may obtain a copy of the License at
> >> + *
> >> + *     http://www.apache.org/licenses/LICENSE-2.0
> >> + *
> >> + * Unless required by applicable law or agreed to in writing, software
> >> + * distributed under the License is distributed on an "AS IS" BASIS,
> >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >> implied.
> >> + * See the License for the specific language governing permissions and
> >> + * limitations under the License.
> >> + */
> >> +
> >> +import java.io.IOException;
> >> +
> >> +/**
> >> + * An empty implementation for {@link DocIdSetIterator}. This can be
> used
> >> by
> >> + * classes which receive a null {@link DocIdSet} from
> >> + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
> >> + */
> >> +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
> >> +
> >> +  private static final DocIdSetIterator instance = new
> >> EmptyDocIdSetIterator();
> >> +
> >> +  public static DocIdSetIterator getInstance() { return instance; }
> >> +
> >> +  // to prevent instantiation
> >> +  private EmptyDocIdSetIterator() { }
> >> +
> >> +  public int advance(int target) throws IOException { return
> >> NO_MORE_DOCS; }
> >> +
> >> +  public int docID() { return NO_MORE_DOCS; }
> >> +
> >> +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
> >> +
> >> +}
> >>
> >> Propchange:
> >>
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> >> java
> >> -----------------------------------------------------------------------
> ---
> >> ----
> >>     svn:eol-style = native
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-dev-help@lucene.apache.org
> >
> >
> 
> 
> 
> --
> Robert Muir
> rcmuir@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org



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


Re: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Robert Muir <rc...@gmail.com>.
here it is: DocIdSet.EMPTY_DOCIDSET

/** An empty {@code DocIdSet} instance for easy use (this is currently
   * implemented using a {@link SortedVIntList}). */

On Mon, Jul 27, 2009 at 6:18 AM, Uwe Schindler<uw...@thetaphi.de> wrote:
> Why do we need this class? There is already a static final empty iterator
> available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something like
> that name)?
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>> From: mikemccand@apache.org [mailto:mikemccand@apache.org]
>> Sent: Monday, July 27, 2009 12:03 PM
>> To: java-commits@lucene.apache.org
>> Subject: svn commit: r798091 -
>> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
>> .java
>>
>> Author: mikemccand
>> Date: Mon Jul 27 10:02:34 2009
>> New Revision: 798091
>>
>> URL: http://svn.apache.org/viewvc?rev=798091&view=rev
>> Log:
>> LUCENE-1754: add EmptyDocIdSetIterator
>>
>> Added:
>>
>> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
>> java   (with props)
>>
>> Added:
>> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
>> java
>> URL:
>> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
>> search/EmptyDocIdSetIterator.java?rev=798091&view=auto
>> ==========================================================================
>> ====
>> ---
>> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
>> java (added)
>> +++
>> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
>> java Mon Jul 27 10:02:34 2009
>> @@ -0,0 +1,42 @@
>> +package org.apache.lucene.search;
>> +
>> +/**
>> + * Licensed to the Apache Software Foundation (ASF) under one or more
>> + * contributor license agreements.  See the NOTICE file distributed with
>> + * this work for additional information regarding copyright ownership.
>> + * The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> + * (the "License"); you may not use this file except in compliance with
>> + * the License.  You may obtain a copy of the License at
>> + *
>> + *     http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> + * See the License for the specific language governing permissions and
>> + * limitations under the License.
>> + */
>> +
>> +import java.io.IOException;
>> +
>> +/**
>> + * An empty implementation for {@link DocIdSetIterator}. This can be used
>> by
>> + * classes which receive a null {@link DocIdSet} from
>> + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
>> + */
>> +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
>> +
>> +  private static final DocIdSetIterator instance = new
>> EmptyDocIdSetIterator();
>> +
>> +  public static DocIdSetIterator getInstance() { return instance; }
>> +
>> +  // to prevent instantiation
>> +  private EmptyDocIdSetIterator() { }
>> +
>> +  public int advance(int target) throws IOException { return
>> NO_MORE_DOCS; }
>> +
>> +  public int docID() { return NO_MORE_DOCS; }
>> +
>> +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
>> +
>> +}
>>
>> Propchange:
>> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
>> java
>> --------------------------------------------------------------------------
>> ----
>>     svn:eol-style = native
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>



-- 
Robert Muir
rcmuir@gmail.com

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


RE: svn commit: r798091 - /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.java

Posted by Uwe Schindler <uw...@thetaphi.de>.
Why do we need this class? There is already a static final empty iterator
available in DocIdSetIterator.EMPTY_DOCIDSET_ITERATOR (or something like
that name)?

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> From: mikemccand@apache.org [mailto:mikemccand@apache.org]
> Sent: Monday, July 27, 2009 12:03 PM
> To: java-commits@lucene.apache.org
> Subject: svn commit: r798091 -
> /lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator
> .java
> 
> Author: mikemccand
> Date: Mon Jul 27 10:02:34 2009
> New Revision: 798091
> 
> URL: http://svn.apache.org/viewvc?rev=798091&view=rev
> Log:
> LUCENE-1754: add EmptyDocIdSetIterator
> 
> Added:
> 
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java   (with props)
> 
> Added:
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java
> URL:
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> search/EmptyDocIdSetIterator.java?rev=798091&view=auto
> ==========================================================================
> ====
> ---
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java (added)
> +++
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java Mon Jul 27 10:02:34 2009
> @@ -0,0 +1,42 @@
> +package org.apache.lucene.search;
> +
> +/**
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version
> 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License.  You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +import java.io.IOException;
> +
> +/**
> + * An empty implementation for {@link DocIdSetIterator}. This can be used
> by
> + * classes which receive a null {@link DocIdSet} from
> + * {@link Filter#getDocIdSet(org.apache.lucene.index.IndexReader)}.
> + */
> +public final class EmptyDocIdSetIterator extends DocIdSetIterator {
> +
> +  private static final DocIdSetIterator instance = new
> EmptyDocIdSetIterator();
> +
> +  public static DocIdSetIterator getInstance() { return instance; }
> +
> +  // to prevent instantiation
> +  private EmptyDocIdSetIterator() { }
> +
> +  public int advance(int target) throws IOException { return
> NO_MORE_DOCS; }
> +
> +  public int docID() { return NO_MORE_DOCS; }
> +
> +  public int nextDoc() throws IOException { return NO_MORE_DOCS; }
> +
> +}
> 
> Propchange:
> lucene/java/trunk/src/java/org/apache/lucene/search/EmptyDocIdSetIterator.
> java
> --------------------------------------------------------------------------
> ----
>     svn:eol-style = native
> 



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