Module org.apache.lucene.facet
Class TaxonomyIndexArrays
java.lang.Object
org.apache.lucene.facet.taxonomy.ParallelTaxonomyArrays
org.apache.lucene.facet.taxonomy.directory.TaxonomyIndexArrays
- All Implemented Interfaces:
Accountable
A
ParallelTaxonomyArrays that are initialized from the taxonomy index.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classNested classes/interfaces inherited from class org.apache.lucene.facet.taxonomy.ParallelTaxonomyArrays
ParallelTaxonomyArrays.IntArray -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int(package private) static final intprivate static final intprivate booleanprivate final TaxonomyIndexArrays.ChunkedIntArrayFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionTaxonomyIndexArrays(int[][] parents) Used byadd(int, int)after the array grew.TaxonomyIndexArrays(IndexReader reader) TaxonomyIndexArrays(IndexReader reader, TaxonomyIndexArrays copyFrom) -
Method Summary
Modifier and TypeMethodDescription(package private) TaxonomyIndexArraysadd(int ordinal, int parentOrdinal) Adds the given ordinal/parent info and returns either a new instance if the underlying array had to grow, or this instance otherwise.private static int[][]allocateChunkedArray(int size, int startFrom) children()Returns the children array, wherechildren[i]denotes the youngest child of category ordinali.private voidcomputeChildrenSiblings(int first) private static voidcopyChunkedArray(int[][] oldArray, int[][] newArray) Returns nested resources of this class.private voidinitChildrenSiblings(TaxonomyIndexArrays copyFrom) private static voidinitParents(int[][] parentsArray, IndexReader reader, int first) parents()Returns the parents array, whereparents[i]denotes the parent of category ordinali.longReturn the memory usage of this object in bytes.siblings()Returns the siblings array, wheresiblings[i]denotes the sibling of category ordinali.
-
Field Details
-
CHUNK_SIZE_BITS
private static final int CHUNK_SIZE_BITS- See Also:
-
CHUNK_SIZE
static final int CHUNK_SIZE- See Also:
-
CHUNK_MASK
private static final int CHUNK_MASK- See Also:
-
parents
-
initializedChildren
private volatile boolean initializedChildren -
children
-
siblings
-
-
Constructor Details
-
TaxonomyIndexArrays
TaxonomyIndexArrays(int[][] parents) Used byadd(int, int)after the array grew. Also, used for testing. -
TaxonomyIndexArrays
- Throws:
IOException
-
TaxonomyIndexArrays
- Throws:
IOException
-
-
Method Details
-
allocateChunkedArray
private static int[][] allocateChunkedArray(int size, int startFrom) -
copyChunkedArray
private static void copyChunkedArray(int[][] oldArray, int[][] newArray) -
initChildrenSiblings
-
computeChildrenSiblings
private void computeChildrenSiblings(int first) -
initParents
private static void initParents(int[][] parentsArray, IndexReader reader, int first) throws IOException - Throws:
IOException
-
add
Adds the given ordinal/parent info and returns either a new instance if the underlying array had to grow, or this instance otherwise.NOTE: you should call this method from a thread-safe code.
-
parents
Returns the parents array, whereparents[i]denotes the parent of category ordinali.- Specified by:
parentsin classParallelTaxonomyArrays
-
children
Returns the children array, wherechildren[i]denotes the youngest child of category ordinali. The youngest child is defined as the category that was added last to the taxonomy as an immediate child ofi.- Specified by:
childrenin classParallelTaxonomyArrays
-
siblings
Returns the siblings array, wheresiblings[i]denotes the sibling of category ordinali. The sibling is defined as the previous youngest child ofparents[i].- Specified by:
siblingsin classParallelTaxonomyArrays
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
getChildResources
Description copied from interface:AccountableReturns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).- Specified by:
getChildResourcesin interfaceAccountable- See Also:
-