org.apache.lucene.facet.taxonomy.lucene
Class LuceneTaxonomyWriter.DiskOrdinalMap

java.lang.Object
  extended by org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter.DiskOrdinalMap
All Implemented Interfaces:
LuceneTaxonomyWriter.OrdinalMap
Enclosing class:
LuceneTaxonomyWriter

public static final class LuceneTaxonomyWriter.DiskOrdinalMap
extends Object
implements LuceneTaxonomyWriter.OrdinalMap

LuceneTaxonomyWriter.OrdinalMap maintained on file system


Constructor Summary
LuceneTaxonomyWriter.DiskOrdinalMap(File tmpfile)
           
 
Method Summary
 void addDone()
          Call addDone() to say that all addMapping() have been done.
 void addMapping(int origOrdinal, int newOrdinal)
           
 int[] getMap()
          Return the map from the taxonomy's original (consecutive) ordinals to the new taxonomy's ordinals.
 void setSize(int taxonomySize)
          Set the size of the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneTaxonomyWriter.DiskOrdinalMap

public LuceneTaxonomyWriter.DiskOrdinalMap(File tmpfile)
                                    throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

addMapping

public void addMapping(int origOrdinal,
                       int newOrdinal)
                throws IOException
Specified by:
addMapping in interface LuceneTaxonomyWriter.OrdinalMap
Throws:
IOException

setSize

public void setSize(int taxonomySize)
             throws IOException
Description copied from interface: LuceneTaxonomyWriter.OrdinalMap
Set the size of the map. This MUST be called before addMapping(). It is assumed (but not verified) that addMapping() will then be called exactly 'size' times, with different origOrdinals between 0 and size-1.

Specified by:
setSize in interface LuceneTaxonomyWriter.OrdinalMap
Throws:
IOException

addDone

public void addDone()
             throws IOException
Description copied from interface: LuceneTaxonomyWriter.OrdinalMap
Call addDone() to say that all addMapping() have been done. In some implementations this might free some resources.

Specified by:
addDone in interface LuceneTaxonomyWriter.OrdinalMap
Throws:
IOException

getMap

public int[] getMap()
             throws IOException
Description copied from interface: LuceneTaxonomyWriter.OrdinalMap
Return the map from the taxonomy's original (consecutive) ordinals to the new taxonomy's ordinals. If the map has to be read from disk and ordered appropriately, it is done when getMap() is called. getMap() should only be called once, and only when the map is actually needed. Calling it will also free all resources that the map might be holding (such as temporary disk space), other than the returned int[].

Specified by:
getMap in interface LuceneTaxonomyWriter.OrdinalMap
Throws:
IOException


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.