com.partnersoft.v3x.io.formats
Class InMemoryStringIndex

java.lang.Object
  extended by com.partnersoft.v3x.io.formats.InMemoryStringIndex
All Implemented Interfaces:
ArraySortingGopher

public class InMemoryStringIndex
extends java.lang.Object
implements ArraySortingGopher

This is a gadget to allow in-memory sorting of a NamedObjectStore.


Field Summary
 byte[][] data
           
 boolean loadData
           
 long[] offsets
           
 java.lang.String[] strings
           
 
Constructor Summary
InMemoryStringIndex()
           
InMemoryStringIndex(boolean loadData)
           
 
Method Summary
 void appendToDump(NamedObjectDumpBuilder builder)
           
 int compare(int index, java.lang.Object key)
          Compares the key of the item at the given index using the key given, based on the default ordering.
 int compare(int index, java.lang.Object key, java.util.Comparator comp)
          Compares the key of the item at the given index using the key and ordering given.
 int getSize()
          Returns the number of items in the array.
 java.lang.Object keyAt(int index)
          Gets the key object from the given index.
 void loadFromDump(java.lang.String dumpPath)
           
 void saveToDump(java.lang.String dumpPath)
           
 void sort()
           
static void sortNamedObjectDump(java.lang.String dumpPath)
           
 void swap(int a, int b)
          Swaps the items at the two index positions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strings

public java.lang.String[] strings

offsets

public long[] offsets

data

public byte[][] data

loadData

public boolean loadData
Constructor Detail

InMemoryStringIndex

public InMemoryStringIndex()

InMemoryStringIndex

public InMemoryStringIndex(boolean loadData)
Method Detail

sortNamedObjectDump

public static void sortNamedObjectDump(java.lang.String dumpPath)
                                throws java.io.IOException
Throws:
java.io.IOException

loadFromDump

public void loadFromDump(java.lang.String dumpPath)
                  throws java.io.IOException
Throws:
java.io.IOException

saveToDump

public void saveToDump(java.lang.String dumpPath)
                throws java.io.IOException
Throws:
java.io.IOException

appendToDump

public void appendToDump(NamedObjectDumpBuilder builder)
                  throws java.io.IOException
Throws:
java.io.IOException

sort

public void sort()

compare

public int compare(int index,
                   java.lang.Object key)
Description copied from interface: ArraySortingGopher
Compares the key of the item at the given index using the key given, based on the default ordering.

Specified by:
compare in interface ArraySortingGopher

compare

public int compare(int index,
                   java.lang.Object key,
                   java.util.Comparator comp)
Description copied from interface: ArraySortingGopher
Compares the key of the item at the given index using the key and ordering given.

Specified by:
compare in interface ArraySortingGopher

keyAt

public java.lang.Object keyAt(int index)
Description copied from interface: ArraySortingGopher
Gets the key object from the given index.

Specified by:
keyAt in interface ArraySortingGopher

getSize

public int getSize()
Description copied from interface: ArraySortingGopher
Returns the number of items in the array.

Specified by:
getSize in interface ArraySortingGopher

swap

public void swap(int a,
                 int b)
Description copied from interface: ArraySortingGopher
Swaps the items at the two index positions.

Specified by:
swap in interface ArraySortingGopher