Package org.apache.lucene.facet.taxonomy
Class CategoryPath
java.lang.Object
org.apache.lucene.facet.taxonomy.CategoryPath
- All Implemented Interfaces:
Comparable<CategoryPath>
Holds a sequence of string components, specifying the hierarchical name of a
category.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal String[]The components of thisCategoryPath.static final CategoryPathAn emptyCategoryPathfinal intThe number of components of thisCategoryPath. -
Constructor Summary
ConstructorsConstructorDescriptionCategoryPath(String... components) Construct from the given path components.CategoryPath(String pathString, char delimiter) Construct from a given path, separating path components withdelimiter. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(CategoryPath other) Compares this path with anotherCategoryPathfor lexicographic order.intcopyFullPath(char[] buf, int start, char delimiter) Copies the path components to the givenchar[], starting at indexstart.booleanintReturns the number of characters needed to represent the path, including delimiter characters, for using withcopyFullPath(char[], int, char).inthashCode()longCalculate a 64-bit hash function for this path.subpath(int length) Returns a sub-path of this path up tolengthcomponents.toString()Returns a string representation of the path, separating components with '/'.toString(char delimiter) Returns a string representation of the path, separating components with the given delimiter.
-
Field Details
-
EMPTY
An emptyCategoryPath -
components
The components of thisCategoryPath. Note that this array may be shared with otherCategoryPathinstances, e.g. as a result ofsubpath(int), therefore you should traverse the array up tolengthfor this path's components. -
length
public final int lengthThe number of components of thisCategoryPath.
-
-
Constructor Details
-
CategoryPath
Construct from the given path components. -
CategoryPath
Construct from a given path, separating path components withdelimiter.
-
-
Method Details
-
fullPathLength
public int fullPathLength()Returns the number of characters needed to represent the path, including delimiter characters, for using withcopyFullPath(char[], int, char). -
compareTo
Compares this path with anotherCategoryPathfor lexicographic order.- Specified by:
compareToin interfaceComparable<CategoryPath>
-
copyFullPath
public int copyFullPath(char[] buf, int start, char delimiter) Copies the path components to the givenchar[], starting at indexstart.delimiteris copied between the path components. Returns the number of chars copied.NOTE: this method relies on the array being large enough to hold the components and separators - the amount of needed space can be calculated with
fullPathLength(). -
equals
-
hashCode
public int hashCode() -
longHashCode
public long longHashCode()Calculate a 64-bit hash function for this path. -
subpath
Returns a sub-path of this path up tolengthcomponents. -
toString
Returns a string representation of the path, separating components with '/'. -
toString
Returns a string representation of the path, separating components with the given delimiter.
-