com.partnersoft.maps.file
Class FindItemFile

java.lang.Object
  extended by com.partnersoft.maps.file.FindItemFile
All Implemented Interfaces:
FindItemIndex

public class FindItemFile
extends java.lang.Object
implements FindItemIndex

Somewhat simpler format for find items, using fixed-length records to allow faster access and in-place sorting.

Copyright 2009 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
FindItemFile(RoverSet roverSet, VfsFile file)
           
 
Method Summary
 void close()
           
 int closestIndexTo(java.lang.String name)
           
 int find(java.lang.String name)
           
 int[] findAll(java.lang.String name)
           
 int getIDAt(int index)
           
 java.lang.String getNameAt(int index)
           
 RoverSet getRoverSet()
           
 int getSize()
           
 int indexOf(java.lang.String name)
           
 int[] indexRangeFor(java.lang.String name)
          If the find item has duplicates, you might want to know what the range is.
 java.util.List<MapDataItem> listDataItems()
           
 java.util.List<java.lang.Integer> listIds()
           
 java.util.List<java.lang.String> listNames()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FindItemFile

public FindItemFile(RoverSet roverSet,
                    VfsFile file)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

close

public void close()

closestIndexTo

public int closestIndexTo(java.lang.String name)
Specified by:
closestIndexTo in interface FindItemIndex

find

public int find(java.lang.String name)
Specified by:
find in interface FindItemIndex

findAll

public int[] findAll(java.lang.String name)
Specified by:
findAll in interface FindItemIndex

getIDAt

public int getIDAt(int index)
Specified by:
getIDAt in interface FindItemIndex

getNameAt

public java.lang.String getNameAt(int index)
Specified by:
getNameAt in interface FindItemIndex

getRoverSet

public RoverSet getRoverSet()
Specified by:
getRoverSet in interface FindItemIndex

getSize

public int getSize()
Specified by:
getSize in interface FindItemIndex

indexOf

public int indexOf(java.lang.String name)
Specified by:
indexOf in interface FindItemIndex

indexRangeFor

public int[] indexRangeFor(java.lang.String name)
Description copied from interface: FindItemIndex
If the find item has duplicates, you might want to know what the range is. This returns the first and last entries with the same name. They will match if there's only one, and they'll both be -1 if there's no match.

Specified by:
indexRangeFor in interface FindItemIndex

listDataItems

public java.util.List<MapDataItem> listDataItems()
Specified by:
listDataItems in interface FindItemIndex

listIds

public java.util.List<java.lang.Integer> listIds()
Specified by:
listIds in interface FindItemIndex

listNames

public java.util.List<java.lang.String> listNames()
Specified by:
listNames in interface FindItemIndex