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 and Description
    --- | ---
    `String[]` | `components` The components of this `FacetLabel`.
    `int` | `length` The number of components of this `FacetLabel`.
    `static int` | `MAX_CATEGORY_PATH_LENGTH` The maximum number of characters a `FacetLabel` can have.

  - ### Constructor Summary

    Constructors
    Constructor and 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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(FacetLabel other)` Compares this path with another `FacetLabel` for lexicographic order.
    `boolean` | `equals(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 to `length` components.
    `String` | `toString()` Returns a string representation of the path.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### MAX_CATEGORY_PATH_LENGTH

          public static final int MAX_CATEGORY_PATH_LENGTH

      The maximum number of characters a `FacetLabel` can have.
      See Also:
        Constant Field Values

    - #### components

          public final String[] components

      The components of this `FacetLabel`. Note that this array may be shared with other `FacetLabel` instances, e.g. as a result of `subpath(int)`, therefore you should traverse the array up to `length` for this path's components.

    - #### length

          public final int length

      The number of components of this `FacetLabel`.

  - ### Constructor Detail

    - #### FacetLabel

          public FacetLabel(String... components)

      Construct from the given path components.

    - #### FacetLabel

          public FacetLabel(String dim,
                    String[] path)

      Construct from the dimension plus the given path components.

  - ### Method Detail

    - #### compareTo

          public int compareTo(FacetLabel other)

      Compares this path with another `FacetLabel` for lexicographic order.
      Specified by:
        `compareTo` in interface `Comparable<FacetLabel>`

    - #### 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. This is necessary for `NameHashIntCacheLRU` (the default cache impl for `LruTaxonomyWriterCache`) to reduce the chance of "silent but deadly" collisions.

    - #### subpath

          public FacetLabel 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.
      Overrides:
        `toString` in class `Object`

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.