DirectoryTaxonomyWriter.MemoryOrdinalMap (Lucene 10.5.1 facet API)
Description: declaration: package: org.apache.lucene.facet.taxonomy.directory, class: DirectoryTaxonomyWriter, class: MemoryOrdinalMap

Package org.apache.lucene.facet.taxonomy.directory

# Class DirectoryTaxonomyWriter.MemoryOrdinalMap

java.lang.Object
org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.MemoryOrdinalMap

All Implemented Interfaces:
  `DirectoryTaxonomyWriter.OrdinalMap`

Enclosing class:
  `DirectoryTaxonomyWriter`

public static final class DirectoryTaxonomyWriter.MemoryOrdinalMap extends Object implements DirectoryTaxonomyWriter.OrdinalMap
`DirectoryTaxonomyWriter.OrdinalMap` maintained in memory

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MemoryOrdinalMap()`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addDone()`
  Call addDone() to say that all addMapping() have been done.
  `void`
  `addMapping(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.
  `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 Details

  - ### MemoryOrdinalMap

    public MemoryOrdinalMap()
    Sole constructor.

- ## Method Details

  - ### setSize

    public void setSize(int taxonomySize)
    Description copied from interface: `DirectoryTaxonomyWriter.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 `DirectoryTaxonomyWriter.OrdinalMap`

  - ### addMapping

    public void addMapping(int origOrdinal, int newOrdinal)
    Description copied from interface: `DirectoryTaxonomyWriter.OrdinalMap`
    Record a mapping.
    Specified by:
      `addMapping` in interface `DirectoryTaxonomyWriter.OrdinalMap`

  - ### addDone

    public void addDone()
    Description copied from interface: `DirectoryTaxonomyWriter.OrdinalMap`
    Call addDone() to say that all addMapping() have been done. In some implementations this might free some resources.
    Specified by:
      `addDone` in interface `DirectoryTaxonomyWriter.OrdinalMap`

  - ### getMap

    public int[] getMap()
    Description copied from interface: `DirectoryTaxonomyWriter.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 `DirectoryTaxonomyWriter.OrdinalMap`