Package org.apache.lucene.facet.taxonomy
Class FacetLabel
- java.lang.Object
-
- org.apache.lucene.facet.taxonomy.FacetLabel
-
- All Implemented Interfaces:
java.lang.Comparable<FacetLabel>
public class FacetLabel extends java.lang.Object implements java.lang.Comparable<FacetLabel>
Holds a sequence of string components, specifying the hierarchical name of a category.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String[]
components
The components of thisFacetLabel
.int
length
The number of components of thisFacetLabel
.static int
MAX_CATEGORY_PATH_LENGTH
The maximum number of characters aFacetLabel
can have.
-
Constructor Summary
Constructors Constructor Description FacetLabel(java.lang.String... components)
Construct from the given path components.FacetLabel(java.lang.String dim, java.lang.String[] path)
Construct from the dimension plus the given path components.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(FacetLabel other)
Compares this path with anotherFacetLabel
for lexicographic order.boolean
equals(java.lang.Object obj)
int
hashCode()
long
longHashCode()
Calculate a 64-bit hash function for this path.FacetLabel
subpath(int length)
Returns a sub-path of this path up tolength
components.java.lang.String
toString()
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 aFacetLabel
can have.- See Also:
- Constant Field Values
-
components
public final java.lang.String[] components
The components of thisFacetLabel
. Note that this array may be shared with otherFacetLabel
instances, e.g. as a result ofsubpath(int)
, therefore you should traverse the array up tolength
for 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 anotherFacetLabel
for lexicographic order.- Specified by:
compareTo
in interfacejava.lang.Comparable<FacetLabel>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
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 tolength
components.
-
toString
public java.lang.String toString()
Returns a string representation of the path.- Overrides:
toString
in classjava.lang.Object
-
-