org.qtunes.db.spi.simple
Class BitSetTextIndex

java.lang.Object
  extended by org.qtunes.db.spi.simple.BitSetTextIndex
All Implemented Interfaces:
Serializable, TextIndex

public class BitSetTextIndex
extends Object
implements TextIndex, Serializable

Simple index based on BitSet per letter. Example: BitSetTextIndex searcher = new BitSetTextIndex(); searcher.add(index, "phrase"); // repeat BitSet found = searcher.get("hra"); // found contains index

See Also:
Serialized Form

Constructor Summary
BitSetTextIndex()
           
 
Method Summary
 void add(BitSet indices, String phrase)
          Add the specified indices to the BitSetTextIndex, keyed on phrase
 void add(int index, String phrase)
          Add the specified index to the BitSetTextIndex, keyed on phrase
 void clear(BitSet set)
          Remove the specified indices from the BitSetTextIndex
 void clear(int index)
          Remove the specified index from the BitSetTextIndex
 BitSet get(String substring)
          Return a BitSet containing the indices that were added with a phrase containing the specified substring.
 void load(InputStream in)
          Load the TextIndex from the specified InputStream
static void main(String[] args)
           
 void save(OutputStream out)
          Save the TextIndex to the specified OutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitSetTextIndex

public BitSetTextIndex()
Method Detail

add

public void add(BitSet indices,
                String phrase)
Add the specified indices to the BitSetTextIndex, keyed on phrase

Specified by:
add in interface TextIndex

add

public void add(int index,
                String phrase)
Add the specified index to the BitSetTextIndex, keyed on phrase

Specified by:
add in interface TextIndex

clear

public void clear(int index)
Remove the specified index from the BitSetTextIndex

Specified by:
clear in interface TextIndex

clear

public void clear(BitSet set)
Remove the specified indices from the BitSetTextIndex

Specified by:
clear in interface TextIndex

get

public BitSet get(String substring)
Return a BitSet containing the indices that were added with a phrase containing the specified substring. If no matches are found the returned BitSet is empty

Specified by:
get in interface TextIndex

save

public void save(OutputStream out)
          throws IOException
Description copied from interface: TextIndex
Save the TextIndex to the specified OutputStream

Specified by:
save in interface TextIndex
Throws:
IOException

load

public void load(InputStream in)
          throws IOException
Description copied from interface: TextIndex
Load the TextIndex from the specified InputStream

Specified by:
load in interface TextIndex
Throws:
IOException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception