Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
javasoze committed Feb 27, 2010
0 parents commit 2cc319b
Show file tree
Hide file tree
Showing 43 changed files with 10,485 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .classpath
@@ -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>
17 changes: 17 additions & 0 deletions .project
@@ -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>
256 changes: 256 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
#Thu Jun 26 09:39:38 PDT 2008
eclipse.preferences.version=1
formatter_profile=_Lucene
formatter_settings_version=11
18 changes: 18 additions & 0 deletions NOTICE.txt
@@ -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.


Empty file added README
Empty file.
141 changes: 141 additions & 0 deletions 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 changes: 15 additions & 0 deletions 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>
66 changes: 66 additions & 0 deletions src/com/kamikaze/docidset/api/DocSet.java
@@ -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;
}


}
34 changes: 34 additions & 0 deletions src/com/kamikaze/docidset/api/StatefulDSIterator.java
@@ -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();
}
39 changes: 39 additions & 0 deletions src/com/kamikaze/docidset/bitset/MyOpenBitSet.java
@@ -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);

}

0 comments on commit 2cc319b

Please sign in to comment.