You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2013/08/21 00:27:18 UTC
svn commit: r1515994 - in
/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index:
Test2BPositions.java Test2BPostings.java Test2BPostingsBytes.java
Author: mikemccand
Date: Tue Aug 20 22:27:18 2013
New Revision: 1515994
URL: http://svn.apache.org/r1515994
Log:
LUCENE-3849: fix some more test only TokenStreams
Modified:
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java?rev=1515994&r1=1515993&r2=1515994&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java Tue Aug 20 22:27:18 2013
@@ -88,14 +88,12 @@ public class Test2BPositions extends Luc
private final PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class);
int index;
- public MyTokenStream() {
- termAtt.setLength(1);
- termAtt.buffer()[0] = 'a';
- }
-
@Override
public boolean incrementToken() {
if (index < 52) {
+ clearAttributes();
+ termAtt.setLength(1);
+ termAtt.buffer()[0] = 'a';
posIncAtt.setPositionIncrement(1+index);
index++;
return true;
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java?rev=1515994&r1=1515993&r2=1515994&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java Tue Aug 20 22:27:18 2013
@@ -85,18 +85,14 @@ public class Test2BPostings extends Luce
public static final class MyTokenStream extends TokenStream {
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
- private final char buffer[];
int index;
- public MyTokenStream() {
- termAtt.setLength(1);
- buffer = termAtt.buffer();
- }
-
@Override
public boolean incrementToken() {
if (index <= 'z') {
- buffer[0] = (char) index++;
+ clearAttributes();
+ termAtt.setLength(1);
+ termAtt.buffer()[0] = (char) index++;
return true;
}
return false;
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java?rev=1515994&r1=1515993&r2=1515994&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java Tue Aug 20 22:27:18 2013
@@ -130,14 +130,12 @@ public class Test2BPostingsBytes extends
int index;
int n;
- public MyTokenStream() {
- termAtt.setLength(1);
- termAtt.buffer()[0] = 'a';
- }
-
@Override
public boolean incrementToken() {
if (index < n) {
+ clearAttributes();
+ termAtt.buffer()[0] = 'a';
+ termAtt.setLength(1);
index++;
return true;
}