harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r647100 [3/9] - in /harmony/enhanced/classlib/trunk/modules/pack200/src: main/java/org/apache/harmony/pack200/ main/java/org/apache/harmony/pack200/bytecode/ main/java/org/apache/harmony/pack200/bytecode/forms/ test/java/org/apache/harmony/...
Date Fri, 11 Apr 2008 10:10:00 GMT
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java Fri Apr 11 03:09:38 2008
@@ -25,157 +25,186 @@
  */
 public class CodecEncoding {
 
-	/**
-	 * The canonical encodings are defined to allow a single byte to represent
-	 * one of the standard encodings. The following values are defined in the
-	 * Pack200 specification, and this array cannot be changed.
-	 */
-	private static final Codec[] canonicalCodec = { null, new BHSDCodec(1, 256),
-			new BHSDCodec(1, 256, 1), new BHSDCodec(1, 256, 0, 1),
-			new BHSDCodec(1, 256, 1, 1), new BHSDCodec(2, 256),
-			new BHSDCodec(2, 256, 1), new BHSDCodec(2, 256, 0, 1),
-			new BHSDCodec(2, 256, 1, 1), new BHSDCodec(3, 256),
-			new BHSDCodec(3, 256, 1), new BHSDCodec(3, 256, 0, 1),
-			new BHSDCodec(3, 256, 1, 1), new BHSDCodec(4, 256),
-			new BHSDCodec(4, 256, 1), new BHSDCodec(4, 256, 0, 1),
-			new BHSDCodec(4, 256, 1, 1), new BHSDCodec(5, 4), new BHSDCodec(5, 4, 1),
-			new BHSDCodec(5, 4, 2), new BHSDCodec(5, 16), new BHSDCodec(5, 16, 1),
-			new BHSDCodec(5, 16, 2), new BHSDCodec(5, 32), new BHSDCodec(5, 32, 1),
-			new BHSDCodec(5, 32, 2), new BHSDCodec(5, 64), new BHSDCodec(5, 64, 1),
-			new BHSDCodec(5, 64, 2), new BHSDCodec(5, 128), new BHSDCodec(5, 128, 1),
-			new BHSDCodec(5, 128, 2), new BHSDCodec(5, 4, 0, 1),
-			new BHSDCodec(5, 4, 1, 1), new BHSDCodec(5, 4, 2, 1),
-			new BHSDCodec(5, 16, 0, 1), new BHSDCodec(5, 16, 1, 1),
-			new BHSDCodec(5, 16, 2, 1), new BHSDCodec(5, 32, 0, 1),
-			new BHSDCodec(5, 32, 1, 1), new BHSDCodec(5, 32, 2, 1),
-			new BHSDCodec(5, 64, 0, 1), new BHSDCodec(5, 64, 1, 1),new BHSDCodec(5, 64, 2, 1),
-			new BHSDCodec(5, 128, 0, 1), new BHSDCodec(5, 128, 1, 1),
-			new BHSDCodec(5, 128, 2, 1), new BHSDCodec(2, 192),
-			new BHSDCodec(2, 224), new BHSDCodec(2, 240), new BHSDCodec(2, 248),
-			new BHSDCodec(2, 252), new BHSDCodec(2, 8, 0, 1), new BHSDCodec(2, 8, 1, 1),
-			new BHSDCodec(2, 16, 0, 1), new BHSDCodec(2, 16, 1, 1),
-			new BHSDCodec(2, 32, 0, 1), new BHSDCodec(2, 32, 1, 1),
-			new BHSDCodec(2, 64, 0, 1), new BHSDCodec(2, 64, 1, 1),
-			new BHSDCodec(2, 128, 0, 1), new BHSDCodec(2, 128, 1, 1),
-			new BHSDCodec(2, 192, 0, 1), new BHSDCodec(2, 192, 1, 1),
-			new BHSDCodec(2, 224, 0, 1), new BHSDCodec(2, 224, 1, 1),
-			new BHSDCodec(2, 240, 0, 1), new BHSDCodec(2, 240, 1, 1),
-			new BHSDCodec(2, 248, 0, 1), new BHSDCodec(2, 248, 1, 1),
-			new BHSDCodec(3, 192), new BHSDCodec(3, 224), new BHSDCodec(3, 240),
-			new BHSDCodec(3, 248), new BHSDCodec(3, 252), new BHSDCodec(3, 8, 0, 1),
-			new BHSDCodec(3, 8, 1, 1), new BHSDCodec(3, 16, 0, 1),
-			new BHSDCodec(3, 16, 1, 1), new BHSDCodec(3, 32, 0, 1),
-			new BHSDCodec(3, 32, 1, 1), new BHSDCodec(3, 64, 0, 1),
-			new BHSDCodec(3, 64, 1, 1), new BHSDCodec(3, 128, 0, 1),
-			new BHSDCodec(3, 128, 1, 1), new BHSDCodec(3, 192, 0, 1),
-			new BHSDCodec(3, 192, 1, 1), new BHSDCodec(3, 224, 0, 1),
-			new BHSDCodec(3, 224, 1, 1), new BHSDCodec(3, 240, 0, 1),
-			new BHSDCodec(3, 240, 1, 1), new BHSDCodec(3, 248, 0, 1),
-			new BHSDCodec(3, 248, 1, 1), new BHSDCodec(4, 192),
-			new BHSDCodec(4, 224), new BHSDCodec(4, 240), new BHSDCodec(4, 248),
-			new BHSDCodec(4, 252), new BHSDCodec(4, 8, 0, 1), new BHSDCodec(4, 8, 1, 1),
-			new BHSDCodec(4, 16, 0, 1), new BHSDCodec(4, 16, 1, 1),
-			new BHSDCodec(4, 32, 0, 1), new BHSDCodec(4, 32, 1, 1),
-			new BHSDCodec(4, 64, 0, 1), new BHSDCodec(4, 64, 1, 1),
-			new BHSDCodec(4, 128, 0, 1), new BHSDCodec(4, 128, 1, 1),
-			new BHSDCodec(4, 192, 0, 1), new BHSDCodec(4, 192, 1, 1),
-			new BHSDCodec(4, 224, 0, 1), new BHSDCodec(4, 224, 1, 1),
-			new BHSDCodec(4, 240, 0, 1), new BHSDCodec(4, 240, 1, 1),
-			new BHSDCodec(4, 248, 0, 1), new BHSDCodec(4, 248, 1, 1) };
+    /**
+     * The canonical encodings are defined to allow a single byte to represent
+     * one of the standard encodings. The following values are defined in the
+     * Pack200 specification, and this array cannot be changed.
+     */
+    private static final Codec[] canonicalCodec = { null,
+            new BHSDCodec(1, 256), new BHSDCodec(1, 256, 1),
+            new BHSDCodec(1, 256, 0, 1), new BHSDCodec(1, 256, 1, 1),
+            new BHSDCodec(2, 256), new BHSDCodec(2, 256, 1),
+            new BHSDCodec(2, 256, 0, 1), new BHSDCodec(2, 256, 1, 1),
+            new BHSDCodec(3, 256), new BHSDCodec(3, 256, 1),
+            new BHSDCodec(3, 256, 0, 1), new BHSDCodec(3, 256, 1, 1),
+            new BHSDCodec(4, 256), new BHSDCodec(4, 256, 1),
+            new BHSDCodec(4, 256, 0, 1), new BHSDCodec(4, 256, 1, 1),
+            new BHSDCodec(5, 4), new BHSDCodec(5, 4, 1),
+            new BHSDCodec(5, 4, 2), new BHSDCodec(5, 16),
+            new BHSDCodec(5, 16, 1), new BHSDCodec(5, 16, 2),
+            new BHSDCodec(5, 32), new BHSDCodec(5, 32, 1),
+            new BHSDCodec(5, 32, 2), new BHSDCodec(5, 64),
+            new BHSDCodec(5, 64, 1), new BHSDCodec(5, 64, 2),
+            new BHSDCodec(5, 128), new BHSDCodec(5, 128, 1),
+            new BHSDCodec(5, 128, 2), new BHSDCodec(5, 4, 0, 1),
+            new BHSDCodec(5, 4, 1, 1), new BHSDCodec(5, 4, 2, 1),
+            new BHSDCodec(5, 16, 0, 1), new BHSDCodec(5, 16, 1, 1),
+            new BHSDCodec(5, 16, 2, 1), new BHSDCodec(5, 32, 0, 1),
+            new BHSDCodec(5, 32, 1, 1), new BHSDCodec(5, 32, 2, 1),
+            new BHSDCodec(5, 64, 0, 1), new BHSDCodec(5, 64, 1, 1),
+            new BHSDCodec(5, 64, 2, 1), new BHSDCodec(5, 128, 0, 1),
+            new BHSDCodec(5, 128, 1, 1), new BHSDCodec(5, 128, 2, 1),
+            new BHSDCodec(2, 192), new BHSDCodec(2, 224),
+            new BHSDCodec(2, 240), new BHSDCodec(2, 248),
+            new BHSDCodec(2, 252), new BHSDCodec(2, 8, 0, 1),
+            new BHSDCodec(2, 8, 1, 1), new BHSDCodec(2, 16, 0, 1),
+            new BHSDCodec(2, 16, 1, 1), new BHSDCodec(2, 32, 0, 1),
+            new BHSDCodec(2, 32, 1, 1), new BHSDCodec(2, 64, 0, 1),
+            new BHSDCodec(2, 64, 1, 1), new BHSDCodec(2, 128, 0, 1),
+            new BHSDCodec(2, 128, 1, 1), new BHSDCodec(2, 192, 0, 1),
+            new BHSDCodec(2, 192, 1, 1), new BHSDCodec(2, 224, 0, 1),
+            new BHSDCodec(2, 224, 1, 1), new BHSDCodec(2, 240, 0, 1),
+            new BHSDCodec(2, 240, 1, 1), new BHSDCodec(2, 248, 0, 1),
+            new BHSDCodec(2, 248, 1, 1), new BHSDCodec(3, 192),
+            new BHSDCodec(3, 224), new BHSDCodec(3, 240),
+            new BHSDCodec(3, 248), new BHSDCodec(3, 252),
+            new BHSDCodec(3, 8, 0, 1), new BHSDCodec(3, 8, 1, 1),
+            new BHSDCodec(3, 16, 0, 1), new BHSDCodec(3, 16, 1, 1),
+            new BHSDCodec(3, 32, 0, 1), new BHSDCodec(3, 32, 1, 1),
+            new BHSDCodec(3, 64, 0, 1), new BHSDCodec(3, 64, 1, 1),
+            new BHSDCodec(3, 128, 0, 1), new BHSDCodec(3, 128, 1, 1),
+            new BHSDCodec(3, 192, 0, 1), new BHSDCodec(3, 192, 1, 1),
+            new BHSDCodec(3, 224, 0, 1), new BHSDCodec(3, 224, 1, 1),
+            new BHSDCodec(3, 240, 0, 1), new BHSDCodec(3, 240, 1, 1),
+            new BHSDCodec(3, 248, 0, 1), new BHSDCodec(3, 248, 1, 1),
+            new BHSDCodec(4, 192), new BHSDCodec(4, 224),
+            new BHSDCodec(4, 240), new BHSDCodec(4, 248),
+            new BHSDCodec(4, 252), new BHSDCodec(4, 8, 0, 1),
+            new BHSDCodec(4, 8, 1, 1), new BHSDCodec(4, 16, 0, 1),
+            new BHSDCodec(4, 16, 1, 1), new BHSDCodec(4, 32, 0, 1),
+            new BHSDCodec(4, 32, 1, 1), new BHSDCodec(4, 64, 0, 1),
+            new BHSDCodec(4, 64, 1, 1), new BHSDCodec(4, 128, 0, 1),
+            new BHSDCodec(4, 128, 1, 1), new BHSDCodec(4, 192, 0, 1),
+            new BHSDCodec(4, 192, 1, 1), new BHSDCodec(4, 224, 0, 1),
+            new BHSDCodec(4, 224, 1, 1), new BHSDCodec(4, 240, 0, 1),
+            new BHSDCodec(4, 240, 1, 1), new BHSDCodec(4, 248, 0, 1),
+            new BHSDCodec(4, 248, 1, 1) };
 
-	/**
-	 * Returns the codec specified by the given value byte and optional byte header.
-	 * If the value is >=116, then bytes may be consumed from the secondary input
-	 * stream, which is taken to be the contents of the band_headers byte array.
-	 * Since the values from this are consumed and not repeated, the input stream
-	 * should be reused for subsequent encodings. This does not therefore close
-	 * the input stream.
-	 *
-	 * @param value the canonical encoding value
-	 * @param in the input stream to read additional byte headers from
-	 * @param defaultCodec TODO
-	 * @return the corresponding codec, or <code>null</code> if the default should be used
-	 *
-	 * @throws IOException if there is a problem reading from the input stream (which
-	 * in reality, is never, since the band_headers are likely stored in a byte array
-	 * and accessed via a ByteArrayInputStream. However, an EOFException could occur
-	 * if things go wrong)
-	 * @throws Pack200Exception
-	 */
-	public static Codec getCodec(int value, InputStream in, Codec defaultCodec) throws IOException, Pack200Exception {
-		// Sanity check to make sure that no-one has changed
-		// the canonical codecs, which would really cause havoc
-		if (canonicalCodec.length != 116)
-			throw new Error("Canonical encodings have been incorrectly modified");
-		if (value < 0) {
-			throw new IllegalArgumentException(
-					"Encoding cannot be less than zero");
-		} else if (value == 0) {
-			return defaultCodec;
-		} else if (value <= 115) {
-			return canonicalCodec[value];
-		} else if (value == 116) {
-			int code = in.read();
-			if (code == -1)
-				throw new EOFException("End of buffer read whilst trying to decode codec");
-			int d = (code & 0x01);
-			int s = (code >> 1 & 0x03);
-			int b = (code >> 3 & 0x07) + 1; // this might result in an invalid number, but it's checked in the Codec constructor
-			code = in.read();
-			if (code == -1)
-				throw new EOFException("End of buffer read whilst trying to decode codec");
-			int h = code + 1;
-			// This handles the special cases for invalid combinations of data.
-			return new BHSDCodec(b,h,s,d);
-		} else if (value >= 117 && value <= 140) { // Run codec
-			int offset = value - 117;
-			int kx = offset & 3;
-			boolean kbflag = (offset >> 2 & 1) == 1;
-			boolean adef = (offset >> 3 & 1) == 1;
-			boolean bdef = (offset >> 4 & 1) == 1;
-			// If both A and B use the default encoding, what's the point of having a run of default values followed by default values
-			if (adef && bdef)
-				throw new Pack200Exception("ADef and BDef should never both be true");
-			int kb = (kbflag ? in.read() : 3);
-			int k = (kb+1) * (int)Math.pow(16, kx);
-			Codec aCodec, bCodec;
-			if (adef) {
-				aCodec = defaultCodec;
-			} else {
-				aCodec = getCodec(in.read(),in,defaultCodec);
-			}
-			if (bdef) {
-				bCodec = defaultCodec;
-			} else {
-				bCodec = getCodec(in.read(),in,defaultCodec);
-			}
-			return new RunCodec(k,aCodec,bCodec);
-		} else if (value >= 141 && value <= 188) { // Population Codec
-			int offset = value - 141;
-			boolean fdef = (offset & 1) == 1;
-			boolean udef = (offset >> 1 & 1) == 1;
-			int tdefl = offset >> 2;
-			boolean tdef = tdefl != 0;
-			// From section 6.7.3 of spec
-			final int[] tdefToL= {0,4,8,16,32,64,128,192,224,240,248,252 };
-			int l = tdefToL[tdefl];
-			// NOTE: Do not re-factor this to bring out uCodec; the order in which
-			// they are read from the stream is important
-			if (tdef) {
-				Codec fCodec = (fdef ? defaultCodec : getCodec(in.read(),in,defaultCodec) );
-				Codec uCodec = (udef ? defaultCodec : getCodec(in.read(),in,defaultCodec) );
-				// Unfortunately, if tdef, then tCodec depends both on l and also on k, the
-				// number of items read from the fCodec. So we don't know in advance what
-				// the codec will be.
-				return new PopulationCodec(fCodec,l,uCodec);
-			} else {
-				Codec fCodec = (fdef ? defaultCodec : getCodec(in.read(),in,defaultCodec) );
-                Codec tCodec = getCodec(in.read(),in,defaultCodec);
-				Codec uCodec = (udef ? defaultCodec : getCodec(in.read(),in,defaultCodec) );
-				return new PopulationCodec(fCodec,tCodec,uCodec);
-			}
-		} else {
-			throw new Pack200Exception("Invalid codec encoding byte (" + value + ") found" );
-		}
-	}
+    /**
+     * Returns the codec specified by the given value byte and optional byte
+     * header. If the value is >=116, then bytes may be consumed from the
+     * secondary input stream, which is taken to be the contents of the
+     * band_headers byte array. Since the values from this are consumed and not
+     * repeated, the input stream should be reused for subsequent encodings.
+     * This does not therefore close the input stream.
+     * 
+     * @param value
+     *            the canonical encoding value
+     * @param in
+     *            the input stream to read additional byte headers from
+     * @param defaultCodec
+     *            TODO
+     * @return the corresponding codec, or <code>null</code> if the default
+     *         should be used
+     * 
+     * @throws IOException
+     *             if there is a problem reading from the input stream (which in
+     *             reality, is never, since the band_headers are likely stored
+     *             in a byte array and accessed via a ByteArrayInputStream.
+     *             However, an EOFException could occur if things go wrong)
+     * @throws Pack200Exception
+     */
+    public static Codec getCodec(int value, InputStream in, Codec defaultCodec)
+            throws IOException, Pack200Exception {
+        // Sanity check to make sure that no-one has changed
+        // the canonical codecs, which would really cause havoc
+        if (canonicalCodec.length != 116)
+            throw new Error(
+                    "Canonical encodings have been incorrectly modified");
+        if (value < 0) {
+            throw new IllegalArgumentException(
+                    "Encoding cannot be less than zero");
+        } else if (value == 0) {
+            return defaultCodec;
+        } else if (value <= 115) {
+            return canonicalCodec[value];
+        } else if (value == 116) {
+            int code = in.read();
+            if (code == -1)
+                throw new EOFException(
+                        "End of buffer read whilst trying to decode codec");
+            int d = (code & 0x01);
+            int s = (code >> 1 & 0x03);
+            int b = (code >> 3 & 0x07) + 1; // this might result in an invalid
+            // number, but it's checked in the
+            // Codec constructor
+            code = in.read();
+            if (code == -1)
+                throw new EOFException(
+                        "End of buffer read whilst trying to decode codec");
+            int h = code + 1;
+            // This handles the special cases for invalid combinations of data.
+            return new BHSDCodec(b, h, s, d);
+        } else if (value >= 117 && value <= 140) { // Run codec
+            int offset = value - 117;
+            int kx = offset & 3;
+            boolean kbflag = (offset >> 2 & 1) == 1;
+            boolean adef = (offset >> 3 & 1) == 1;
+            boolean bdef = (offset >> 4 & 1) == 1;
+            // If both A and B use the default encoding, what's the point of
+            // having a run of default values followed by default values
+            if (adef && bdef)
+                throw new Pack200Exception(
+                        "ADef and BDef should never both be true");
+            int kb = (kbflag ? in.read() : 3);
+            int k = (kb + 1) * (int) Math.pow(16, kx);
+            Codec aCodec, bCodec;
+            if (adef) {
+                aCodec = defaultCodec;
+            } else {
+                aCodec = getCodec(in.read(), in, defaultCodec);
+            }
+            if (bdef) {
+                bCodec = defaultCodec;
+            } else {
+                bCodec = getCodec(in.read(), in, defaultCodec);
+            }
+            return new RunCodec(k, aCodec, bCodec);
+        } else if (value >= 141 && value <= 188) { // Population Codec
+            int offset = value - 141;
+            boolean fdef = (offset & 1) == 1;
+            boolean udef = (offset >> 1 & 1) == 1;
+            int tdefl = offset >> 2;
+            boolean tdef = tdefl != 0;
+            // From section 6.7.3 of spec
+            final int[] tdefToL = { 0, 4, 8, 16, 32, 64, 128, 192, 224, 240,
+                    248, 252 };
+            int l = tdefToL[tdefl];
+            // NOTE: Do not re-factor this to bring out uCodec; the order in
+            // which
+            // they are read from the stream is important
+            if (tdef) {
+                Codec fCodec = (fdef ? defaultCodec : getCodec(in.read(), in,
+                        defaultCodec));
+                Codec uCodec = (udef ? defaultCodec : getCodec(in.read(), in,
+                        defaultCodec));
+                // Unfortunately, if tdef, then tCodec depends both on l and
+                // also on k, the
+                // number of items read from the fCodec. So we don't know in
+                // advance what
+                // the codec will be.
+                return new PopulationCodec(fCodec, l, uCodec);
+            } else {
+                Codec fCodec = (fdef ? defaultCodec : getCodec(in.read(), in,
+                        defaultCodec));
+                Codec tCodec = getCodec(in.read(), in, defaultCodec);
+                Codec uCodec = (udef ? defaultCodec : getCodec(in.read(), in,
+                        defaultCodec));
+                return new PopulationCodec(fCodec, tCodec, uCodec);
+            }
+        } else {
+            throw new Pack200Exception("Invalid codec encoding byte (" + value
+                    + ") found");
+        }
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java Fri Apr 11 03:09:38 2008
@@ -67,7 +67,6 @@
     private final HashMap doublesToCPDoubles = new HashMap();
     private final HashMap descriptorsToCPNameAndTypes = new HashMap();
 
-
     public CpBands(Segment segment) {
         super(segment);
     }
@@ -90,7 +89,7 @@
     /**
      * Parses the constant pool class names, using {@link #cpClassCount} to
      * populate {@link #cpClass} from {@link #cpUTF8}.
-     *
+     * 
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -106,7 +105,6 @@
                 cpUTF8);
     }
 
-
     /**
      * Parses the constant pool descriptor definitions, using
      * {@link #cpDescriptorCount} to populate {@link #cpDescriptor}. For ease
@@ -114,7 +112,7 @@
      * largely to make it easier for representing field and method descriptors
      * (e.g. <code>out:java.lang.PrintStream</code>) in a way that is
      * compatible with passing String arrays.
-     *
+     * 
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -139,18 +137,18 @@
     private void parseCpDouble(InputStream in) throws IOException,
             Pack200Exception {
         int cpDoubleCount = header.getCpDoubleCount();
-        long[] band = parseFlags("cp_Double", in, cpDoubleCount,
-                Codec.UDELTA5, Codec.DELTA5);
+        long[] band = parseFlags("cp_Double", in, cpDoubleCount, Codec.UDELTA5,
+                Codec.DELTA5);
         cpDouble = new double[band.length];
         for (int i = 0; i < band.length; i++) {
-			cpDouble[i] = Double.longBitsToDouble(band[i]);
-		}
+            cpDouble[i] = Double.longBitsToDouble(band[i]);
+        }
     }
 
     /**
      * Parses the constant pool field definitions, using {@link #cpFieldCount}
      * to populate {@link #cpFieldClass} and {@link #cpFieldDescriptor}.
-     *
+     * 
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -183,7 +181,7 @@
      * Parses the constant pool interface method definitions, using
      * {@link #cpIMethodCount} to populate {@link #cpIMethodClass} and
      * {@link #cpIMethodDescriptor}.
-     *
+     * 
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -210,14 +208,14 @@
     private void parseCpLong(InputStream in) throws IOException,
             Pack200Exception {
         int cpLongCount = header.getCpLongCount();
-        cpLong = parseFlags("cp_Long", in, cpLongCount,
-                Codec.UDELTA5, Codec.DELTA5);
+        cpLong = parseFlags("cp_Long", in, cpLongCount, Codec.UDELTA5,
+                Codec.DELTA5);
     }
 
     /**
      * Parses the constant pool method definitions, using {@link #cpMethodCount}
      * to populate {@link #cpMethodClass} and {@link #cpMethodDescriptor}.
-     *
+     * 
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -248,7 +246,7 @@
      * representation identical to the bytecode equivalent
      * <code>[Ljava/lang/String;(V)</code> TODO Check that the form is as
      * above and update other types e.g. J
-     *
+     * 
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -268,12 +266,13 @@
             String form = cpSignatureForm[i];
             char[] chars = form.toCharArray();
             for (int j = 0; j < chars.length; j++) {
-                if(chars[j] == 'L') {
+                if (chars[j] == 'L') {
                     lCount++;
                 }
             }
         }
-        String[] cpSignatureClasses = parseReferences("cp_Signature_classes", in, Codec.UDELTA5, lCount, cpClass);
+        String[] cpSignatureClasses = parseReferences("cp_Signature_classes",
+                in, Codec.UDELTA5, lCount, cpClass);
         int index = 0;
         for (int i = 0; i < cpSignatureCount; i++) {
             String form = cpSignatureForm[i];
@@ -297,7 +296,7 @@
     /**
      * Parses the constant pool strings, using {@link #cpStringCount} to
      * populate {@link #cpString} from indexes into {@link #cpUTF8}.
-     *
+     * 
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -309,7 +308,8 @@
     private void parseCpString(InputStream in) throws IOException,
             Pack200Exception {
         int cpStringCount = header.getCpStringCount();
-        cpString = parseReferences("cp_String", in, Codec.UDELTA5, cpStringCount, cpUTF8);
+        cpString = parseReferences("cp_String", in, Codec.UDELTA5,
+                cpStringCount, cpUTF8);
     }
 
     private void parseCpUtf8(InputStream in) throws IOException,
@@ -317,10 +317,12 @@
         int cpUTF8Count = header.getCpUTF8Count();
         cpUTF8 = new String[cpUTF8Count];
         cpUTF8[0] = ""; //$NON-NLS-1$
-        int[] prefix = decodeBandInt("cpUTF8Prefix", in, Codec.DELTA5, cpUTF8Count-2);
+        int[] prefix = decodeBandInt("cpUTF8Prefix", in, Codec.DELTA5,
+                cpUTF8Count - 2);
         int charCount = 0;
         int bigSuffixCount = 0;
-        int[] suffix = decodeBandInt("cpUTF8Suffix", in, Codec.UNSIGNED5, cpUTF8Count-1);
+        int[] suffix = decodeBandInt("cpUTF8Suffix", in, Codec.UNSIGNED5,
+                cpUTF8Count - 1);
 
         for (int i = 0; i < suffix.length; i++) {
             if (suffix[i] == 0) {
@@ -330,17 +332,20 @@
             }
         }
         char[] data = new char[charCount];
-        int[] dataBand = decodeBandInt("cp_Utf8_chars", in, Codec.CHAR3, charCount);
+        int[] dataBand = decodeBandInt("cp_Utf8_chars", in, Codec.CHAR3,
+                charCount);
         for (int i = 0; i < data.length; i++) {
             data[i] = (char) dataBand[i];
         }
 
         // Read in the big suffix data
-        int[] bigSuffixCounts = decodeBandInt("cp_Utf8_big_suffix", in, Codec.DELTA5, bigSuffixCount);
+        int[] bigSuffixCounts = decodeBandInt("cp_Utf8_big_suffix", in,
+                Codec.DELTA5, bigSuffixCount);
         int[][] bigSuffixDataBand = new int[bigSuffixCount][];
         for (int i = 0; i < bigSuffixDataBand.length; i++) {
-			bigSuffixDataBand[i] = decodeBandInt("cp_Utf8_big_chars " + i, in, Codec.DELTA5, bigSuffixCounts[i]);
-		}
+            bigSuffixDataBand[i] = decodeBandInt("cp_Utf8_big_chars " + i, in,
+                    Codec.DELTA5, bigSuffixCounts[i]);
+        }
 
         // Convert big suffix data to characters
         char bigSuffixData[][] = new char[bigSuffixCount][];
@@ -355,15 +360,15 @@
         bigSuffixCount = 0;
         for (int i = 1; i < cpUTF8Count; i++) {
             String lastString = cpUTF8[i - 1];
-            if (suffix[i-1] == 0) {
+            if (suffix[i - 1] == 0) {
                 // The big suffix stuff hasn't been tested, and I'll be
                 // surprised if it works first time w/o errors ...
-                cpUTF8[i] = lastString.substring(0, i>1 ? prefix[i-2] : 0)
+                cpUTF8[i] = lastString.substring(0, i > 1 ? prefix[i - 2] : 0)
                         + new String(bigSuffixData[bigSuffixCount++]);
             } else {
-                cpUTF8[i] = lastString.substring(0, i>1 ? prefix[i-2]: 0)
-                        + new String(data, charCount, suffix[i-1]);
-                charCount += suffix[i-1];
+                cpUTF8[i] = lastString.substring(0, i > 1 ? prefix[i - 2] : 0)
+                        + new String(data, charCount, suffix[i - 1]);
+                charCount += suffix[i - 1];
             }
         }
     }
@@ -429,11 +434,11 @@
     }
 
     public CPUTF8 cpUTF8Value(String string, int domain) {
-        if(stringsToCPUTF8[domain] == null) {
+        if (stringsToCPUTF8[domain] == null) {
             stringsToCPUTF8[domain] = new HashMap();
         }
         CPUTF8 cputf8 = (CPUTF8) stringsToCPUTF8[domain].get(string);
-        if(cputf8 == null) {
+        if (cputf8 == null) {
             cputf8 = new CPUTF8(string, domain);
             stringsToCPUTF8[domain].put(string, cputf8);
         }
@@ -442,8 +447,9 @@
 
     public CPString cpStringValue(String string) {
         CPString cpString = (CPString) stringsToCPStrings.get(string);
-        if(cpString == null) {
-            cpString = new CPString(cpUTF8Value(string, ClassConstantPool.DOMAIN_NORMALASCIIZ));
+        if (cpString == null) {
+            cpString = new CPString(cpUTF8Value(string,
+                    ClassConstantPool.DOMAIN_NORMALASCIIZ));
             stringsToCPStrings.put(string, cpString);
         }
         return cpString;
@@ -451,7 +457,7 @@
 
     public CPLong cpLongValue(Long l) {
         CPLong cpLong = (CPLong) longsToCPLongs.get(l);
-        if(cpLong == null) {
+        if (cpLong == null) {
             cpLong = new CPLong(l);
             longsToCPLongs.put(l, cpLong);
         }
@@ -460,7 +466,7 @@
 
     public CPInteger cpIntegerValue(Integer i) {
         CPInteger cpInteger = (CPInteger) integersToCPIntegers.get(i);
-        if(cpInteger == null) {
+        if (cpInteger == null) {
             cpInteger = new CPInteger(i);
             integersToCPIntegers.put(i, cpInteger);
         }
@@ -469,7 +475,7 @@
 
     public CPFloat cpFloatValue(Float f) {
         CPFloat cpFloat = (CPFloat) floatsToCPFloats.get(f);
-        if(cpFloat == null) {
+        if (cpFloat == null) {
             cpFloat = new CPFloat(f);
             floatsToCPFloats.put(f, cpFloat);
         }
@@ -478,8 +484,9 @@
 
     public CPClass cpClassValue(String string) {
         CPClass cpString = (CPClass) stringsToCPClass.get(string);
-        if(cpString == null) {
-            cpString = new CPClass(cpUTF8Value(string, ClassConstantPool.DOMAIN_NORMALASCIIZ));
+        if (cpString == null) {
+            cpString = new CPClass(cpUTF8Value(string,
+                    ClassConstantPool.DOMAIN_NORMALASCIIZ));
             stringsToCPClass.put(string, cpString);
         }
         return cpString;
@@ -487,7 +494,7 @@
 
     public CPDouble cpDoubleValue(Double dbl) {
         CPDouble cpDouble = (CPDouble) doublesToCPDoubles.get(dbl);
-        if(cpDouble == null) {
+        if (cpDouble == null) {
             cpDouble = new CPDouble(dbl);
             doublesToCPDoubles.put(dbl, cpDouble);
         }
@@ -495,29 +502,31 @@
     }
 
     public CPNameAndType cpNameAndTypeValue(String descriptor) {
-        CPNameAndType cpNameAndType = (CPNameAndType) descriptorsToCPNameAndTypes.get(descriptor);
-        if(cpNameAndType == null) {
+        CPNameAndType cpNameAndType = (CPNameAndType) descriptorsToCPNameAndTypes
+                .get(descriptor);
+        if (cpNameAndType == null) {
             int descriptorDomain = ClassConstantPool.DOMAIN_UNDEFINED;
             int colon = descriptor.indexOf(':');
-            String nameString = descriptor.substring(0,colon);
-            String descriptorString = descriptor.substring(colon+1);
+            String nameString = descriptor.substring(0, colon);
+            String descriptorString = descriptor.substring(colon + 1);
             // For some reason, descriptors which have just plain
             // native types are stored in DOMAIN_NORMALASCIIZ rather
             // than in DOMAIN_SIGNATUREASCIIZ. This might indicate
             // that DOMAIN_SIGNATUREASCIIZ is poorly named.
             boolean nativeDescriptor = true;
-            for(int index=0; index < descriptorString.length(); index++) {
+            for (int index = 0; index < descriptorString.length(); index++) {
                 char currentChar = descriptorString.charAt(index);
-                if(Character.isLetter(currentChar)) {
-                    if(currentChar == 'L') {
+                if (Character.isLetter(currentChar)) {
+                    if (currentChar == 'L') {
                         nativeDescriptor = false;
                     }
                     break;
                 }
             }
             int domain = ClassConstantPool.DOMAIN_NAMEANDTYPE;
-            CPUTF8 name = cpUTF8Value(nameString, ClassConstantPool.DOMAIN_NORMALASCIIZ);
-            if( nativeDescriptor ) {
+            CPUTF8 name = cpUTF8Value(nameString,
+                    ClassConstantPool.DOMAIN_NORMALASCIIZ);
+            if (nativeDescriptor) {
                 // Native signatures are stored in DOMAIN_NORMALASCIIZ, not
                 // DOMAIN_SIGNATUREASCIIZ for some reason.
                 descriptorDomain = ClassConstantPool.DOMAIN_NORMALASCIIZ;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java Fri Apr 11 03:09:38 2008
@@ -20,12 +20,11 @@
 import java.io.InputStream;
 
 /**
- * Parses the file band headers (not including the actual bits themselves).
- * At the end of this parse call, the input stream will be positioned at the
- * start of the file_bits themselves, and there will be Sum(file_size) bits
- * remaining in the stream with BYTE1 compression. A decent implementation
- * will probably just stream the bytes out to the reconstituted Jar rather
- * than caching them.
+ * Parses the file band headers (not including the actual bits themselves). At
+ * the end of this parse call, the input stream will be positioned at the start
+ * of the file_bits themselves, and there will be Sum(file_size) bits remaining
+ * in the stream with BYTE1 compression. A decent implementation will probably
+ * just stream the bytes out to the reconstituted Jar rather than caching them.
  */
 public class FileBands extends BandSet {
 
@@ -51,11 +50,12 @@
         this.cpUTF8 = segment.getCpBands().getCpUTF8();
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.harmony.pack200.BandSet#unpack(java.io.InputStream)
      */
-    public void unpack(InputStream in) throws IOException,
-            Pack200Exception {
+    public void unpack(InputStream in) throws IOException, Pack200Exception {
         int numberOfFiles = header.getNumberOfFiles();
         SegmentOptions options = header.getOptions();
 
@@ -75,12 +75,12 @@
         } else {
             fileOptions = new long[numberOfFiles];
         }
-        this.in = in; // store for use by processFileBits(), which is called later
+        this.in = in; // store for use by processFileBits(), which is called
+        // later
     }
 
     // TODO: stream the file bits directly somehow
-    public void processFileBits() throws IOException,
-            Pack200Exception {
+    public void processFileBits() throws IOException, Pack200Exception {
         // now read in the bytes
         int numberOfFiles = header.getNumberOfFiles();
         fileBits = new byte[numberOfFiles][];
@@ -90,8 +90,9 @@
             // not the right choice, and we should just serialize it here?
             fileBits[i] = new byte[size];
             int read = in.read(fileBits[i]);
-            if(read < size) {
-                throw new Pack200Exception("Expected to read " + size +" bytes but read " + read);
+            if (read < size) {
+                throw new Pack200Exception("Expected to read " + size
+                        + " bytes but read " + read);
             }
         }
     }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IMatcher.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IMatcher.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IMatcher.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IMatcher.java Fri Apr 11 03:09:38 2008
@@ -21,6 +21,6 @@
  */
 public interface IMatcher {
 
-	public abstract boolean matches(long value);
+    public abstract boolean matches(long value);
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java Fri Apr 11 03:09:38 2008
@@ -45,36 +45,39 @@
         this.cpUTF8 = segment.getCpBands().getCpUTF8();
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.harmony.pack200.BandSet#unpack(java.io.InputStream)
      */
-    public void unpack(InputStream in) throws IOException,
-            Pack200Exception {
+    public void unpack(InputStream in) throws IOException, Pack200Exception {
         // Read IC bands
         int innerClassCount = header.getInnerClassCount();
-        String[] icThisClass = parseReferences("ic_this_class", in, Codec.UDELTA5,
-                innerClassCount, cpClass);
-        int[] icFlags = decodeBandInt("ic_flags", in, Codec.UNSIGNED5, innerClassCount);
+        String[] icThisClass = parseReferences("ic_this_class", in,
+                Codec.UDELTA5, innerClassCount, cpClass);
+        int[] icFlags = decodeBandInt("ic_flags", in, Codec.UNSIGNED5,
+                innerClassCount);
         int outerClasses = SegmentUtils.countBit16(icFlags);
-        int[] icOuterClassInts = decodeBandInt("ic_outer_class", in, Codec.DELTA5,
-                outerClasses);
+        int[] icOuterClassInts = decodeBandInt("ic_outer_class", in,
+                Codec.DELTA5, outerClasses);
         String[] icOuterClass = new String[outerClasses];
         for (int i = 0; i < icOuterClass.length; i++) {
-        	if(icOuterClassInts[i] == 0) {
-        		icOuterClass[i] = null;
-        	} else {
-        		icOuterClass[i] = cpClass[icOuterClassInts[i] - 1];
-        	}
-		}
-        int[] icNameInts = decodeBandInt("ic_name", in, Codec.DELTA5, outerClasses);
+            if (icOuterClassInts[i] == 0) {
+                icOuterClass[i] = null;
+            } else {
+                icOuterClass[i] = cpClass[icOuterClassInts[i] - 1];
+            }
+        }
+        int[] icNameInts = decodeBandInt("ic_name", in, Codec.DELTA5,
+                outerClasses);
         String[] icName = new String[outerClasses];
         for (int i = 0; i < icName.length; i++) {
-        	if(icNameInts[i] == 0) {
-        		icName[i] = null;
-        	} else {
-        		icName[i] = cpUTF8[icNameInts[i] - 1];
-        	}
-		}
+            if (icNameInts[i] == 0) {
+                icName[i] = null;
+            } else {
+                icName[i] = cpUTF8[icNameInts[i] - 1];
+            }
+        }
 
         // Construct IC tuples
         icAll = new IcTuple[icThisClass.length];
@@ -87,7 +90,7 @@
 
             icTupleC = icThisClass[i];
             icTupleF = icFlags[i];
-            if((icFlags[i] & 1<<16) != 0) {
+            if ((icFlags[i] & 1 << 16) != 0) {
                 icTupleC2 = icOuterClass[index];
                 icTupleN = icName[index];
                 index++;
@@ -101,18 +104,21 @@
     }
 
     /**
-     * Answer the relevant IcTuples for the specified className
-     * and class constant pool.
-     * @param className String name of the class X for ic_relevant(X)
-     * @param cp ClassConstantPool used to generate ic_relevant(X)
+     * Answer the relevant IcTuples for the specified className and class
+     * constant pool.
+     * 
+     * @param className
+     *            String name of the class X for ic_relevant(X)
+     * @param cp
+     *            ClassConstantPool used to generate ic_relevant(X)
      * @return array of IcTuple
      */
     public IcTuple[] getRelevantIcTuples(String className, ClassConstantPool cp) {
         List relevantTuples = new ArrayList();
         IcTuple[] allTuples = getIcTuples();
         int allTuplesSize = allTuples.length;
-        for(int index=0; index < allTuplesSize; index++) {
-            if(allTuples[index].shouldAddToRelevantForClassName(className)  ) {
+        for (int index = 0; index < allTuplesSize; index++) {
+            if (allTuples[index].shouldAddToRelevantForClassName(className)) {
                 relevantTuples.add(allTuples[index]);
             }
         }
@@ -123,16 +129,17 @@
         // add it to ic_relevant. Repeat until no more
         // changes to ic_relevant.
 
-        while(changed) {
+        while (changed) {
             changed = false;
-            for(int allTupleIndex=0; allTupleIndex < allTuplesSize; allTupleIndex++) {
+            for (int allTupleIndex = 0; allTupleIndex < allTuplesSize; allTupleIndex++) {
                 Iterator it = classPoolClasses.iterator();
-                while(it.hasNext()) {
-                    CPClass classInPool = (CPClass)it.next();
+                while (it.hasNext()) {
+                    CPClass classInPool = (CPClass) it.next();
                     String poolClassName = classInPool.name;
-                    if(poolClassName.equals(allTuples[allTupleIndex].thisClassString())) {
+                    if (poolClassName.equals(allTuples[allTupleIndex]
+                            .thisClassString())) {
                         // If the tuple isn't already in there, then add it
-                        if(relevantTuples.indexOf(allTuples[allTupleIndex]) == -1) {
+                        if (relevantTuples.indexOf(allTuples[allTupleIndex]) == -1) {
                             relevantTuples.add(allTuples[allTupleIndex]);
                             changed = true;
                         }
@@ -143,28 +150,30 @@
 
         // Not part of spec: fix up by adding to relevantTuples the parents
         // of inner classes which are themselves inner classes.
-        // i.e., I think that if Foo$Bar$Baz gets added, Foo$Bar needs to be added
+        // i.e., I think that if Foo$Bar$Baz gets added, Foo$Bar needs to be
+        // added
         // as well.
 
         boolean changedFixup = true;
         ArrayList tuplesToAdd = new ArrayList();
-        while(changedFixup) {
+        while (changedFixup) {
             changedFixup = false;
-            for(int index=0; index < relevantTuples.size(); index++) {
-                IcTuple aRelevantTuple = (IcTuple)relevantTuples.get(index);
-                for(int allTupleIndex = 0; allTupleIndex < allTuplesSize; allTupleIndex++) {
-                    if(aRelevantTuple.outerClassString().equals(allTuples[allTupleIndex].thisClassString())) {
-                        if(!aRelevantTuple.outerIsAnonymous()) {
+            for (int index = 0; index < relevantTuples.size(); index++) {
+                IcTuple aRelevantTuple = (IcTuple) relevantTuples.get(index);
+                for (int allTupleIndex = 0; allTupleIndex < allTuplesSize; allTupleIndex++) {
+                    if (aRelevantTuple.outerClassString().equals(
+                            allTuples[allTupleIndex].thisClassString())) {
+                        if (!aRelevantTuple.outerIsAnonymous()) {
                             tuplesToAdd.add(allTuples[allTupleIndex]);
                         }
                     }
                 }
             }
-            if(tuplesToAdd.size() > 0) {
+            if (tuplesToAdd.size() > 0) {
                 Iterator it = tuplesToAdd.iterator();
-                while(it.hasNext()) {
-                    IcTuple tuple = (IcTuple)it.next();
-                    if(!relevantTuples.contains(tuple)) {
+                while (it.hasNext()) {
+                    IcTuple tuple = (IcTuple) it.next();
+                    if (!relevantTuples.contains(tuple)) {
                         changedFixup = true;
                         relevantTuples.add(tuple);
                     }
@@ -177,13 +186,13 @@
         // Now order the result as a subsequence of ic_all
         IcTuple[] orderedRelevantTuples = new IcTuple[relevantTuples.size()];
         int orderedRelevantIndex = 0;
-        for(int index=0; index < allTuplesSize; index++) {
-            if(relevantTuples.contains(allTuples[index])) {
+        for (int index = 0; index < allTuplesSize; index++) {
+            if (relevantTuples.contains(allTuples[index])) {
                 orderedRelevantTuples[orderedRelevantIndex] = allTuples[index];
                 orderedRelevantIndex++;
             }
         }
-        if(orderedRelevantIndex != orderedRelevantTuples.length) {
+        if (orderedRelevantIndex != orderedRelevantTuples.length) {
             // This should never happen. If it does, we have a
             // logic error in the ordering code.
             throw new Error("Missing a tuple when ordering them");

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java Fri Apr 11 03:09:38 2008
@@ -20,7 +20,7 @@
 
 /**
  * An IcTuple is the set of information that describes an inner class.
- *
+ * 
  * C is the fully qualified class name<br>
  * F is the flags<br>
  * C2 is the outer class name, or null if it can be inferred from C<br>
@@ -33,10 +33,10 @@
         this.F = F;
         this.C2 = C2;
         this.N = N;
-        if(null == N) {
+        if (null == N) {
             predictSimple = true;
         }
-        if(null == C2) {
+        if (null == C2) {
             predictOuter = true;
         }
         initializeClassStrings();
@@ -61,9 +61,8 @@
     private boolean member = true;
 
     /**
-     * Answer true if the receiver is predicted;
-     * answer false if the receiver is specified
-     * explicitly in the outer and name fields.
+     * Answer true if the receiver is predicted; answer false if the receiver is
+     * specified explicitly in the outer and name fields.
      */
     public boolean predicted() {
         return predictOuter || predictSimple;
@@ -76,28 +75,28 @@
         ArrayList resultList = new ArrayList();
         int start = 0;
         int index = 0;
-        while(index < className.length()) {
-            if(className.charAt(index) <= '$') {
+        while (index < className.length()) {
+            if (className.charAt(index) <= '$') {
                 resultList.add(className.substring(start, index));
                 start = index + 1;
             }
             index++;
-            if(index >= className.length()) {
+            if (index >= className.length()) {
                 // Add the last element
                 resultList.add(className.substring(start, className.length()));
             }
         }
         String[] result = new String[resultList.size()];
-        for(int i=0; i < resultList.size(); i++) {
-            result[i] = (String)resultList.get(i);
+        for (int i = 0; i < resultList.size(); i++) {
+            result[i] = (String) resultList.get(i);
         }
         return result;
     }
 
     /**
-     * Answer the outer class name for the receiver.
-     * This may either be specified or inferred from
-     * inner class name.
+     * Answer the outer class name for the receiver. This may either be
+     * specified or inferred from inner class name.
+     * 
      * @return String name of outer class
      */
     public String outerClassString() {
@@ -106,6 +105,7 @@
 
     /**
      * Answer the inner class name for the receiver.
+     * 
      * @return String name of inner class
      */
     public String simpleClassName() {
@@ -113,12 +113,13 @@
     }
 
     /**
-     * Answer the full name of the inner class represented
-     * by this tuple (including its outer component)
+     * Answer the full name of the inner class represented by this tuple
+     * (including its outer component)
+     * 
      * @return String full name of inner class
      */
     public String thisClassString() {
-        if(predicted()) {
+        if (predicted()) {
             return C;
         } else {
             // TODO: this may not be right. What if I
@@ -136,13 +137,14 @@
     }
 
     public boolean outerIsAnonymous() {
-        String [] result = innerBreakAtDollar(cachedOuterClassString);
-        if(result.length == 0) {
-            throw new Error("Should have an outer before checking if it's anonymous");
+        String[] result = innerBreakAtDollar(cachedOuterClassString);
+        if (result.length == 0) {
+            throw new Error(
+                    "Should have an outer before checking if it's anonymous");
         }
 
-        for(int index=0; index < result.length; index++) {
-            if(isAllDigits(result[index])) {
+        for (int index = 0; index < result.length; index++) {
+            if (isAllDigits(result[index])) {
                 return true;
             }
         }
@@ -153,11 +155,11 @@
         // If the outerClassString of the tuple doesn't match the
         // class name of the class we're looking through, don't
         // consider it relevant.
-        if(!outerClassString().equals(className)) {
+        if (!outerClassString().equals(className)) {
             return false;
         }
         // If it's not anon and the outer is not anon, it's relevant
-        if(!isAnonymous() && !outerIsAnonymous()) {
+        if (!isAnonymous() && !outerIsAnonymous()) {
             return true;
         }
 
@@ -166,29 +168,29 @@
     }
 
     private void initializeClassStrings() {
-        if(initialized) {
+        if (initialized) {
             return;
         }
         initialized = true;
 
-        if(!predictSimple) {
+        if (!predictSimple) {
             cachedSimpleClassName = N;
         }
-        if(!predictOuter) {
+        if (!predictOuter) {
             cachedOuterClassString = C2;
         }
         // Class names must be calculated from
         // this class name.
         String nameComponents[] = innerBreakAtDollar(C);
-        if(nameComponents.length == 0) {
+        if (nameComponents.length == 0) {
             // Unable to predict outer class
             // throw new Error("Unable to predict outer class name: " + C);
         }
-        if(nameComponents.length == 1) {
+        if (nameComponents.length == 1) {
             // Unable to predict simple class name
             // throw new Error("Unable to predict inner class name: " + C);
         }
-        if(nameComponents.length < 2) {
+        if (nameComponents.length < 2) {
             // If we get here, we hope cachedSimpleClassName
             // and cachedOuterClassString were caught by the
             // predictSimple / predictOuter code above.
@@ -199,12 +201,12 @@
         int lastPosition = nameComponents.length - 1;
         cachedSimpleClassName = nameComponents[lastPosition];
         cachedOuterClassString = "";
-        for(int index=0; index < lastPosition; index++) {
+        for (int index = 0; index < lastPosition; index++) {
             cachedOuterClassString += nameComponents[index];
-            if(isAllDigits(nameComponents[index])) {
+            if (isAllDigits(nameComponents[index])) {
                 member = false;
             }
-            if(index + 1 != lastPosition) {
+            if (index + 1 != lastPosition) {
                 // TODO: might need more logic to handle
                 // classes with separators of non-$ characters
                 // (ie Foo#Bar)
@@ -213,16 +215,16 @@
         }
         // TODO: these two blocks are the same as blocks
         // above. Can we eliminate some by reworking the logic?
-        if(!predictSimple) {
+        if (!predictSimple) {
             cachedSimpleClassName = N;
         }
-        if(!predictOuter) {
+        if (!predictOuter) {
             cachedOuterClassString = C2;
         }
-        if(isAllDigits(cachedSimpleClassName)) {
+        if (isAllDigits(cachedSimpleClassName)) {
             anonymous = true;
             member = false;
-            if((F & 65536) == 65536) {
+            if ((F & 65536) == 65536) {
                 // Predicted class - marking as member
                 member = true;
             }
@@ -231,11 +233,11 @@
 
     private boolean isAllDigits(String nameString) {
         // Answer true if the receiver is all digits; otherwise answer false.
-        if(null == nameString) {
+        if (null == nameString) {
             return false;
         }
-        for(int index = 0; index < nameString.length(); index++) {
-            if(!Character.isDigit(nameString.charAt(index))) {
+        for (int index = 0; index < nameString.length(); index++) {
+            if (!Character.isDigit(nameString.charAt(index))) {
                 return false;
             }
         }
@@ -254,27 +256,27 @@
     }
 
     public boolean nullSafeEquals(String stringOne, String stringTwo) {
-        if(null==stringOne) {
-            return null==stringTwo;
+        if (null == stringOne) {
+            return null == stringTwo;
         }
         return stringOne.equals(stringTwo);
     }
 
     public boolean equals(Object object) {
-        if(object.getClass() != this.getClass()) {
+        if (object.getClass() != this.getClass()) {
             return false;
         }
-        IcTuple compareTuple = (IcTuple)object;
+        IcTuple compareTuple = (IcTuple) object;
 
-        if(!nullSafeEquals(this.C, compareTuple.C)) {
+        if (!nullSafeEquals(this.C, compareTuple.C)) {
             return false;
         }
 
-        if(!nullSafeEquals(this.C2, compareTuple.C2)) {
+        if (!nullSafeEquals(this.C2, compareTuple.C2)) {
             return false;
         }
 
-        if(!nullSafeEquals(this.N, compareTuple.N)) {
+        if (!nullSafeEquals(this.N, compareTuple.N)) {
             return false;
         }
         return true;
@@ -302,7 +304,7 @@
 
     public String realOuterClassString() {
         int firstDollarPosition = cachedOuterClassString.indexOf('$');
-        if(firstDollarPosition <= 0) {
+        if (firstDollarPosition <= 0) {
             return cachedOuterClassString;
         }
         return cachedOuterClassString.substring(0, firstDollarPosition);

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java?rev=647100&r1=647099&r2=647100&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java Fri Apr 11 03:09:38 2008
@@ -101,13 +101,12 @@
 
     private Iterator pair_N_Iterator;
 
-
     public List getAttributes() {
-        if(attributes == null) {
+        if (attributes == null) {
             attributes = new ArrayList();
-            if(name_RU != null) {
+            if (name_RU != null) {
                 Iterator name_RU_Iterator = Arrays.asList(name_RU).iterator();
-                if(!type.equals("AD")) {
+                if (!type.equals("AD")) {
                     T_iterator = Arrays.asList(boxArray(T)).iterator();
                 }
                 caseI_Iterator = Arrays.asList(caseI_KI).iterator();
@@ -118,24 +117,30 @@
                 caseet_Iterator = Arrays.asList(caseet_RS).iterator();
                 caseec_Iterator = Arrays.asList(caseec_RU).iterator();
                 cases_Iterator = Arrays.asList(cases_RU).iterator();
-                casearray_Iterator = Arrays.asList(boxArray(casearray_N)).iterator();
+                casearray_Iterator = Arrays.asList(boxArray(casearray_N))
+                        .iterator();
                 nesttype_RS_Iterator = Arrays.asList(nesttype_RS).iterator();
-                nestpair_N_Iterator = Arrays.asList(boxArray(nestpair_N)).iterator();
+                nestpair_N_Iterator = Arrays.asList(boxArray(nestpair_N))
+                        .iterator();
                 nestname_RU_Iterator = Arrays.asList(nestname_RU).iterator();
                 if (type.equals("RVA") || type.equals("RIA")) {
                     for (int i = 0; i < anno_N.length; i++) {
-                        attributes.add(getAttribute(anno_N[i], type_RS[i], pair_N[i], name_RU_Iterator));
+                        attributes.add(getAttribute(anno_N[i], type_RS[i],
+                                pair_N[i], name_RU_Iterator));
                     }
                 } else if (type.equals("RVPA") || type.equals("RIPA")) {
-                    anno_N_Iterator = Arrays.asList(boxArray(anno_N)).iterator();
+                    anno_N_Iterator = Arrays.asList(boxArray(anno_N))
+                            .iterator();
                     type_RS_Iterator = Arrays.asList(type_RS).iterator();
                     pair_N_Iterator = Arrays.asList(pair_N).iterator();
                     for (int i = 0; i < param_NB.length; i++) {
-                        attributes.add(getParameterAttribute(param_NB[i], name_RU_Iterator));
+                        attributes.add(getParameterAttribute(param_NB[i],
+                                name_RU_Iterator));
                     }
                 } else { // type.equals("AD")
                     for (int i = 0; i < T.length; i++) {
-                        attributes.add(new AnnotationDefaultAttribute(new ElementValue(T[i], getNextValue(T[i]))));
+                        attributes.add(new AnnotationDefaultAttribute(
+                                new ElementValue(T[i], getNextValue(T[i]))));
                     }
                 }
             }
@@ -143,86 +148,93 @@
         return attributes;
     }
 
-
-    private Attribute getAttribute(int numAnnotations, CPUTF8[] types, int[] pairCounts, Iterator namesIterator) {
+    private Attribute getAttribute(int numAnnotations, CPUTF8[] types,
+            int[] pairCounts, Iterator namesIterator) {
         Annotation[] annotations = new Annotation[numAnnotations];
         for (int i = 0; i < numAnnotations; i++) {
-            annotations[i] = getAnnotation(types[i], pairCounts[i], namesIterator);
+            annotations[i] = getAnnotation(types[i], pairCounts[i],
+                    namesIterator);
         }
         return new RuntimeVisibleorInvisibleAnnotationsAttribute(type
-                .equals("RVA") ? cpBands.cpUTF8Value("RuntimeVisibleAnnotations",
-                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ) : cpBands.cpUTF8Value(
-                "RuntimeInvisibleAnnotations",
-                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ), annotations);
+                .equals("RVA") ? cpBands.cpUTF8Value(
+                "RuntimeVisibleAnnotations",
+                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ) : cpBands
+                .cpUTF8Value("RuntimeInvisibleAnnotations",
+                        ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ), annotations);
     }
 
-    private Attribute getParameterAttribute(int numParameters, Iterator namesIterator ) {
+    private Attribute getParameterAttribute(int numParameters,
+            Iterator namesIterator) {
         ParameterAnnotation[] parameter_annotations = new ParameterAnnotation[numParameters];
         for (int i = 0; i < numParameters; i++) {
-            int numAnnotations = ((Integer)anno_N_Iterator.next()).intValue();
-            int[] pairCounts = (int[])pair_N_Iterator.next();
+            int numAnnotations = ((Integer) anno_N_Iterator.next()).intValue();
+            int[] pairCounts = (int[]) pair_N_Iterator.next();
             Annotation[] annotations = new Annotation[numAnnotations];
             for (int j = 0; j < annotations.length; j++) {
-                annotations[j] = getAnnotation((CPUTF8)type_RS_Iterator.next(), pairCounts[j], namesIterator);
+                annotations[j] = getAnnotation(
+                        (CPUTF8) type_RS_Iterator.next(), pairCounts[j],
+                        namesIterator);
             }
             parameter_annotations[i] = new ParameterAnnotation(annotations);
         }
         return new RuntimeVisibleorInvisibleParameterAnnotationsAttribute(type
                 .equals("RVA") ? cpBands.cpUTF8Value(
                 "RuntimeVisibleParameterAnnotations",
-                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ) : cpBands.cpUTF8Value(
-                "RuntimeInvisibleParameterAnnotations",
-                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ),
+                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ) : cpBands
+                .cpUTF8Value("RuntimeInvisibleParameterAnnotations",
+                        ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ),
                 parameter_annotations);
     }
 
-
-    private Annotation getAnnotation(CPUTF8 type, int pairCount, Iterator namesIterator) {
+    private Annotation getAnnotation(CPUTF8 type, int pairCount,
+            Iterator namesIterator) {
         CPUTF8[] elementNames = new CPUTF8[pairCount];
         ElementValue[] elementValues = new ElementValue[pairCount];
         for (int j = 0; j < elementNames.length; j++) {
-           elementNames[j] = (CPUTF8) namesIterator.next();
-           int t = ((Integer)T_iterator.next()).intValue();
-           elementValues[j] = new ElementValue(t, getNextValue(t));
+            elementNames[j] = (CPUTF8) namesIterator.next();
+            int t = ((Integer) T_iterator.next()).intValue();
+            elementValues[j] = new ElementValue(t, getNextValue(t));
         }
         return new Annotation(pairCount, type, elementNames, elementValues);
     }
 
     private Object getNextValue(int t) {
         switch (t) {
-            case 'B':
-            case 'C':
-            case 'I':
-            case 'S':
-            case 'Z':
-                return caseI_Iterator.next();
-            case 'D':
-                return caseD_Iterator.next();
-            case 'F':
-                return caseF_Iterator.next();
-            case 'J':
-                return caseJ_Iterator.next();
-            case 'c':
-                return casec_Iterator.next();
-            case 'e':
-                // TODO: check this - it may not work if the first string already has a colon in it
-                String enumString = caseet_Iterator.next() + ":" + caseec_Iterator.next();
-                return cpBands.cpNameAndTypeValue(enumString);
-            case 's':
-                return cases_Iterator.next();
-            case '[':
-                int arraySize = ((Integer)casearray_Iterator.next()).intValue();
-                ElementValue[] nestedArray = new ElementValue[arraySize];
-                for (int i = 0; i < arraySize; i++) {
-                    int nextT = ((Integer)T_iterator.next()).intValue();
-                    nestedArray[i] = new ElementValue(nextT, getNextValue(nextT));
-                }
-                return nestedArray;
-            case '@':
-                CPUTF8 type = (CPUTF8) nesttype_RS_Iterator.next();
-                int numPairs = ((Integer)nestpair_N_Iterator.next()).intValue();
+        case 'B':
+        case 'C':
+        case 'I':
+        case 'S':
+        case 'Z':
+            return caseI_Iterator.next();
+        case 'D':
+            return caseD_Iterator.next();
+        case 'F':
+            return caseF_Iterator.next();
+        case 'J':
+            return caseJ_Iterator.next();
+        case 'c':
+            return casec_Iterator.next();
+        case 'e':
+            // TODO: check this - it may not work if the first string already
+            // has a colon in it
+            String enumString = caseet_Iterator.next() + ":"
+                    + caseec_Iterator.next();
+            return cpBands.cpNameAndTypeValue(enumString);
+        case 's':
+            return cases_Iterator.next();
+        case '[':
+            int arraySize = ((Integer) casearray_Iterator.next()).intValue();
+            ElementValue[] nestedArray = new ElementValue[arraySize];
+            for (int i = 0; i < arraySize; i++) {
+                int nextT = ((Integer) T_iterator.next()).intValue();
+                nestedArray[i] = new ElementValue(nextT, getNextValue(nextT));
+            }
+            return nestedArray;
+        case '@':
+            CPUTF8 type = (CPUTF8) nesttype_RS_Iterator.next();
+            int numPairs = ((Integer) nestpair_N_Iterator.next()).intValue();
 
-                return getAnnotation(type, numPairs, nestname_RU_Iterator);
+            return getAnnotation(type, numPairs, nestname_RU_Iterator);
         }
         return null;
     }



Mime
View raw message