Class CategoryPath

java.lang.Object
org.apache.lucene.facet.taxonomy.CategoryPath
All Implemented Interfaces:
Comparable<CategoryPath>

public class CategoryPath extends Object implements Comparable<CategoryPath>
Holds a sequence of string components, specifying the hierarchical name of a category.
  • Field Details

  • Constructor Details

    • CategoryPath

      public CategoryPath(String... components)
      Construct from the given path components.
    • CategoryPath

      public CategoryPath(String pathString, char delimiter)
      Construct from a given path, separating path components with delimiter.
  • Method Details

    • fullPathLength

      public int fullPathLength()
      Returns the number of characters needed to represent the path, including delimiter characters, for using with copyFullPath(char[], int, char).
    • compareTo

      public int compareTo(CategoryPath other)
      Compares this path with another CategoryPath for lexicographic order.
      Specified by:
      compareTo in interface Comparable<CategoryPath>
    • copyFullPath

      public int copyFullPath(char[] buf, int start, char delimiter)
      Copies the path components to the given char[], starting at index start. delimiter is 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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • longHashCode

      public long longHashCode()
      Calculate a 64-bit hash function for this path.
    • subpath

      public CategoryPath subpath(int length)
      Returns a sub-path of this path up to length components.
    • toString

      public String toString()
      Returns a string representation of the path, separating components with '/'.
      Overrides:
      toString in class Object
      See Also:
    • toString

      public String toString(char delimiter)
      Returns a string representation of the path, separating components with the given delimiter.