Home / Class/ Bzip2DivSufSort Class — netty Architecture

Bzip2DivSufSort Class — netty Architecture

Architecture documentation for the Bzip2DivSufSort class in Bzip2DivSufSort.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba["Bzip2DivSufSort"]
  38cca598_67d5_49f5_7c5c_a57149abdf75["Bzip2DivSufSort.java"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|defined in| 38cca598_67d5_49f5_7c5c_a57149abdf75
  6244725b_a4f6_7f33_ee9a_8f6eb03feaea["Bzip2DivSufSort()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 6244725b_a4f6_7f33_ee9a_8f6eb03feaea
  6cd08680_5bba_3632_1ac7_b77001ad18fa["swapElements()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 6cd08680_5bba_3632_1ac7_b77001ad18fa
  4de771c8_37be_d30e_9a72_bab498988da7["ssCompare()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 4de771c8_37be_d30e_9a72_bab498988da7
  0f3081f4_c454_deea_e5ba_2db21526a3da["ssCompareLast()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 0f3081f4_c454_deea_e5ba_2db21526a3da
  b61e4a7c_22ee_fad9_f021_387b63f20ea1["ssInsertionSort()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| b61e4a7c_22ee_fad9_f021_387b63f20ea1
  714c6073_5359_c901_e325_0408748a36a1["ssFixdown()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 714c6073_5359_c901_e325_0408748a36a1
  d34a90df_0d9e_75f0_92a2_6d656258f8df["ssHeapSort()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| d34a90df_0d9e_75f0_92a2_6d656258f8df
  1524ff0b_6a7d_e4a0_e279_558af4483f88["ssMedian3()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 1524ff0b_6a7d_e4a0_e279_558af4483f88
  69e78768_93e6_1f0a_fada_a1683eeef211["ssMedian5()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 69e78768_93e6_1f0a_fada_a1683eeef211
  d160bbb0_c87d_6d18_8679_b2d63009caeb["ssPivot()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| d160bbb0_c87d_6d18_8679_b2d63009caeb
  3ae742b6_1714_5da6_551e_2e003765cd05["ssLog()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 3ae742b6_1714_5da6_551e_2e003765cd05
  25964735_0d27_2e4b_ef37_17c6848ccf23["ssSubstringPartition()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 25964735_0d27_2e4b_ef37_17c6848ccf23
  1e0c07d3_ab29_8c77_bb12_13a34e73c315["ssMultiKeyIntroSort()"]
  5a60cb70_bf06_95bf_9c73_ed3a4dc24eba -->|method| 1e0c07d3_ab29_8c77_bb12_13a34e73c315

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java lines 25–2117

final class Bzip2DivSufSort {

    private static final int STACK_SIZE = 64;
    private static final int BUCKET_A_SIZE = 256;
    private static final int BUCKET_B_SIZE = 65536;
    private static final int SS_BLOCKSIZE = 1024;
    private static final int INSERTIONSORT_THRESHOLD = 8;

    private static final int[] LOG_2_TABLE = {
        -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
         5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
         6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
         6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
    };

    private final int[] SA;
    private final byte[] T;
    private final int n;

    /**
     * @param block The input array
     * @param bwtBlock The output array
     * @param blockLength The length of the input data
     */
    Bzip2DivSufSort(final byte[] block, final int[] bwtBlock, final int blockLength) {
        T = block;
        SA = bwtBlock;
        n = blockLength;
    }

    private static void swapElements(final int[] array1, final int idx1, final int[] array2, final int idx2) {
        final int temp = array1[idx1];
        array1[idx1] = array2[idx2];
        array2[idx2] = temp;
    }

    private int ssCompare(final int p1, final int p2, final int depth) {
        final int[] SA = this.SA;
        final byte[] T = this.T;

        // pointers within T
        final int U1n = SA[p1 + 1] + 2;
        final int  U2n = SA[p2 + 1] + 2;

        int U1 = depth + SA[p1];
        int U2 = depth + SA[p2];

        while (U1 < U1n && U2 < U2n && T[U1] == T[U2]) {
            ++U1;
            ++U2;
        }

        return U1 < U1n ?
                   U2 < U2n ? (T[U1] & 0xff) - (T[U2] & 0xff) : 1
                 : U2 < U2n ? -1 : 0;
    }

    private int ssCompareLast(int pa, int p1, int p2, int depth, int size) {
        final int[] SA = this.SA;
        final byte[] T = this.T;

        int U1 = depth + SA[p1];
        int U2 = depth + SA[p2];
        int U1n = size;
        int U2n = SA[p2 + 1] + 2;

        while (U1 < U1n && U2 < U2n && T[U1] == T[U2]) {
            ++U1;
            ++U2;
        }

        if (U1 < U1n) {
            return U2 < U2n ? (T[U1] & 0xff) - (T[U2] & 0xff) : 1;
        }
        if (U2 == U2n) {
            return 1;
        }

Frequently Asked Questions

What is the Bzip2DivSufSort class?
Bzip2DivSufSort is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java.
Where is Bzip2DivSufSort defined?
Bzip2DivSufSort is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java at line 25.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free