Package org.apache.lucene.facet.taxonomy
Class FacetLabel
- java.lang.Object
-
- org.apache.lucene.facet.taxonomy.FacetLabel
-
- All Implemented Interfaces:
Comparable<FacetLabel>
public class FacetLabel extends Object implements Comparable<FacetLabel>
Holds a sequence of string components, specifying the hierarchical name of a category.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description String[]componentsThe components of thisFacetLabel.intlengthThe number of components of thisFacetLabel.static intMAX_CATEGORY_PATH_LENGTHThe maximum number of characters aFacetLabelcan have.
-
Constructor Summary
Constructors Constructor Description FacetLabel(String... components)Construct from the given path components.FacetLabel(String dim, String[] path)Construct from the dimension plus the given path components.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(FacetLabel other)Compares this path with anotherFacetLabelfor lexicographic order.booleanequals(Object obj)inthashCode()StringlastComponent()Get the last component.longlongHashCode()Calculate a 64-bit hash function for this path.FacetLabelsubpath(int length)Returns a sub-path of this path up tolengthcomponents.StringtoString()Returns a string representation of the path.
-
-
-
Field Detail
-
MAX_CATEGORY_PATH_LENGTH
public static final int MAX_CATEGORY_PATH_LENGTH
The maximum number of characters aFacetLabelcan have.- See Also:
- Constant Field Values
-
components
public final String[] components
The components of thisFacetLabel. Note that this array may be shared with otherFacetLabelinstances, e.g. as a result ofsubpath(int), therefore you should traverse the array up tolengthfor this path's components.
-
length
public final int length
The number of components of thisFacetLabel.
-
-
Method Detail
-
compareTo
public int compareTo(FacetLabel other)
Compares this path with anotherFacetLabelfor lexicographic order.- Specified by:
compareToin interfaceComparable<FacetLabel>
-
longHashCode
public long longHashCode()
Calculate a 64-bit hash function for this path. This is necessary forNameHashIntCacheLRU(the default cache impl forLruTaxonomyWriterCache) to reduce the chance of "silent but deadly" collisions.
-
subpath
public FacetLabel subpath(int length)
Returns a sub-path of this path up tolengthcomponents.
-
lastComponent
public String lastComponent()
Get the last component.
-
-