Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 2cc319bbceb1d4167671bab40ce0c9859ec41e6f @javasoze javasoze committed Feb 27, 2010
Showing with 10,485 additions and 0 deletions.
  1. +10 −0 .classpath
  2. +17 −0 .project
  3. +256 −0 .settings/org.eclipse.jdt.core.prefs
  4. +4 −0 .settings/org.eclipse.jdt.ui.prefs
  5. +18 −0 NOTICE.txt
  6. 0 README
  7. +141 −0 build.xml
  8. +15 −0 ivy.xml
  9. +66 −0 src/com/kamikaze/docidset/api/DocSet.java
  10. +34 −0 src/com/kamikaze/docidset/api/StatefulDSIterator.java
  11. +39 −0 src/com/kamikaze/docidset/bitset/MyOpenBitSet.java
  12. +17 −0 src/com/kamikaze/docidset/compression/CompressedSortedIntegerSegment.java
  13. +201 −0 src/com/kamikaze/docidset/compression/P4DSet.java
  14. +383 −0 src/com/kamikaze/docidset/compression/P4DSetNoBase.java
  15. +304 −0 src/com/kamikaze/docidset/impl/AbstractDocSet.java
  16. +184 −0 src/com/kamikaze/docidset/impl/AndDocIdSet.java
  17. +45 −0 src/com/kamikaze/docidset/impl/ImmutableDocSet.java
  18. +74 −0 src/com/kamikaze/docidset/impl/ImmutableIntArrayDocIdSet.java
  19. +142 −0 src/com/kamikaze/docidset/impl/IntArrayDocIdSet.java
  20. +117 −0 src/com/kamikaze/docidset/impl/NotDocIdSet.java
  21. +166 −0 src/com/kamikaze/docidset/impl/OBSDocIdSet.java
  22. +112 −0 src/com/kamikaze/docidset/impl/OrDocIdSet.java
  23. +165 −0 src/com/kamikaze/docidset/impl/OrDocIdSetIterator.java
  24. +582 −0 src/com/kamikaze/docidset/impl/P4DDocIdSet.java
  25. +207 −0 src/com/kamikaze/docidset/utils/DisiDocQueue.java
  26. +124 −0 src/com/kamikaze/docidset/utils/DocSetFactory.java
  27. +100 −0 src/com/kamikaze/docidset/utils/IntArray.java
  28. +39 −0 src/com/kamikaze/docidset/utils/LongSegmentArray.java
  29. +43 −0 src/com/kamikaze/docidset/utils/MyOpenBitSetArray.java
  30. +147 −0 src/com/kamikaze/docidset/utils/PrimitiveArray.java
  31. +268 −0 src/com/kamikaze/docidset/utils/TestSizeEstimates.java
  32. +170 −0 test/com/kamikaze/test/KamikazeTest.java
  33. +10 −0 test/com/kamikaze/test/TestDocIdSetSuite.java
  34. +81 −0 test/com/kamikaze/test/TestDocSetFactory.java
  35. +827 −0 test/com/kamikaze/test/TestDocSetSerialization.java
  36. +1,645 −0 test/com/kamikaze/test/TestDocSets.java
  37. +170 −0 test/com/kamikaze/test/TestMultiThreadedAccess.java
  38. +856 −0 test/com/kamikaze/test/TestParameterizedDocSets.java
  39. +60 −0 test/com/kamikaze/test/perf/BooleanDocIdSetTest.java
  40. +2,267 −0 test/com/kamikaze/test/perf/TestDocSets.java
  41. +110 −0 test/com/kamikaze/test/perf/TestRealisticOrNetwork.java
  42. +268 −0 test/com/kamikaze/test/perf/TestSizeEstimates.java
  43. +1 −0 version.properties
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="test"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry kind="lib" path="lib/master/log4j.jar"/>
+ <classpathentry kind="lib" path="lib/master/lucene-core.jar"/>
+ <classpathentry kind="output" path="output"/>
+</classpath>
@@ -0,0 +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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,4 @@
+#Thu Jun 26 09:39:38 PDT 2008
+eclipse.preferences.version=1
+formatter_profile=_Lucene
+formatter_settings_version=11
@@ -0,0 +1,18 @@
+Kamikaze-1.0.2
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+The following classes are borrowed from Apache Lucene trunk
+
+
+com.kamikaze.lucenetrunk.search.DocIdSet.java @617859
+com.kamikaze.lucenetrunk.search.DocIdSetIterator.java @ 617859
+com.kamikaze.lucenetrunk.util.BitUtil.java @617859
+com.kamikaze.lucenetrunk.util.OpenBitSet.java @617859
+com.kamikaze.lucenetrunk.util.OpenBitSetIterator.java @617859
+
+These classes currently do not exist in any release branch for Lucene until 2.3.2, once they are available in a stable release branch, we will
+eliminate these classes and depend on the Lucene release jar directly.
+
+
0 README
No changes.
141 build.xml
@@ -0,0 +1,141 @@
+<project xmlns:ivy="antlib:org.apache.ivy.ant" name="lucene-ext" default="dist" basedir=".">
+ <property name="src" value="src" />
+ <property name="test" value="test" />
+ <property name="lib" location="lib" />
+ <property name="lib.master" location="${lib}/master" />
+ <property name="lib.test" location="${lib}/test" />
+ <property name="build" value="build" />
+ <property name="dist" value="dist" />
+ <property name="doc" value="doc" />
+ <property name="build.test" value="build-test" />
+ <property name="project.name" value="kamikaze" />
+ <property name="ivy.install.version" value="2.0.0-beta1"/>
+ <property name="ivy.jar.dir" value="${basedir}/ivy"/>
+ <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
+ <property name="test.report.dir" location="${dist}/junit-reports" />
+ <property name="test.html.dir" location="${test.report.dir}/html" />
+
+
+
+ <property file="${basedir}/version.properties" />
+
+ <target name="download-ivy" unless="skip.download">
+ <mkdir dir="${ivy.jar.dir}"/>
+ <echo message="installing ivy..."/>
+ <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
+ </target>
+
+ <target name="install-ivy" depends="download-ivy" description="--> install ivy">
+ <path id="ivy.lib.path">
+ <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
+ </path>
+ <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
+ </target>
+
+ <path id="compile.class.path">
+ <fileset dir="${lib.master}">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+
+ <path id="java.class.path">
+ <dirset dir="${build}">
+ <include name="**" />
+ </dirset>
+ <fileset dir="${lib.test}">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+
+ <path id="test.class.path">
+ <dirset dir="${build.test}">
+ <include name="**" />
+ </dirset>
+ </path>
+
+ <target name="clean">
+ <delete dir="${build}" />
+ <delete dir="${dist}" />
+ <delete dir="${build.test}"/>
+ </target>
+
+ <target name="resolve" description="--> retrieve dependencies with ivy" depends="install-ivy">
+ <ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact].[ext]" />
+ </target>
+
+ <target name="init" depends="resolve">
+ <mkdir dir="${build}" />
+ <mkdir dir="${dist}" />
+ <mkdir dir="${build.test}" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="${build}" debug="on">
+ <src path="${src}" />
+ <classpath refid="compile.class.path" />
+ </javac>
+ </target>
+
+ <target name="compile-test" depends="compile">
+ <javac destdir="${build.test}">
+ <classpath refid="compile.class.path" />
+ <classpath refid="java.class.path" />
+ <src path="${test}" />
+ </javac>
+ </target>
+
+
+
+
+ <target name="test" description="Runs JUnit Tests" depends="compile-test">
+ <echo>=== Running JUnit Tests ===</echo>
+ <mkdir dir="${test.report.dir}" />
+ <mkdir dir="${test.html.dir}" />
+
+ <junit printsummary="yes" showoutput="yes" haltonfailure="yes">
+ <classpath refid="compile.class.path" />
+ <classpath refid="java.class.path" />
+ <classpath refid="test.class.path" />
+ <formatter type="plain" />
+ <!--
+ <jvmarg value="-d64" />
+ <jvmarg value="-Xms2G" />
+ <jvmarg value="-Xmx4G" />
+ -->
+ <jvmarg value="-Xms1g" />
+ <jvmarg value="-Xmx1500m" />
+
+ <test name="com.kamikaze.test.TestDocIdSetSuite" todir="${test.report.dir}" haltonfailure="yes" fork="yes">
+ <formatter type="xml"/>
+ </test>
+ </junit>
+ <junitreport todir="${test.html.dir}">
+ <fileset dir="${test.report.dir}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report todir="${test.html.dir}" format="frames" />
+ </junitreport>
+ </target>
+
+ <target name="jar" depends="compile">
+ <jar destfile="${dist}/${project.name}-${version}.jar" basedir="${build}" />
+ </target>
+ <target name="javadoc" depends="init">
+ <javadoc packagenames="com.kamikaze.*" sourcepath="src" defaultexcludes="yes" destdir="${doc}" author="true" version="true" use="true" windowtitle="Kamikaze">
+ <classpath refid="compile.class.path" />
+ <classpath refid="java.class.path" />
+ <doctitle>
+ <![CDATA[<h1>Kamikaze</h1>]]></doctitle>
+ <tag name="todo" scope="all" description="To do:" />
+ <group title="Group 1 Packages" packages="com.dummy.test.a*" />
+ <group title="Group 2 Packages" packages="com.dummy.test.b*:com.dummy.test.c*" />
+ <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="C:\tmp" />
+ <link href="http://developer.java.sun.com/developer/products/xml/docs/api/" />
+ </javadoc>
+
+</target>
+<target name="dist" depends="jar,javadoc">
+
+</target>
+
+</project>
15 ivy.xml
@@ -0,0 +1,15 @@
+<ivy-module version="2.0">
+ <info organisation="com.kamikaze" module="kamikaze"/>
+ <configurations>
+ <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
+ <conf name="test" visibility="private" description="is only available for the test compilation and execution phases."/>
+ </configurations>
+ <publications>
+ <artifact name="kamikaze" type="jar" ext="jar" conf="master" />
+ </publications>
+ <dependencies>
+ <dependency org="junit" name="junit" rev="4.5" conf="test->master"/>
+ <dependency org="log4j" name="log4j" rev="1.2.15" conf="master"/>
+ <dependency org="org.apache.lucene" name="lucene-core" rev="3.0.0" conf="master"/>
+ </dependencies>
+</ivy-module>
@@ -0,0 +1,66 @@
+package com.kamikaze.docidset.api;
+
+import java.io.IOException;
+
+import org.apache.lucene.search.DocIdSet;
+
+
+/**
+ * Represents a sorted integer set
+ */
+
+public abstract class DocSet extends DocIdSet
+{
+ /**
+ * Add a doc id to the set
+ * @param docid
+ */
+ public abstract void addDoc(int docid) throws IOException;
+
+
+ /**
+ * Return the set size
+ * @return true if present, false otherwise
+ */
+ public boolean find(int val) throws IOException
+ {
+ return findWithIndex(val)>-1?true:false;
+ }
+
+ /**
+ * Return the set size
+ * @return index if present, -1 otherwise
+ */
+ public int findWithIndex(int val) throws IOException
+ {
+ return -1;
+ }
+
+ /**
+ * Gets the number of ids in the set
+ * @return size of the docset
+ */
+ public int size() throws IOException
+ {
+ return 0;
+ }
+
+ /**
+ * Return the set size in bytes
+ * @return index if present, -1 otherwise
+ */
+ public long sizeInBytes() throws IOException
+ {
+ return 0;
+ }
+
+ /**
+ * Optimize by trimming underlying data structures
+ */
+ public void optimize() throws IOException
+ {
+ return;
+ }
+
+
+}
@@ -0,0 +1,34 @@
+package com.kamikaze.docidset.api;
+
+/**
+ * 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.
+ *
+ * NOTICE : This classes currently does not exist in any release branch for Lucene until 2.3.2,
+ * once they are available in a stable release branch, we will eliminate these classes and depend
+ * on the Lucene release jar directly.
+ * DATE : 07/14/08
+ *
+ */
+
+
+
+/**
+ * This abstract class defines methods to iterate over a set of
+ * non-decreasing doc ids.
+ */
+public abstract class StatefulDSIterator extends org.apache.lucene.search.DocIdSetIterator{
+ abstract public int getCursor();
+}
@@ -0,0 +1,39 @@
+package com.kamikaze.docidset.bitset;
+
+import java.io.Serializable;
+
+import org.apache.lucene.util.OpenBitSet;
+
+public class MyOpenBitSet extends OpenBitSet implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ public MyOpenBitSet()
+ {
+ super();
+ }
+
+ public MyOpenBitSet(long numBits)
+ {
+ super(numBits);
+ }
+
+
+
+ /** Set 0/1 at the specified index.
+ * Note: The value for the bitVal is not checked for 0/1, hence incorrect values passed
+ * lead to unexpected results
+ *
+ * @param index
+ * @param bitVal
+ */
+ public void fastSetAs(long index, int bitVal)
+ {
+
+ int wordNum = (int)(index >> 6);
+ int bit = (int)index & 0x3f;
+ long bitmask = ((long)bitVal) << bit;
+ bits[wordNum] |= bitmask;
+
+ }
+}
@@ -0,0 +1,17 @@
+package com.kamikaze.docidset.compression;
+
+import java.util.BitSet;
+
+import org.apache.lucene.util.OpenBitSet;
+
+public interface CompressedSortedIntegerSegment {
+
+ public OpenBitSet compress(int[] inputSet) throws IllegalArgumentException;
+
+ public long[] compressAlt(int[] inputSet) throws IllegalArgumentException;
+
+ public int[] decompress(BitSet packedSet) throws IllegalArgumentException;
+
+ public int[] decompress(OpenBitSet packedSet);
+
+}
Oops, something went wrong.

0 comments on commit 2cc319b

Please sign in to comment.