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 ma...@apache.org on 2009/08/12 22:28:18 UTC
svn commit: r803700 - in /lucene/java/trunk: ./
src/java/org/apache/lucene/search/spans/
src/test/org/apache/lucene/search/spans/
Author: markrmiller
Date: Wed Aug 12 20:28:17 2009
New Revision: 803700
URL: http://svn.apache.org/viewvc?rev=803700&view=rev
Log:
LUCENE-1748: makes Spans abstract class
Modified:
lucene/java/trunk/CHANGES.txt
lucene/java/trunk/common-build.xml
lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java
lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java
lucene/java/trunk/src/java/org/apache/lucene/search/spans/Spans.java
lucene/java/trunk/src/java/org/apache/lucene/search/spans/TermSpans.java
lucene/java/trunk/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java
Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=803700&r1=803699&r2=803700&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Wed Aug 12 20:28:17 2009
@@ -88,7 +88,9 @@
compat break and caused custom SpanQuery implementations to fail at runtime
in a variety of ways. This issue attempts to remedy things by causing
a compile time break on custom SpanQuery implementations and removing
- the PayloadSpans class, with its functionality now moved to Spans.
+ the PayloadSpans class, with its functionality now moved to Spans. To
+ help in alleviating future back compat pain, Spans has been changed from
+ an interface to an abstract class.
(Hugh Cayless, Mark Miller)
Changes in runtime behavior
@@ -374,7 +376,9 @@
compat break and caused custom SpanQuery implementations to fail at runtime
in a variety of ways. This issue attempts to remedy things by causing
a compile time break on custom SpanQuery implementations and removing
- the PayloadSpans class, with its functionality now moved to Spans.
+ the PayloadSpans class, with its functionality now moved to Spans. To
+ help in alleviating future back compat pain, Spans has been changed from
+ an interface to an abstract class.
(Hugh Cayless, Mark Miller)
Bug fixes
Modified: lucene/java/trunk/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/common-build.xml?rev=803700&r1=803699&r2=803700&view=diff
==============================================================================
--- lucene/java/trunk/common-build.xml (original)
+++ lucene/java/trunk/common-build.xml Wed Aug 12 20:28:17 2009
@@ -42,7 +42,7 @@
<property name="Name" value="Lucene"/>
<property name="dev.version" value="2.9-dev"/>
<property name="version" value="${dev.version}"/>
- <property name="compatibility.tag" value="lucene_2_4_back_compat_tests_20090811"/>
+ <property name="compatibility.tag" value="lucene_2_4_back_compat_tests_20090812"/>
<property name="spec.version" value="${version}"/>
<property name="year" value="2000-${current.year}"/>
<property name="final.name" value="lucene-${name}-${version}"/>
Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java?rev=803700&r1=803699&r2=803700&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java Wed Aug 12 20:28:17 2009
@@ -51,7 +51,7 @@
* Expert:
* Only public for subclassing. Most implementations should not need this class
*/
-public class NearSpansOrdered implements Spans {
+public class NearSpansOrdered extends Spans {
private final int allowedSlop;
private boolean firstTime = true;
private boolean more = false;
Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java?rev=803700&r1=803699&r2=803700&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java Wed Aug 12 20:28:17 2009
@@ -31,7 +31,7 @@
* Expert:
* Only public for subclassing. Most implementations should not need this class
*/
-public class NearSpansUnordered implements Spans {
+public class NearSpansUnordered extends Spans {
private SpanNearQuery query;
private List ordered = new ArrayList(); // spans in query order
@@ -67,7 +67,7 @@
/** Wraps a Spans, and can be used to form a linked list. */
- private class SpansCell implements Spans {
+ private class SpansCell extends Spans {
private Spans spans;
private SpansCell next;
private int length = -1;
Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/Spans.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/spans/Spans.java?rev=803700&r1=803699&r2=803700&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/Spans.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/Spans.java Wed Aug 12 20:28:17 2009
@@ -24,9 +24,9 @@
* Each span represents a range of term positions within a document. Matches
* are enumerated in order, by increasing document number, within that by
* increasing start position and finally by increasing end position. */
-public interface Spans {
+public abstract class Spans {
/** Move to the next match, returning true iff any such exists. */
- boolean next() throws IOException;
+ public abstract boolean next() throws IOException;
/** Skips to the first match beyond the current, whose document number is
* greater than or equal to <i>target</i>. <p>Returns true iff there is such
@@ -41,16 +41,16 @@
* </pre>
* Most implementations are considerably more efficient than that.
*/
- boolean skipTo(int target) throws IOException;
+ public abstract boolean skipTo(int target) throws IOException;
/** Returns the document number of the current match. Initially invalid. */
- int doc();
+ public abstract int doc();
/** Returns the start position of the current match. Initially invalid. */
- int start();
+ public abstract int start();
/** Returns the end position of the current match. Initially invalid. */
- int end();
+ public abstract int end();
/**
* Returns the payload data for the current span.
@@ -75,22 +75,16 @@
* @throws java.io.IOException
*/
// TODO: Remove warning after API has been finalized
- Collection/*<byte[]>*/ getPayload() throws IOException;
+ public abstract Collection/*<byte[]>*/ getPayload() throws IOException;
/**
* Checks if a payload can be loaded at this position.
* <p/>
* Payloads can only be loaded once per call to
* {@link #next()}.
- * <p/>
- * <p><font color="#FF0000">
- * WARNING: The status of the <b>Payloads</b> feature is experimental.
- * The APIs introduced here might change in the future and will not be
- * supported anymore in such a case.</font>
*
* @return true if there is a payload available at this position that can be loaded
*/
- // TODO: Remove warning after API has been finalized
- public boolean isPayloadAvailable();
+ public abstract boolean isPayloadAvailable();
}
Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/TermSpans.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/spans/TermSpans.java?rev=803700&r1=803699&r2=803700&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/TermSpans.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/TermSpans.java Wed Aug 12 20:28:17 2009
@@ -27,7 +27,7 @@
* Expert:
* Public for extension only
*/
-public class TermSpans implements Spans {
+public class TermSpans extends Spans {
protected TermPositions positions;
protected Term term;
protected int doc;
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java?rev=803700&r1=803699&r2=803700&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java Wed Aug 12 20:28:17 2009
@@ -35,7 +35,7 @@
private static final String UNSUPPORTED_MSG = "unsupported: used for back-compat testing only !";
- static final class JustCompileSpans implements Spans {
+ static final class JustCompileSpans extends Spans {
public int doc() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
@@ -88,7 +88,7 @@
}
- static final class JustCompilePayloadSpans implements Spans {
+ static final class JustCompilePayloadSpans extends Spans {
public Collection getPayload() throws IOException {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);