org.apache.lucene.util.packed

## Enum PackedInts.Format

- java.lang.Object
- - java.lang.Enum<PackedInts.Format>
  - - org.apache.lucene.util.packed.PackedInts.Format

- All Implemented Interfaces:
    Serializable, Comparable<PackedInts.Format>
  Enclosing class:
    PackedInts

      public static enum PackedInts.Format
      extends Enum<PackedInts.Format>

  A format to write packed ints.
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `PACKED` Compact format, all bits are written contiguously.
    `PACKED_SINGLE_BLOCK` A format that may insert padding bits to improve encoding and decoding speed.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `id`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PackedInts.Format` | `byId(int id)` Get a format according to its ID.
    `long` | `byteCount(int packedIntsVersion, int valueCount, int bitsPerValue)` Computes how many byte blocks are needed to store `values` values of size `bitsPerValue`.
    `int` | `getId()` Returns the ID of the format.
    `boolean` | `isSupported(int bitsPerValue)` Tests whether the provided number of bits per value is supported by the format.
    `int` | `longCount(int packedIntsVersion, int valueCount, int bitsPerValue)` Computes how many long blocks are needed to store `values` values of size `bitsPerValue`.
    `float` | `overheadPerValue(int bitsPerValue)` Returns the overhead per value, in bits.
    `float` | `overheadRatio(int bitsPerValue)` Returns the overhead ratio (`overhead per value / bits per value`).
    `static PackedInts.Format` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static PackedInts.Format[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### PACKED

          public static final PackedInts.Format PACKED

      Compact format, all bits are written contiguously.

    - #### PACKED_SINGLE_BLOCK

          public static final PackedInts.Format PACKED_SINGLE_BLOCK

      A format that may insert padding bits to improve encoding and decoding speed. Since this format doesn't support all possible bits per value, you should never use it directly, but rather use `PackedInts.fastestFormatAndBits(int, int, float)` to find the format that best suits your needs.

  - ### Field Detail

    - #### id

          public int id

  - ### Method Detail

    - #### values

          public static PackedInts.Format[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (PackedInts.Format c : PackedInts.Format.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static PackedInts.Format valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### byId

          public static PackedInts.Format byId(int id)

      Get a format according to its ID.

    - #### getId

          public int getId()

      Returns the ID of the format.

    - #### byteCount

          public long byteCount(int packedIntsVersion,
                                int valueCount,
                                int bitsPerValue)

      Computes how many byte blocks are needed to store `values` values of size `bitsPerValue`.

    - #### longCount

          public int longCount(int packedIntsVersion,
                               int valueCount,
                               int bitsPerValue)

      Computes how many long blocks are needed to store `values` values of size `bitsPerValue`.

    - #### isSupported

          public boolean isSupported(int bitsPerValue)

      Tests whether the provided number of bits per value is supported by the format.

    - #### overheadPerValue

          public float overheadPerValue(int bitsPerValue)

      Returns the overhead per value, in bits.

    - #### overheadRatio

          public final float overheadRatio(int bitsPerValue)

      Returns the overhead ratio (`overhead per value / bits per value`).

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