You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2009/04/15 02:27:33 UTC

svn commit: r765021 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java

Author: sebb
Date: Wed Apr 15 00:27:33 2009
New Revision: 765021

URL: http://svn.apache.org/viewvc?rev=765021&view=rev
Log:
Remove unused code

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java?rev=765021&r1=765020&r2=765021&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java Wed Apr 15 00:27:33 2009
@@ -162,167 +162,6 @@
                                         9841, 29524, 88573, 265720, 797161,
                                         2391484 };
 
-    /**
-     * This method is accessible by subclasses for historical
-     * purposes. If you don't know what it does then you don't need
-     * it.
-     */
-    protected static void hbMakeCodeLengths(char[] len, int[] freq,
-                                            int alphaSize, int maxLen) {
-        /*
-         * Nodes and heap entries run from 1. Entry 0 for both the heap and
-         * nodes is a sentinel.
-         */
-        final int[] heap = new int[MAX_ALPHA_SIZE * 2];
-        final int[] weight = new int[MAX_ALPHA_SIZE * 2];
-        final int[] parent = new int[MAX_ALPHA_SIZE * 2];
-
-        for (int i = alphaSize; --i >= 0;) {
-            weight[i + 1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
-        }
-
-        for (boolean tooLong = true; tooLong;) {
-            tooLong = false;
-
-            int nNodes = alphaSize;
-            int nHeap = 0;
-            heap[0] = 0;
-            weight[0] = 0;
-            parent[0] = -2;
-
-            for (int i = 1; i <= alphaSize; i++) {
-                parent[i] = -1;
-                nHeap++;
-                heap[nHeap] = i;
-
-                int zz = nHeap;
-                int tmp = heap[zz];
-                while (weight[tmp] < weight[heap[zz >> 1]]) {
-                    heap[zz] = heap[zz >> 1];
-                    zz >>= 1;
-                }
-                heap[zz] = tmp;
-            }
-
-            // assert (nHeap < (MAX_ALPHA_SIZE + 2)) : nHeap;
-
-            while (nHeap > 1) {
-                int n1 = heap[1];
-                heap[1] = heap[nHeap];
-                nHeap--;
-
-                int yy = 0;
-                int zz = 1;
-                int tmp = heap[1];
-
-                while (true) {
-                    yy = zz << 1;
-
-                    if (yy > nHeap) {
-                        break;
-                    }
-
-                    if ((yy < nHeap)
-                        && (weight[heap[yy + 1]] < weight[heap[yy]])) {
-                        yy++;
-                    }
-
-                    if (weight[tmp] < weight[heap[yy]]) {
-                        break;
-                    }
-
-                    heap[zz] = heap[yy];
-                    zz = yy;
-                }
-
-                heap[zz] = tmp;
-
-                int n2 = heap[1];
-                heap[1] = heap[nHeap];
-                nHeap--;
-
-                yy = 0;
-                zz = 1;
-                tmp = heap[1];
-
-                while (true) {
-                    yy = zz << 1;
-
-                    if (yy > nHeap) {
-                        break;
-                    }
-
-                    if ((yy < nHeap)
-                        && (weight[heap[yy + 1]] < weight[heap[yy]])) {
-                        yy++;
-                    }
-
-                    if (weight[tmp] < weight[heap[yy]]) {
-                        break;
-                    }
-
-                    heap[zz] = heap[yy];
-                    zz = yy;
-                }
-
-                heap[zz] = tmp;
-                nNodes++;
-                parent[n1] = parent[n2] = nNodes;
-
-                final int weight_n1 = weight[n1];
-                final int weight_n2 = weight[n2];
-                weight[nNodes] = (((weight_n1 & 0xffffff00)
-                                   + (weight_n2 & 0xffffff00))
-                                  |
-                                  (1 + (((weight_n1 & 0x000000ff)
-                                         > (weight_n2 & 0x000000ff))
-                                        ? (weight_n1 & 0x000000ff)
-                                        : (weight_n2 & 0x000000ff))
-                                   ));
-
-                parent[nNodes] = -1;
-                nHeap++;
-                heap[nHeap] = nNodes;
-
-                tmp = 0;
-                zz = nHeap;
-                tmp = heap[zz];
-                final int weight_tmp = weight[tmp];
-                while (weight_tmp < weight[heap[zz >> 1]]) {
-                    heap[zz] = heap[zz >> 1];
-                    zz >>= 1;
-                }
-                heap[zz] = tmp;
-
-            }
-
-            // assert (nNodes < (MAX_ALPHA_SIZE * 2)) : nNodes;
-
-            for (int i = 1; i <= alphaSize; i++) {
-                int j = 0;
-                int k = i;
-
-                for (int parent_k; (parent_k = parent[k]) >= 0;) {
-                    k = parent_k;
-                    j++;
-                }
-
-                len[i - 1] = (char) j;
-                if (j > maxLen) {
-                    tooLong = true;
-                }
-            }
-
-            if (tooLong) {
-                for (int i = 1; i < alphaSize; i++) {
-                    int j = weight[i] >> 8;
-                    j = 1 + (j >> 1);
-                    weight[i] = j << 8;
-                }
-            }
-        }
-    }
-
     private static void hbMakeCodeLengths(final byte[] len, final int[] freq,
                                           final Data dat, final int alphaSize,
                                           final int maxLen) {