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 us...@apache.org on 2009/10/01 09:53:53 UTC
svn commit: r820553 [4/4] - in /lucene/java/trunk: ./
contrib/analyzers/common/
contrib/analyzers/common/src/java/org/apache/lucene/analysis/ar/
contrib/analyzers/common/src/java/org/apache/lucene/analysis/br/
contrib/analyzers/common/src/java/org/apac...
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java Thu Oct 1 07:53:43 2009
@@ -66,9 +66,9 @@
private final int[] INCREMENTS = {0, 2, 1, 0, 1};
private int i = 0;
- PositionIncrementAttribute posIncrAtt = (PositionIncrementAttribute) addAttribute(PositionIncrementAttribute.class);
- TermAttribute termAtt = (TermAttribute) addAttribute(TermAttribute.class);
- OffsetAttribute offsetAtt = (OffsetAttribute) addAttribute(OffsetAttribute.class);
+ PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
+ TermAttribute termAtt = addAttribute(TermAttribute.class);
+ OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
public boolean incrementToken() {
if (i == TOKENS.length)
@@ -348,9 +348,9 @@
this.fieldName = fieldName;
pos = 0;
i = 0;
- posIncrAttr = (PositionIncrementAttribute) input.addAttribute(PositionIncrementAttribute.class);
- payloadAttr = (PayloadAttribute) input.addAttribute(PayloadAttribute.class);
- termAttr = (TermAttribute) input.addAttribute(TermAttribute.class);
+ posIncrAttr = input.addAttribute(PositionIncrementAttribute.class);
+ payloadAttr = input.addAttribute(PayloadAttribute.class);
+ termAttr = input.addAttribute(TermAttribute.class);
}
public boolean incrementToken() throws IOException {
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestTermRangeQuery.java Thu Oct 1 07:53:43 2009
@@ -244,7 +244,7 @@
public SingleCharTokenizer(Reader r) {
super(r);
- termAtt = (TermAttribute) addAttribute(TermAttribute.class);
+ termAtt = addAttribute(TermAttribute.class);
}
public boolean incrementToken() throws IOException {
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/payloads/PayloadHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/payloads/PayloadHelper.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/payloads/PayloadHelper.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/payloads/PayloadHelper.java Thu Oct 1 07:53:43 2009
@@ -63,7 +63,7 @@
public PayloadFilter(TokenStream input, String fieldName) {
super(input);
this.fieldName = fieldName;
- payloadAtt = (PayloadAttribute) addAttribute(PayloadAttribute.class);
+ payloadAtt = addAttribute(PayloadAttribute.class);
}
public boolean incrementToken() throws IOException {
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java Thu Oct 1 07:53:43 2009
@@ -72,7 +72,7 @@
public PayloadFilter(TokenStream input, String fieldName) {
super(input);
this.fieldName = fieldName;
- payloadAtt = (PayloadAttribute) addAttribute(PayloadAttribute.class);
+ payloadAtt = addAttribute(PayloadAttribute.class);
}
public boolean incrementToken() throws IOException {
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java Thu Oct 1 07:53:43 2009
@@ -68,7 +68,7 @@
public PayloadFilter(TokenStream input, String fieldName) {
super(input);
this.fieldName = fieldName;
- payAtt = (PayloadAttribute) addAttribute(PayloadAttribute.class);
+ payAtt = addAttribute(PayloadAttribute.class);
}
public boolean incrementToken() throws IOException {
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java Thu Oct 1 07:53:43 2009
@@ -80,7 +80,7 @@
public PayloadFilter(TokenStream input, String fieldName) {
super(input);
this.fieldName = fieldName;
- payloadAtt = (PayloadAttribute) addAttribute(PayloadAttribute.class);
+ payloadAtt = addAttribute(PayloadAttribute.class);
}
public boolean incrementToken() throws IOException {
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java Thu Oct 1 07:53:43 2009
@@ -498,9 +498,9 @@
entities.add("one");
nopayload.add("nopayload");
nopayload.add("np");
- termAtt = (TermAttribute) addAttribute(TermAttribute.class);
- posIncrAtt = (PositionIncrementAttribute) addAttribute(PositionIncrementAttribute.class);
- payloadAtt = (PayloadAttribute) addAttribute(PayloadAttribute.class);
+ termAtt = addAttribute(TermAttribute.class);
+ posIncrAtt = addAttribute(PositionIncrementAttribute.class);
+ payloadAtt = addAttribute(PayloadAttribute.class);
}
public boolean incrementToken() throws IOException {
Modified: lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java?rev=820553&r1=820552&r2=820553&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java Thu Oct 1 07:53:43 2009
@@ -27,8 +27,8 @@
public void testCaptureState() {
// init a first instance
AttributeSource src = new AttributeSource();
- TermAttribute termAtt = (TermAttribute) src.addAttribute(TermAttribute.class);
- TypeAttribute typeAtt = (TypeAttribute) src.addAttribute(TypeAttribute.class);
+ TermAttribute termAtt = src.addAttribute(TermAttribute.class);
+ TypeAttribute typeAtt = src.addAttribute(TypeAttribute.class);
termAtt.setTermBuffer("TestTerm");
typeAtt.setType("TestType");
final int hashCode = src.hashCode();
@@ -55,9 +55,9 @@
// init a second instance (with attributes in different order and one additional attribute)
AttributeSource src2 = new AttributeSource();
- typeAtt = (TypeAttribute) src2.addAttribute(TypeAttribute.class);
- FlagsAttribute flagsAtt = (FlagsAttribute) src2.addAttribute(FlagsAttribute.class);
- termAtt = (TermAttribute) src2.addAttribute(TermAttribute.class);
+ typeAtt = src2.addAttribute(TypeAttribute.class);
+ FlagsAttribute flagsAtt = src2.addAttribute(FlagsAttribute.class);
+ termAtt = src2.addAttribute(TermAttribute.class);
flagsAtt.setFlags(12345);
src2.restoreState(state);
@@ -67,7 +67,7 @@
// init a third instance missing one Attribute
AttributeSource src3 = new AttributeSource();
- termAtt = (TermAttribute) src3.addAttribute(TermAttribute.class);
+ termAtt = src3.addAttribute(TermAttribute.class);
try {
src3.restoreState(state);
fail("The third instance is missing the TypeAttribute, so restoreState() should throw IllegalArgumentException");
@@ -78,19 +78,19 @@
public void testCloneAttributes() {
final AttributeSource src = new AttributeSource();
- final TermAttribute termAtt = (TermAttribute) src.addAttribute(TermAttribute.class);
- final TypeAttribute typeAtt = (TypeAttribute) src.addAttribute(TypeAttribute.class);
+ final TermAttribute termAtt = src.addAttribute(TermAttribute.class);
+ final TypeAttribute typeAtt = src.addAttribute(TypeAttribute.class);
termAtt.setTermBuffer("TestTerm");
typeAtt.setType("TestType");
final AttributeSource clone = src.cloneAttributes();
- final Iterator it = clone.getAttributeClassesIterator();
+ final Iterator<Class<? extends Attribute>> it = clone.getAttributeClassesIterator();
assertEquals("TermAttribute must be the first attribute", TermAttribute.class, it.next());
assertEquals("TypeAttribute must be the second attribute", TypeAttribute.class, it.next());
assertFalse("No more attributes", it.hasNext());
- final TermAttribute termAtt2 = (TermAttribute) clone.getAttribute(TermAttribute.class);
- final TypeAttribute typeAtt2 = (TypeAttribute) clone.getAttribute(TypeAttribute.class);
+ final TermAttribute termAtt2 = clone.getAttribute(TermAttribute.class);
+ final TypeAttribute typeAtt2 = clone.getAttribute(TypeAttribute.class);
assertNotSame("TermAttribute of original and clone must be different instances", termAtt2, termAtt);
assertNotSame("TypeAttribute of original and clone must be different instances", typeAtt2, typeAtt);
assertEquals("TermAttribute of original and clone must be equal", termAtt2, termAtt);
@@ -99,12 +99,12 @@
public void testToStringAndMultiAttributeImplementations() {
AttributeSource src = new AttributeSource();
- TermAttribute termAtt = (TermAttribute) src.addAttribute(TermAttribute.class);
- TypeAttribute typeAtt = (TypeAttribute) src.addAttribute(TypeAttribute.class);
+ TermAttribute termAtt = src.addAttribute(TermAttribute.class);
+ TypeAttribute typeAtt = src.addAttribute(TypeAttribute.class);
termAtt.setTermBuffer("TestTerm");
typeAtt.setType("TestType");
assertEquals("Attributes should appear in original order", "("+termAtt.toString()+","+typeAtt.toString()+")", src.toString());
- Iterator it = src.getAttributeImplsIterator();
+ Iterator<AttributeImpl> it = src.getAttributeImplsIterator();
assertTrue("Iterator should have 2 attributes left", it.hasNext());
assertSame("First AttributeImpl from iterator should be termAtt", termAtt, it.next());
assertTrue("Iterator should have 1 attributes left", it.hasNext());
@@ -114,7 +114,7 @@
src = new AttributeSource();
src.addAttributeImpl(new Token());
// this should not add a new attribute as Token implements TermAttribute, too
- termAtt = (TermAttribute) src.addAttribute(TermAttribute.class);
+ termAtt = src.addAttribute(TermAttribute.class);
assertTrue("TermAttribute should be implemented by Token", termAtt instanceof Token);
// get the Token attribute and check, that it is the only one
it = src.getAttributeImplsIterator();