Class DirectoryTaxonomyWriter.DiskOrdinalMap
- java.lang.Object
-
- org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.DiskOrdinalMap
-
- All Implemented Interfaces:
DirectoryTaxonomyWriter.OrdinalMap
- Enclosing class:
- DirectoryTaxonomyWriter
public static final class DirectoryTaxonomyWriter.DiskOrdinalMap extends Object implements DirectoryTaxonomyWriter.OrdinalMap
DirectoryTaxonomyWriter.OrdinalMapmaintained on file system
-
-
Constructor Summary
Constructors Constructor Description DiskOrdinalMap(Path mapFile)Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDone()Call addDone() to say that all addMapping() have been done.voidaddMapping(int origOrdinal, int newOrdinal)Record a mapping.int[]getMap()Return the map from the taxonomy's original (consecutive) ordinals to the new taxonomy's ordinals.voidsetSize(int taxonomySize)Set the size of the map.
-
-
-
Constructor Detail
-
DiskOrdinalMap
public DiskOrdinalMap(Path mapFile) throws IOException
Sole constructor.- Throws:
IOException
-
-
Method Detail
-
addMapping
public void addMapping(int origOrdinal, int newOrdinal) throws IOExceptionDescription copied from interface:DirectoryTaxonomyWriter.OrdinalMapRecord a mapping.- Specified by:
addMappingin interfaceDirectoryTaxonomyWriter.OrdinalMap- Throws:
IOException
-
setSize
public void setSize(int taxonomySize) throws IOExceptionDescription copied from interface:DirectoryTaxonomyWriter.OrdinalMapSet 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:
setSizein interfaceDirectoryTaxonomyWriter.OrdinalMap- Throws:
IOException
-
addDone
public void addDone() throws IOExceptionDescription copied from interface:DirectoryTaxonomyWriter.OrdinalMapCall addDone() to say that all addMapping() have been done. In some implementations this might free some resources.- Specified by:
addDonein interfaceDirectoryTaxonomyWriter.OrdinalMap- Throws:
IOException
-
getMap
public int[] getMap() throws IOExceptionDescription copied from interface:DirectoryTaxonomyWriter.OrdinalMapReturn 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:
getMapin interfaceDirectoryTaxonomyWriter.OrdinalMap- Throws:
IOException
-
-