com.partnersoft.io.formats.dump
Class InMemoryStringIndex

java.lang.Object
  extended by com.partnersoft.io.formats.dump.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.

Author:
Paul Reavis Copyright 2001 Partner Software, Inc.

Field Summary
 byte[][] data
           
 boolean loadData
           
 long[] offsets
           
 java.lang.String rememberMe
           
 java.lang.String[] strings
           
 
Constructor Summary
InMemoryStringIndex()
           
InMemoryStringIndex(boolean loadData)
           
 
Method Summary
 void appendToDump(NamedObjectDumpBuilder builder)
           
 int compare(int index)
          Compares the key of the item at the given index with the current remembered key.
 int getSize()
          Returns the number of items in the array.
 java.lang.Object keyAt(int index)
           
 void loadFromDump(java.lang.String dumpPath)
           
 void remember(int index)
          Remembers the key at the given index for future comparisons.
 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

rememberMe

public java.lang.String rememberMe
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()

remember

public void remember(int index)
Description copied from interface: ArraySortingGopher
Remembers the key at the given index for future comparisons.

Specified by:
remember in interface ArraySortingGopher

compare

public int compare(int index)
Description copied from interface: ArraySortingGopher
Compares the key of the item at the given index with the current remembered key.

Specified by:
compare in interface ArraySortingGopher

keyAt

public java.lang.Object keyAt(int index)

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