forked from hyan/kamikaze
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
John Wang
committed
Nov 1, 2011
1 parent
d460761
commit e12aad0
Showing
7 changed files
with
356 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"/> | ||
<classpathentry kind="src" path="contrib/luceneCodec/test"/> | ||
<classpathentry excluding="com/kamikaze/lucecodec/util/" kind="src" path="contrib/luceneCodec/src"/> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> | ||
<classpathentry kind="lib" path="/Users/john/.m2/repository/org/apache/lucene/lucene-core/3.4.0/lucene-core-3.4.0.jar"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> | ||
<classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/> | ||
<classpathentry kind="src" path="src/main/java" including="**/*.java"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
<classpathentry kind="var" path="M2_REPO/junit/junit/4.5/junit-4.5.jar"/> | ||
<classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-core/3.3.0/lucene-core-3.3.0.jar"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>kamikaze</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.maven.ide.eclipse.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.maven.ide.eclipse.maven2Nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> | ||
<name>kamikaze</name> | ||
<comment>information retrival utility package for enhancing Lucene. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment> | ||
<projects/> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.maven.ide.eclipse.maven2Builder</name> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.maven.ide.eclipse.maven2Nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/com/kamikaze/docidset/impl/AndNotDocIdSetIterator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.kamikaze.docidset.impl; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.lucene.search.DocIdSetIterator; | ||
|
||
public class AndNotDocIdSetIterator extends DocIdSetIterator{ | ||
private int _nextDelDoc; | ||
private final DocIdSetIterator _baseIter; | ||
private final DocIdSetIterator _notIter; | ||
private int _currID; | ||
|
||
public AndNotDocIdSetIterator(DocIdSetIterator baseIter,DocIdSetIterator notIter) throws IOException{ | ||
_nextDelDoc = notIter.nextDoc(); | ||
_baseIter = baseIter; | ||
_notIter = notIter; | ||
_currID = -1; | ||
} | ||
|
||
@Override | ||
public int advance(int target) throws IOException { | ||
_currID = _baseIter.advance(target); | ||
if (_currID==DocIdSetIterator.NO_MORE_DOCS) | ||
return _currID; | ||
|
||
if (_nextDelDoc!=DocIdSetIterator.NO_MORE_DOCS){ | ||
_currID = _baseIter.docID(); | ||
if (_currID<_nextDelDoc) return _currID; | ||
_nextDelDoc = _notIter.advance(_currID); | ||
if (_currID==_nextDelDoc) return nextDoc(); | ||
} | ||
return _currID; | ||
} | ||
|
||
@Override | ||
public int docID() { | ||
return _currID; | ||
} | ||
|
||
@Override | ||
public int nextDoc() throws IOException { | ||
_currID =_baseIter.nextDoc(); | ||
if (_nextDelDoc!=DocIdSetIterator.NO_MORE_DOCS){ | ||
while(_currID != DocIdSetIterator.NO_MORE_DOCS){ | ||
if (_currID<_nextDelDoc){ | ||
return _currID; | ||
} | ||
else{ | ||
if (_currID == _nextDelDoc){ | ||
_currID =_baseIter.nextDoc(); | ||
} | ||
_nextDelDoc = _notIter.advance(_currID); | ||
} | ||
} | ||
} | ||
return _currID; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.