Package org.apache.lucene.facet.facetset

## Class FacetSet

- java.lang.Object
- - org.apache.lucene.facet.facetset.FacetSet

- Direct Known Subclasses:
    `DoubleFacetSet`, `FloatFacetSet`, `IntFacetSet`, `LongFacetSet`

      public abstract class FacetSet
      extends Object

  Holds a set of facet dimension values.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `int` | `dims` | The number of dimension values in this set.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `FacetSet​(int dims)` | Constructs a new instance of a facet set with the given number of dimensions.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract long[]` | `getComparableValues()` | Returns the dimension values in this facet set as comparable longs.
    `int` | `packValues​(byte[] buf, int start)` | Packs the dimension values into the given `byte[]` and returns the number of packed-values bytes.
    `int` | `sizePackedBytes()` | Returns the size of the packed values in this facet set.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### dims

          public final int dims

      The number of dimension values in this set.

  - ### Constructor Detail

    - #### FacetSet

          protected FacetSet​(int dims)

      Constructs a new instance of a facet set with the given number of dimensions.

  - ### Method Detail

    - #### getComparableValues

          public abstract long[] getComparableValues()

      Returns the dimension values in this facet set as comparable longs.

    - #### packValues

          public int packValues​(byte[] buf,
                                int start)

      Packs the dimension values into the given `byte[]` and returns the number of packed-values bytes. The default implementation packs the `comparable values`, and you can override to implement your own scheme.

    - #### sizePackedBytes

          public int sizePackedBytes()

      Returns the size of the packed values in this facet set. If the value is unknown in advance (e.g. if the values are compressed), this method can return an upper limit. The default implementations returns `dims * Long.BYTES` per the default implementation of `packValues(byte[], int)`. You should override if you implement `packValues(byte[], int)` differently.