harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r440606 [1/3] - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/
Date Wed, 06 Sep 2006 04:01:23 GMT
Author: ndbeyer
Date: Tue Sep  5 21:01:21 2006
New Revision: 440606

URL: http://svn.apache.org/viewvc?view=rev&rev=440606
Log:
Code cleanup: remove warnings (missing @Override) and unnecessary structures, add braces, etc.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractQueue.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Currency.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/DuplicateFormatFlagsException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/EventObject.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/FormatFlagsConversionMismatchException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Formatter.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IllegalFormatCodePointException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IllegalFormatConversionException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IllegalFormatFlagsException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IllegalFormatPrecisionException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IllegalFormatWidthException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/LinkedList.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ListResourceBundle.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Locale.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/MapEntry.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/MiniEnumSet.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/MissingFormatArgumentException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/MissingFormatWidthException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/PriorityQueue.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/PropertyPermission.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Random.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ResourceBundle.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/SimpleTimeZone.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TimeZone.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TimerTask.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeSet.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UUID.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UnknownFormatConversionException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UnknownFormatFlagsException.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractQueue.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractQueue.java?view=diff&rev=440606&r1=440605&r2=440606
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractQueue.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractQueue.java Tue Sep  5 21:01:21 2006
@@ -52,9 +52,8 @@
         }
         if (offer(o)) {
             return true;
-        } else {
-            throw new IllegalStateException();
         }
+        throw new IllegalStateException();
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java?view=diff&rev=440606&r1=440605&r2=440606
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java Tue Sep  5 21:01:21 2006
@@ -34,9 +34,11 @@
 
 	private static final long serialVersionUID = 8683452581122892189L;
 
-	transient private int firstIndex, lastIndex;
+	private transient int firstIndex;
+    
+    private transient int lastIndex;
 
-	transient private E[] array;
+	private transient E[] array;
 
 	/**
 	 * Constructs a new instance of ArrayList with zero capacity.
@@ -95,7 +97,8 @@
 	 * @exception IndexOutOfBoundsException
 	 *                when <code>location < 0 || >= size()</code>
 	 */
-	public void add(int location, E object) {
+	@Override
+    public void add(int location, E object) {
 		int size = size();
 		if (0 < location && location < size) {
 			if (firstIndex == 0 && lastIndex == array.length) {
@@ -112,15 +115,18 @@
 			}
 			array[location + firstIndex] = object;
 		} else if (location == 0) {
-			if (firstIndex == 0)
-				growAtFront(1);
+			if (firstIndex == 0) {
+                growAtFront(1);
+            }
 			array[--firstIndex] = object;
 		} else if (location == size) {
-			if (lastIndex == array.length)
-				growAtEnd(1);
+			if (lastIndex == array.length) {
+                growAtEnd(1);
+            }
 			array[lastIndex++] = object;
-		} else
-			throw new IndexOutOfBoundsException();
+		} else {
+            throw new IndexOutOfBoundsException();
+        }
 
 		modCount++;
 	}
@@ -132,9 +138,11 @@
 	 *            the object to add
 	 * @return true
 	 */
-	public boolean add(E object) {
-		if (lastIndex == array.length)
-			growAtEnd(1);
+	@Override
+    public boolean add(E object) {
+		if (lastIndex == array.length) {
+            growAtEnd(1);
+        }
 		array[lastIndex++] = object;
 		modCount++;
 		return true;
@@ -152,6 +160,7 @@
      * @exception IndexOutOfBoundsException when
      *            <code>location < 0 || > size()</code>
      */
+    @Override
     public boolean addAll(int location, Collection<? extends E> collection) {
         int size = size();
         if (location < 0 || location > size) {
@@ -183,8 +192,9 @@
             growAtFront(growSize);
             firstIndex -= growSize;
         } else if (location == size) {
-            if (lastIndex > array.length - growSize)
+            if (lastIndex > array.length - growSize) {
                 growAtEnd(growSize);
+            }
             lastIndex += growSize;
         }
 
@@ -192,8 +202,9 @@
             Iterator<? extends E> it = collection.iterator();
             int index = location + firstIndex;
             int end = index + growSize;
-            while (index < end)
+            while (index < end) {
                 array[index++] = it.next();
+            }
             modCount++;
             return true;
         }
@@ -207,15 +218,18 @@
 	 *            the Collection of objects
 	 * @return true if this ArrayList is modified, false otherwise
 	 */
-	public boolean addAll(Collection<? extends E> collection) {
+	@Override
+    public boolean addAll(Collection<? extends E> collection) {
 		int growSize = collection.size();
 		if (growSize > 0) {
-			if (lastIndex > array.length - growSize)
-				growAtEnd(growSize);
+			if (lastIndex > array.length - growSize) {
+                growAtEnd(growSize);
+            }
 			Iterator<? extends E> it = collection.iterator();
 			int end = lastIndex + growSize;
-			while (lastIndex < end)
-				array[lastIndex++] = it.next();
+			while (lastIndex < end) {
+                array[lastIndex++] = it.next();
+            }
 			modCount++;
 			return true;
 		}
@@ -228,7 +242,8 @@
 	 * @see #isEmpty
 	 * @see #size
 	 */
-	public void clear() {
+	@Override
+    public void clear() {
 		if (firstIndex != lastIndex) {
 			Arrays.fill(array, firstIndex, lastIndex, null);
 			firstIndex = lastIndex = 0;
@@ -244,11 +259,12 @@
 	 * 
 	 * @see java.lang.Cloneable
 	 */
-	@SuppressWarnings("unchecked")
+	@Override
+    @SuppressWarnings("unchecked")
     public Object clone() {
 		try {
 			ArrayList<E> newList = (ArrayList<E>) super.clone();
-			newList.array = (E[]) array.clone();
+			newList.array = array.clone();
 			return newList;
 		} catch (CloneNotSupportedException e) {
 			return null;
@@ -263,15 +279,20 @@
 	 * @return true if <code>object</code> is an element of this ArrayList,
 	 *         false otherwise
 	 */
-	public boolean contains(Object object) {
+	@Override
+    public boolean contains(Object object) {
 		if (object != null) {
-			for (int i = firstIndex; i < lastIndex; i++)
-				if (object.equals(array[i]))
-					return true;
+			for (int i = firstIndex; i < lastIndex; i++) {
+                if (object.equals(array[i])) {
+                    return true;
+                }
+            }
 		} else {
-			for (int i = firstIndex; i < lastIndex; i++)
-				if (array[i] == null)
-					return true;
+			for (int i = firstIndex; i < lastIndex; i++) {
+                if (array[i] == null) {
+                    return true;
+                }
+            }
 		}
 		return false;
 	}
@@ -286,10 +307,11 @@
 	 */
 	public void ensureCapacity(int minimumCapacity) {
 		if (array.length < minimumCapacity) {
-			if (firstIndex > 0)
-				growAtFront(minimumCapacity - array.length);
-			else
-				growAtEnd(minimumCapacity - array.length);
+			if (firstIndex > 0) {
+                growAtFront(minimumCapacity - array.length);
+            } else {
+                growAtEnd(minimumCapacity - array.length);
+            }
 		}
 	}
 
@@ -303,9 +325,10 @@
 	 * @exception IndexOutOfBoundsException
 	 *                when <code>location < 0 || >= size()</code>
 	 */
-	public E get(int location) {
+	@Override
+    public E get(int location) {
 		if (0 <= location && location < size()) {
-			return (E)array[firstIndex + location];
+			return array[firstIndex + location];
         }
 		throw new IndexOutOfBoundsException();
 	}
@@ -323,13 +346,16 @@
 			lastIndex = newLast;
 		} else {
 			int increment = size / 2;
-			if (required > increment)
-				increment = required;
-			if (increment < 12)
-				increment = 12;
+			if (required > increment) {
+                increment = required;
+            }
+			if (increment < 12) {
+                increment = 12;
+            }
 			E[] newArray = newElementArray(size + increment);
-			if (size > 0)
-				System.arraycopy(array, firstIndex, newArray, firstIndex, size);
+			if (size > 0) {
+                System.arraycopy(array, firstIndex, newArray, firstIndex, size);
+            }
 			array = newArray;
 		}
 	}
@@ -348,14 +374,17 @@
 			lastIndex = array.length;
 		} else {
 			int increment = size / 2;
-			if (required > increment)
-				increment = required;
-			if (increment < 12)
-				increment = 12;
+			if (required > increment) {
+                increment = required;
+            }
+			if (increment < 12) {
+                increment = 12;
+            }
 			E[] newArray = newElementArray(size + increment);
-			if (size > 0)
-				System.arraycopy(array, firstIndex, newArray, newArray.length
+			if (size > 0) {
+                System.arraycopy(array, firstIndex, newArray, newArray.length
 						- size, size);
+            }
 			firstIndex = newArray.length - size;
 			lastIndex = newArray.length;
 			array = newArray;
@@ -364,10 +393,12 @@
 
 	private void growForInsert(int location, int required) {
 		int size = size(), increment = size / 2;
-		if (required > increment)
-			increment = required;
-		if (increment < 12)
-			increment = 12;
+		if (required > increment) {
+            increment = required;
+        }
+		if (increment < 12) {
+            increment = 12;
+        }
 		E[] newArray = newElementArray(size + increment);
 		if (location < size / 2) {
 			int newFirst = newArray.length - (size + required);
@@ -394,15 +425,20 @@
 	 *            the object to search for
 	 * @return the index of the first occurrence of the object
 	 */
-	public int indexOf(Object object) {
+	@Override
+    public int indexOf(Object object) {
 		if (object != null) {
-			for (int i = firstIndex; i < lastIndex; i++)
-				if (object.equals(array[i]))
-					return i - firstIndex;
+			for (int i = firstIndex; i < lastIndex; i++) {
+                if (object.equals(array[i])) {
+                    return i - firstIndex;
+                }
+            }
 		} else {
-			for (int i = firstIndex; i < lastIndex; i++)
-				if (array[i] == null)
-					return i - firstIndex;
+			for (int i = firstIndex; i < lastIndex; i++) {
+                if (array[i] == null) {
+                    return i - firstIndex;
+                }
+            }
 		}
 		return -1;
 	}
@@ -414,7 +450,8 @@
 	 * 
 	 * @see #size
 	 */
-	public boolean isEmpty() {
+	@Override
+    public boolean isEmpty() {
 		return lastIndex == firstIndex;
 	}
 
@@ -426,15 +463,20 @@
 	 *            the object to search for
 	 * @return the index of the last occurrence of the object
 	 */
-	public int lastIndexOf(Object object) {
+	@Override
+    public int lastIndexOf(Object object) {
 		if (object != null) {
-			for (int i = lastIndex - 1; i >= firstIndex; i--)
-				if (object.equals(array[i]))
-					return i - firstIndex;
+			for (int i = lastIndex - 1; i >= firstIndex; i--) {
+                if (object.equals(array[i])) {
+                    return i - firstIndex;
+                }
+            }
 		} else {
-			for (int i = lastIndex - 1; i >= firstIndex; i--)
-				if (array[i] == null)
-					return i - firstIndex;
+			for (int i = lastIndex - 1; i >= firstIndex; i--) {
+                if (array[i] == null) {
+                    return i - firstIndex;
+                }
+            }
 		}
 		return -1;
 	}
@@ -449,19 +491,20 @@
 	 * @exception IndexOutOfBoundsException
 	 *                when <code>location < 0 || >= size()</code>
 	 */
-	public E remove(int location) {
+	@Override
+    public E remove(int location) {
 		E result;
 		int size = size();
 		if (0 <= location && location < size) {
 			if (location == size - 1) {
-				result = (E)array[--lastIndex];
+				result = array[--lastIndex];
 				array[lastIndex] = null;
 			} else if (location == 0) {
-				result = (E)array[firstIndex];
+				result = array[firstIndex];
 				array[firstIndex++] = null;
 			} else {
 				int elementIndex = firstIndex + location;
-				result = (E)array[elementIndex];
+				result = array[elementIndex];
 				if (location < size / 2) {
 					System.arraycopy(array, firstIndex, array, firstIndex + 1,
 							location);
@@ -472,8 +515,9 @@
 					array[--lastIndex] = null;
 				}
 			}
-		} else
-			throw new IndexOutOfBoundsException();
+		} else {
+            throw new IndexOutOfBoundsException();
+        }
 
 		modCount++;
 		return result;
@@ -492,10 +536,12 @@
 	 *                when <code>start < 0, start > end</code> or
 	 *                <code>end > size()</code>
 	 */
-	protected void removeRange(int start, int end) {
+	@Override
+    protected void removeRange(int start, int end) {
 		if (start >= 0 && start <= end && end <= size()) {
-			if (start == end)
-				return;
+			if (start == end) {
+                return;
+            }
 			int size = size();
 			if (end == size) {
 				Arrays.fill(array, firstIndex + start, lastIndex, null);
@@ -511,8 +557,9 @@
 				lastIndex = newLast;
 			}
 			modCount++;
-		} else
-			throw new IndexOutOfBoundsException();
+		} else {
+            throw new IndexOutOfBoundsException();
+        }
 	}
 
 	/**
@@ -528,9 +575,10 @@
 	 * @exception IndexOutOfBoundsException
 	 *                when <code>location < 0 || >= size()</code>
 	 */
-	public E set(int location, E object) {
+	@Override
+    public E set(int location, E object) {
 		if (0 <= location && location < size()) {
-			E result = (E)array[firstIndex + location];
+			E result = array[firstIndex + location];
 			array[firstIndex + location] = object;
 			return result;
 		}
@@ -542,7 +590,8 @@
 	 * 
 	 * @return the number of elements in this ArrayList
 	 */
-	public int size() {
+	@Override
+    public int size() {
 		return lastIndex - firstIndex;
 	}
 
@@ -551,7 +600,8 @@
 	 * 
 	 * @return an array of the elements from this ArrayList
 	 */
-	public Object[] toArray() {
+	@Override
+    public Object[] toArray() {
 		int size = size();
 		Object[] result = new Object[size];
 		System.arraycopy(array, firstIndex, result, 0, size);
@@ -573,7 +623,8 @@
 	 *                when the type of an element in this ArrayList cannot be
 	 *                stored in the type of the specified array
 	 */
-	@SuppressWarnings("unchecked")
+	@Override
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] contents) {
 		int size = size();
 		if (size > contents.length) {
@@ -581,8 +632,9 @@
 			contents = (T[]) Array.newInstance(ct, size);
         }
 		System.arraycopy(array, firstIndex, contents, 0, size);
-		if (size < contents.length)
-			contents[size] = null;
+		if (size < contents.length) {
+            contents[size] = null;
+        }
 		return contents;
 	}
 
@@ -609,8 +661,9 @@
 		stream.writeFields();
 		stream.writeInt(array.length);
 		Iterator<?> it = iterator();
-		while (it.hasNext())
-			stream.writeObject(it.next());
+		while (it.hasNext()) {
+            stream.writeObject(it.next());
+        }
 	}
 
 	@SuppressWarnings("unchecked")
@@ -619,7 +672,8 @@
 		ObjectInputStream.GetField fields = stream.readFields();
 		lastIndex = fields.get("size", 0); //$NON-NLS-1$
 		array = newElementArray(stream.readInt());
-		for (int i = 0; i < lastIndex; i++)
-			array[i] = (E)stream.readObject();
+		for (int i = 0; i < lastIndex; i++) {
+            array[i] = (E)stream.readObject();
+        }
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java?view=diff&rev=440606&r1=440605&r2=440606
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java Tue Sep  5 21:01:21 2006
@@ -2400,13 +2400,14 @@
       * @param toIndex -
       *            the index of the last element (exclusive) to be sorted.
       */
-     private static void mergeSort(Object[] in, Object[] out, int fromIndex,
+     @SuppressWarnings("unchecked")
+    private static void mergeSort(Object[] in, Object[] out, int fromIndex,
              int toIndex) {
          int len = toIndex - fromIndex;
          //use insertion sort for small arrays
          if (len <= SIMPLE_LENGTH) {
              for (int i = fromIndex + 1; i < toIndex; i++) {
-                 Comparable current = (Comparable) out[i];
+                 Comparable<Object> current = (Comparable<Object>)out[i];
                  Object prev = out[i - 1];
                  if (current.compareTo(prev) < 0) {
                      int j = i;
@@ -2426,7 +2427,7 @@
          // merging
 
          //if arrays are already sorted - no merge
-         if (((Comparable) in[med]).compareTo(in[med - 1]) >= 0) {
+         if (((Comparable<Object>)in[med]).compareTo(in[med - 1]) >= 0) {
              System.arraycopy(in, fromIndex, out, fromIndex, len);
              return;
          }
@@ -2434,8 +2435,8 @@
 
          // use merging with exponential search
          do {
-             Comparable fromVal = (Comparable) in[fromIndex];
-             Comparable rVal = (Comparable) in[r];
+             Comparable<Object> fromVal = (Comparable<Object>)in[fromIndex];
+             Comparable<Object> rVal = (Comparable<Object>) in[r];
              if (fromVal.compareTo(rVal) <= 0) {
                  int l_1 = find(in,rVal,-1,fromIndex+1,med-1);
                  int toCopy = l_1 - fromIndex + 1;
@@ -2486,7 +2487,8 @@
       * @param c -
       *            the comparator to determine the order of the array.
       */
-     private static void mergeSort(Object[] in, Object[] out, int fromIndex,
+     @SuppressWarnings("unchecked")
+    private static void mergeSort(Object[] in, Object[] out, int fromIndex,
              int toIndex, Comparator c) {
          int len = toIndex - fromIndex;
          //use insertion sort for small arrays
@@ -2567,7 +2569,8 @@
       * elements equals to val.
       *
       */
-     private static int find(Object[] arr, Comparable val, int bnd, int l, int r){
+     @SuppressWarnings("unchecked")
+    private static int find(Object[] arr, Comparable val, int bnd, int l, int r){
          int m = l ;
          int d = 1;
          while (m <= r) {
@@ -2611,7 +2614,8 @@
       * @param c -
       *            the comparator to determine the order of the array.
       */
-     private static int find(Object[] arr, Object val, int bnd, int l,
+     @SuppressWarnings("unchecked")
+    private static int find(Object[] arr, Object val, int bnd, int l,
              int r, Comparator c){
          int m = l ;
          int d = 1;
@@ -2747,7 +2751,7 @@
                  int end = toIndex - 1;
                  dst[fromIndex] = src[end--];
                  for (int i = fromIndex + 1; i < toIndex; i++, end--) {
-                     String current = (String) src[end];
+                     String current = src[end];
                      String prev;
                      int j = i;
                      while (j > fromIndex && current.compareTo(prev = dst[j - 1]) < 0) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java?view=diff&rev=440606&r1=440605&r2=440606
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/BitSet.java Tue Sep  5 21:01:21 2006
@@ -28,12 +28,11 @@
 public class BitSet implements Serializable, Cloneable {
 	private static final long serialVersionUID = 7997698588986878753L;
 
+    //Size in bits of the data type being used in the bits array
+    private static final int ELM_SIZE = 64;
+    
 	private long[] bits;
 
-	private static final int ELM_SIZE = 64; // Size in bits of the data type
-
-	// being used in the bits array
-
 	/**
 	 * Create a new BitSet with size equal to 64 bits
 	 * 
@@ -68,10 +67,11 @@
 	 * @see #set(int, int, boolean)
 	 */
 	public BitSet(int nbits) {
-		if (nbits >= 0)
-			bits = new long[(nbits / ELM_SIZE) + (nbits % ELM_SIZE > 0 ? 1 : 0)];
-		else
-			throw new NegativeArraySizeException();
+		if (nbits >= 0) {
+            bits = new long[(nbits / ELM_SIZE) + (nbits % ELM_SIZE > 0 ? 1 : 0)];
+        } else {
+            throw new NegativeArraySizeException();
+        }
 	}
 
 	/***************************************************************************
@@ -89,10 +89,11 @@
 	 * 
 	 * @return A copy of this BitSet.
 	 */
-	public Object clone() {
+	@Override
+    public Object clone() {
 		try {
 			BitSet clone = (BitSet) super.clone();
-			clone.bits = (long[]) bits.clone();
+			clone.bits = bits.clone();
 			return clone;
 		} catch (CloneNotSupportedException e) {
 			return null;
@@ -105,13 +106,15 @@
 	 * 
 	 * @param obj
 	 *            the <code>BitSet</code> object to compare
-	 * @return A boolean indicating whther or not this BitSet and obj are equal
+	 * @return A boolean indicating whether or not this BitSet and obj are equal
 	 * 
 	 * @see #hashCode
 	 */
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
+	@Override
+    public boolean equals(Object obj) {
+		if (this == obj) {
+            return true;
+        }
 		if (obj instanceof BitSet) {
 			long[] bsBits = ((BitSet) obj).bits;
 			int length1 = bits.length, length2 = bsBits.length;
@@ -119,19 +122,27 @@
 			// any of
 			// its extra bits are set. If so return false.
 			if (length1 <= length2) {
-				for (int i = 0; i < length1; i++)
-					if (bits[i] != bsBits[i])
-						return false;
-				for (int i = length1; i < length2; i++)
-					if (bsBits[i] != 0)
-						return false;
+				for (int i = 0; i < length1; i++) {
+                    if (bits[i] != bsBits[i]) {
+                        return false;
+                    }
+                }
+				for (int i = length1; i < length2; i++) {
+                    if (bsBits[i] != 0) {
+                        return false;
+                    }
+                }
 			} else {
-				for (int i = 0; i < length2; i++)
-					if (bits[i] != bsBits[i])
-						return false;
-				for (int i = length2; i < length1; i++)
-					if (bits[i] != 0)
-						return false;
+				for (int i = 0; i < length2; i++) {
+                    if (bits[i] != bsBits[i]) {
+                        return false;
+                    }
+                }
+				for (int i = length2; i < length1; i++) {
+                    if (bits[i] != 0) {
+                        return false;
+                    }
+                }
 			}
 			return true;
 		}
@@ -139,7 +150,7 @@
 	}
 
 	/**
-	 * Increase the size of the internal array to accomodate pos bits. The new
+	 * Increase the size of the internal array to accommodate pos bits. The new
 	 * array max index will be a multiple of 64
 	 * 
 	 * @param pos
@@ -162,12 +173,14 @@
 	 * @see #equals
 	 * @see java.util.Hashtable
 	 */
-	public int hashCode() {
+	@Override
+    public int hashCode() {
 		long x = 1234;
 		// for (int i = 0, length = bits.length; i < length; i+=2)
 		// x ^= (bits[i] + ((long)bits[i+1] << 32)) * (i/2 + 1);
-		for (int i = 0, length = bits.length; i < length; i++)
-			x ^= bits[i] * (i + 1);
+		for (int i = 0, length = bits.length; i < length; i++) {
+            x ^= bits[i] * (i + 1);
+        }
 		return (int) ((x >> 32) ^ x);
 	}
 
@@ -191,13 +204,13 @@
 	 */
 	public boolean get(int pos) {
 		if (pos >= 0) {
-			if (pos < bits.length * ELM_SIZE)
-				return (bits[pos / ELM_SIZE] & (1L << (pos % ELM_SIZE))) != 0;
-			else
-				return false;
-		} else
-			// Negative index specified
-			throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+			if (pos < bits.length * ELM_SIZE) {
+                return (bits[pos / ELM_SIZE] & (1L << (pos % ELM_SIZE))) != 0;
+            }
+            return false;
+		}
+        // Negative index specified
+        throw new IndexOutOfBoundsException(Msg.getString("K0006"));
 	}
 
 	/**
@@ -218,10 +231,12 @@
 	public BitSet get(int pos1, int pos2) {
 		if (pos1 >= 0 && pos2 >= 0 && pos2 >= pos1) {
 			int last = (bits.length * ELM_SIZE);
-			if (pos1 >= last || pos1 == pos2)
-				return new BitSet(0);
-			if (pos2 > last)
-				pos2 = last;
+			if (pos1 >= last || pos1 == pos2) {
+                return new BitSet(0);
+            }
+			if (pos2 > last) {
+                pos2 = last;
+            }
 
 			int idx1 = pos1 / ELM_SIZE;
 			int idx2 = (pos2 - 1) / ELM_SIZE;
@@ -231,35 +246,36 @@
 			if (idx1 == idx2) {
 				long result = (bits[idx1] & (factor1 & factor2)) >>> (pos1 % ELM_SIZE);
 				return new BitSet(new long[] { result });
-			} else {
-				long[] newbits = new long[idx2 - idx1 + 1];
-				// first fill in the first and last indexes in the new bitset
-				newbits[0] = bits[idx1] & factor1;
-				newbits[newbits.length - 1] = bits[idx2] & factor2;
-
-				// fill in the in between elements of the new bitset
-				for (int i = 1; i < idx2 - idx1; i++)
-					newbits[i] = bits[idx1 + i];
-
-				// shift all the elements in the new bitset to the right by pos1
-				// % ELM_SIZE
-				int numBitsToShift = pos1 % ELM_SIZE;
-				if (numBitsToShift != 0) {
-					for (int i = 0; i < newbits.length; i++) {
-						// shift the current element to the right regardless of
-						// sign
-						newbits[i] = newbits[i] >>> (numBitsToShift);
-
-						// apply the last x bits of newbits[i+1] to the current
-						// element
-						if (i != newbits.length - 1)
-							newbits[i] |= newbits[i + 1] << (ELM_SIZE - (numBitsToShift));
-					}
-				}
-				return new BitSet(newbits);
 			}
-		} else
-			throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            long[] newbits = new long[idx2 - idx1 + 1];
+            // first fill in the first and last indexes in the new bitset
+            newbits[0] = bits[idx1] & factor1;
+            newbits[newbits.length - 1] = bits[idx2] & factor2;
+
+            // fill in the in between elements of the new bitset
+            for (int i = 1; i < idx2 - idx1; i++) {
+                newbits[i] = bits[idx1 + i];
+            }
+
+            // shift all the elements in the new bitset to the right by pos1
+            // % ELM_SIZE
+            int numBitsToShift = pos1 % ELM_SIZE;
+            if (numBitsToShift != 0) {
+            	for (int i = 0; i < newbits.length; i++) {
+            		// shift the current element to the right regardless of
+            		// sign
+            		newbits[i] = newbits[i] >>> (numBitsToShift);
+
+            		// apply the last x bits of newbits[i+1] to the current
+            		// element
+            		if (i != newbits.length - 1) {
+                        newbits[i] |= newbits[i + 1] << (ELM_SIZE - (numBitsToShift));
+                    }
+            	}
+            }
+            return new BitSet(newbits);
+		}
+        throw new IndexOutOfBoundsException(Msg.getString("K0006"));
 	}
 
 	/**
@@ -276,12 +292,13 @@
 	 */
 	public void set(int pos) {
 		if (pos >= 0) {
-			if (pos >= bits.length * ELM_SIZE)
-				growBits(pos);
+			if (pos >= bits.length * ELM_SIZE) {
+                growBits(pos);
+            }
 			bits[pos / ELM_SIZE] |= 1L << (pos % ELM_SIZE);
-		} else
-			throw new IndexOutOfBoundsException(org.apache.harmony.luni.util.Msg
-					.getString("K0006")); //$NON-NLS-1$
+		} else {
+            throw new IndexOutOfBoundsException(Msg.getString("K0006")); //$NON-NLS-1$
+        }
 	}
 
 	/**
@@ -297,10 +314,11 @@
 	 * @see #set(int)
 	 */
 	public void set(int pos, boolean val) {
-		if (val)
-			set(pos);
-		else
-			clear(pos);
+		if (val) {
+            set(pos);
+        } else {
+            clear(pos);
+        }
 	}
 
 	/**
@@ -319,26 +337,30 @@
 	 */
 	public void set(int pos1, int pos2) {
 		if (pos1 >= 0 && pos2 >= 0 && pos2 >= pos1) {
-			if (pos1 == pos2)
-				return;
-			if (pos2 >= bits.length * ELM_SIZE)
-				growBits(pos2);
+			if (pos1 == pos2) {
+                return;
+            }
+			if (pos2 >= bits.length * ELM_SIZE) {
+                growBits(pos2);
+            }
 
 			int idx1 = pos1 / ELM_SIZE;
 			int idx2 = (pos2 - 1) / ELM_SIZE;
 			long factor1 = (~0L) << (pos1 % ELM_SIZE);
 			long factor2 = (~0L) >>> (ELM_SIZE - (pos2 % ELM_SIZE));
 
-			if (idx1 == idx2)
-				bits[idx1] |= (factor1 & factor2);
-			else {
+			if (idx1 == idx2) {
+                bits[idx1] |= (factor1 & factor2);
+            } else {
 				bits[idx1] |= factor1;
 				bits[idx2] |= factor2;
-				for (int i = idx1 + 1; i < idx2; i++)
-					bits[i] |= (~0L);
+				for (int i = idx1 + 1; i < idx2; i++) {
+                    bits[i] |= (~0L);
+                }
 			}
-		} else
-			throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+		} else {
+            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+        }
 	}
 
 	/**
@@ -358,10 +380,11 @@
 	 * @see #set(int,int)
 	 */
 	public void set(int pos1, int pos2, boolean val) {
-		if (val)
-			set(pos1, pos2);
-		else
-			clear(pos1, pos2);
+		if (val) {
+            set(pos1, pos2);
+        } else {
+            clear(pos1, pos2);
+        }
 	}
 
 	/**
@@ -388,11 +411,13 @@
 	 */
 	public void clear(int pos) {
 		if (pos >= 0) {
-			if (pos < bits.length * ELM_SIZE)
-				bits[pos / ELM_SIZE] &= ~(1L << (pos % ELM_SIZE));
-		} else
-			// Negative index specified
+			if (pos < bits.length * ELM_SIZE) {
+                bits[pos / ELM_SIZE] &= ~(1L << (pos % ELM_SIZE));
+            }
+		} else {
+            // Negative index specified
 			throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+        }
 	}
 
 	/**
@@ -412,26 +437,30 @@
 	public void clear(int pos1, int pos2) {
 		if (pos1 >= 0 && pos2 >= 0 && pos2 >= pos1) {
 			int last = (bits.length * ELM_SIZE);
-			if (pos1 >= last || pos1 == pos2)
-				return;
-			if (pos2 > last)
-				pos2 = last;
+			if (pos1 >= last || pos1 == pos2) {
+                return;
+            }
+			if (pos2 > last) {
+                pos2 = last;
+            }
 
 			int idx1 = pos1 / ELM_SIZE;
 			int idx2 = (pos2 - 1) / ELM_SIZE;
 			long factor1 = (~0L) << (pos1 % ELM_SIZE);
 			long factor2 = (~0L) >>> (ELM_SIZE - (pos2 % ELM_SIZE));
 
-			if (idx1 == idx2)
-				bits[idx1] &= ~(factor1 & factor2);
-			else {
+			if (idx1 == idx2) {
+                bits[idx1] &= ~(factor1 & factor2);
+            } else {
 				bits[idx1] &= ~factor1;
 				bits[idx2] &= ~factor2;
-				for (int i = idx1 + 1; i < idx2; i++)
-					bits[i] = 0L;
+				for (int i = idx1 + 1; i < idx2; i++) {
+                    bits[i] = 0L;
+                }
 			}
-		} else
-			throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+		} else {
+            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+        }
 }
 
 	/**
@@ -446,12 +475,13 @@
 	 */
 	public void flip(int pos) {
 		if (pos >= 0) {
-			if (pos >= bits.length * ELM_SIZE)
-				growBits(pos);
+			if (pos >= bits.length * ELM_SIZE) {
+                growBits(pos);
+            }
 			bits[pos / ELM_SIZE] ^= 1L << (pos % ELM_SIZE);
-		} else
-			throw new IndexOutOfBoundsException(org.apache.harmony.luni.util.Msg
-					.getString("K0006")); //$NON-NLS-1$
+		} else {
+            throw new IndexOutOfBoundsException(Msg.getString("K0006")); //$NON-NLS-1$
+        }
 	}
 
 	/**
@@ -470,26 +500,30 @@
 	 */
 	public void flip(int pos1, int pos2) {
 		if (pos1 >= 0 && pos2 >= 0 && pos2 >= pos1) {
-			if (pos1 == pos2)
-				return;
-			if (pos2 >= bits.length * ELM_SIZE)
-				growBits(pos2);
+			if (pos1 == pos2) {
+                return;
+            }
+			if (pos2 >= bits.length * ELM_SIZE) {
+                growBits(pos2);
+            }
 
 			int idx1 = pos1 / ELM_SIZE;
 			int idx2 = (pos2 - 1) / ELM_SIZE;
 			long factor1 = (~0L) << (pos1 % ELM_SIZE);
 			long factor2 = (~0L) >>> (ELM_SIZE - (pos2 % ELM_SIZE));
 
-			if (idx1 == idx2)
-				bits[idx1] ^= (factor1 & factor2);
-			else {
+			if (idx1 == idx2) {
+                bits[idx1] ^= (factor1 & factor2);
+            } else {
 				bits[idx1] ^= factor1;
 				bits[idx2] ^= factor2;
-				for (int i = idx1 + 1; i < idx2; i++)
-					bits[i] ^= (~0L);
+				for (int i = idx1 + 1; i < idx2; i++) {
+                    bits[i] ^= (~0L);
+                }
 			}
-		} else
-			throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+		} else {
+            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+        }
 	}
 
 	/**
@@ -506,13 +540,17 @@
 		int length1 = bits.length, length2 = bsBits.length;
 
 		if (length1 <= length2) {
-			for (int i = 0; i < length1; i++)
-				if ((bits[i] & bsBits[i]) != 0L)
-					return true;
+			for (int i = 0; i < length1; i++) {
+                if ((bits[i] & bsBits[i]) != 0L) {
+                    return true;
+                }
+            }
 		} else {
-			for (int i = 0; i < length2; i++)
-				if ((bits[i] & bsBits[i]) != 0L)
-					return true;
+			for (int i = 0; i < length2; i++) {
+                if ((bits[i] & bsBits[i]) != 0L) {
+                    return true;
+                }
+            }
 		}
 
 		return false;
@@ -532,13 +570,16 @@
 		long[] bsBits = bs.bits;
 		int length1 = bits.length, length2 = bsBits.length;
 		if (length1 <= length2) {
-			for (int i = 0; i < length1; i++)
-				bits[i] &= bsBits[i];
+			for (int i = 0; i < length1; i++) {
+                bits[i] &= bsBits[i];
+            }
 		} else {
-			for (int i = 0; i < length2; i++)
-				bits[i] &= bsBits[i];
-			for (int i = length2; i < length1; i++)
-				bits[i] = 0;
+			for (int i = 0; i < length2; i++) {
+                bits[i] &= bsBits[i];
+            }
+			for (int i = length2; i < length1; i++) {
+                bits[i] = 0;
+            }
 		}
 	}
 
@@ -552,8 +593,9 @@
 	public void andNot(BitSet bs) {
 		long[] bsBits = bs.bits;
 		int range = bits.length < bsBits.length ? bits.length : bsBits.length;
-		for (int i = 0; i < range; i++)
-			bits[i] &= ~bsBits[i];
+		for (int i = 0; i < range; i++) {
+            bits[i] &= ~bsBits[i];
+        }
 	}
 
 	/**
@@ -568,11 +610,13 @@
 	public void or(BitSet bs) {
 		int nbits = bs.length();
 		int length = nbits / ELM_SIZE + (nbits % ELM_SIZE > 0 ? 1 : 0);
-		if (length > bits.length)
-			growBits(nbits - 1);
+		if (length > bits.length) {
+            growBits(nbits - 1);
+        }
 		long[] bsBits = bs.bits;
-		for (int i = 0; i < length; i++)
-			bits[i] |= bsBits[i];
+		for (int i = 0; i < length; i++) {
+            bits[i] |= bsBits[i];
+        }
 	}
 
 	/**
@@ -587,11 +631,13 @@
 	public void xor(BitSet bs) {
 		int nbits = bs.length();
 		int length = nbits / ELM_SIZE + (nbits % ELM_SIZE > 0 ? 1 : 0);
-		if (length > bits.length)
-			growBits(nbits - 1);
+		if (length > bits.length) {
+            growBits(nbits - 1);
+        }
 		long[] bsBits = bs.bits;
-		for (int i = 0; i < length; i++)
-			bits[i] ^= bsBits[i];
+		for (int i = 0; i < length; i++) {
+            bits[i] ^= bsBits[i];
+        }
 
 	}
 
@@ -613,14 +659,17 @@
 	 */
 	public int length() {
 		int idx = bits.length - 1;
-		while (idx >= 0 && bits[idx] == 0)
-			--idx;
-		if (idx == -1)
-			return 0;
+		while (idx >= 0 && bits[idx] == 0) {
+            --idx;
+        }
+		if (idx == -1) {
+            return 0;
+        }
 		int i = ELM_SIZE - 1;
 		long val = bits[idx];
-		while ((val & (1L << i)) == 0 && i > 0)
-			i--;
+		while ((val & (1L << i)) == 0 && i > 0) {
+            i--;
+        }
 		return idx * ELM_SIZE + i + 1;
 	}
 
@@ -630,7 +679,8 @@
 	 * 
 	 * @return A comma delimited list of the indices of all bits that are set.
 	 */
-	public String toString() {
+	@Override
+    public String toString() {
 		StringBuffer sb = new StringBuffer(bits.length / 2);
 		int bitCount = 0;
 		sb.append('{');
@@ -642,8 +692,9 @@
 			}
 			for (int j = 0; j < ELM_SIZE; j++) {
 				if (((bits[i] & (1L << j)) != 0)) {
-					if (comma)
-						sb.append(", "); //$NON-NLS-1$
+					if (comma) {
+                        sb.append(", "); //$NON-NLS-1$
+                    }
 					sb.append(bitCount);
 					comma = true;
 				}
@@ -663,33 +714,39 @@
 	 */
 	public int nextSetBit(int pos) {
 		if (pos >= 0) {
-			if (pos >= bits.length * ELM_SIZE)
-				return -1;
+			if (pos >= bits.length * ELM_SIZE) {
+                return -1;
+            }
 
 			int idx = pos / ELM_SIZE;
 			// first check in the same bit set element
 			if (bits[idx] != 0L) {
-				for (int j = pos % ELM_SIZE; j < ELM_SIZE; j++)
-					if (((bits[idx] & (1L << j)) != 0))
-						return idx * ELM_SIZE + j;
+				for (int j = pos % ELM_SIZE; j < ELM_SIZE; j++) {
+                    if (((bits[idx] & (1L << j)) != 0)) {
+                        return idx * ELM_SIZE + j;
+                    }
+                }
 
 			}
 			idx++;
-			while (idx < bits.length && bits[idx] == 0L)
-				idx++;
-			if (idx == bits.length)
-				return -1;
+			while (idx < bits.length && bits[idx] == 0L) {
+                idx++;
+            }
+			if (idx == bits.length) {
+                return -1;
+            }
 
 			// we know for sure there is a bit set to true in this element
 			// since the bitset value is not 0L
-			for (int j = 0; j < ELM_SIZE; j++)
-				if (((bits[idx] & (1L << j)) != 0))
-					return idx * ELM_SIZE + j;
+			for (int j = 0; j < ELM_SIZE; j++) {
+                if (((bits[idx] & (1L << j)) != 0)) {
+                    return idx * ELM_SIZE + j;
+                }
+            }
 
 			return -1;
-		} else
-			throw new IndexOutOfBoundsException(org.apache.harmony.luni.util.Msg
-					.getString("K0006")); //$NON-NLS-1$
+		}
+        throw new IndexOutOfBoundsException(Msg.getString("K0006")); //$NON-NLS-1$
 	}
 
 	/**
@@ -703,33 +760,39 @@
 	public int nextClearBit(int pos) {
 		if (pos >= 0) {
 			int bssize = bits.length * ELM_SIZE;
-			if (pos >= bssize)
-				return pos;
+			if (pos >= bssize) {
+                return pos;
+            }
 
 			int idx = pos / ELM_SIZE;
 			// first check in the same bit set element
 			if (bits[idx] != (~0L)) {
-				for (int j = pos % ELM_SIZE; j < ELM_SIZE; j++)
-					if (((bits[idx] & (1L << j)) == 0))
-						return idx * ELM_SIZE + j;
+				for (int j = pos % ELM_SIZE; j < ELM_SIZE; j++) {
+                    if (((bits[idx] & (1L << j)) == 0)) {
+                        return idx * ELM_SIZE + j;
+                    }
+                }
 
 			}
 			idx++;
-			while (idx < bits.length && bits[idx] == (~0L))
-				idx++;
-			if (idx == bits.length)
-				return bssize;
+			while (idx < bits.length && bits[idx] == (~0L)) {
+                idx++;
+            }
+			if (idx == bits.length) {
+                return bssize;
+            }
 
 			// we know for sure there is a bit set to true in this element
 			// since the bitset value is not 0L
-			for (int j = 0; j < ELM_SIZE; j++)
-				if (((bits[idx] & (1L << j)) == 0))
-					return idx * ELM_SIZE + j;
+			for (int j = 0; j < ELM_SIZE; j++) {
+                if (((bits[idx] & (1L << j)) == 0)) {
+                    return idx * ELM_SIZE + j;
+                }
+            }
 
 			return bssize;
-		} else
-			throw new IndexOutOfBoundsException(org.apache.harmony.luni.util.Msg
-					.getString("K0006")); //$NON-NLS-1$
+		}
+        throw new IndexOutOfBoundsException(Msg.getString("K0006")); //$NON-NLS-1$
 	}
 
 	/**
@@ -739,9 +802,11 @@
 	 *         otherwise
 	 */
 	public boolean isEmpty() {
-		for (int idx = 0; idx < bits.length; idx++)
-			if (bits[idx] != 0L)
-				return false;
+		for (int idx = 0; idx < bits.length; idx++) {
+            if (bits[idx] != 0L) {
+                return false;
+            }
+        }
 
 		return true;
 	}
@@ -757,8 +822,9 @@
 			long temp = bits[idx];
 			if (temp != 0L) {
 				for (int i = 0; i < ELM_SIZE; i++) {
-					if ((temp & (1L << i)) != 0L)
-						count++;
+					if ((temp & (1L << i)) != 0L) {
+                        count++;
+                    }
 				}
 			}
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java?view=diff&rev=440606&r1=440605&r2=440606
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java Tue Sep  5 21:01:21 2006
@@ -150,7 +150,7 @@
 	/**
 	 * Answers if the Date specified by this Calendar instance is after the Date
 	 * specified by the parameter. The comparison is not dependent on the
-	 * timezones of the Calendars.
+	 * time zones of the Calendars.
 	 * 
 	 * @param calendar
 	 *            the Calendar instance to compare
@@ -161,15 +161,16 @@
 	 *                from the current field values
 	 */
 	public boolean after(Object calendar) {
-		if (!(calendar instanceof Calendar))
-			return false;
+		if (!(calendar instanceof Calendar)) {
+            return false;
+        }
 		return getTimeInMillis() > ((Calendar) calendar).getTimeInMillis();
 	}
 
 	/**
 	 * Answers if the Date specified by this Calendar instance is before the
 	 * Date specified by the parameter. The comparison is not dependent on the
-	 * timezones of the Calendars.
+	 * time zones of the Calendars.
 	 * 
 	 * @param calendar
 	 *            the Calendar instance to compare
@@ -180,8 +181,9 @@
 	 *                from the current field values
 	 */
 	public boolean before(Object calendar) {
-		if (!(calendar instanceof Calendar))
-			return false;
+		if (!(calendar instanceof Calendar)) {
+            return false;
+        }
 		return getTimeInMillis() < ((Calendar) calendar).getTimeInMillis();
 	}
 
@@ -217,11 +219,12 @@
 	 * 
 	 * @see java.lang.Cloneable
 	 */
-	public Object clone() {
+	@Override
+    public Object clone() {
 		try {
 			Calendar clone = (Calendar) super.clone();
-			clone.fields = (int[]) fields.clone();
-			clone.isSet = (boolean[]) isSet.clone();
+			clone.fields = fields.clone();
+			clone.isSet = isSet.clone();
 			clone.zone = (TimeZone) zone.clone();
 			return clone;
 		} catch (CloneNotSupportedException e) {
@@ -273,11 +276,14 @@
 	 * @return true if the specified object is equal to this Calendar, false
 	 *         otherwise
 	 */
-	public boolean equals(Object object) {
-		if (this == object)
-			return true;
-		if (!(object instanceof Calendar))
-			return false;
+	@Override
+    public boolean equals(Object object) {
+		if (this == object) {
+            return true;
+        }
+		if (!(object instanceof Calendar)) {
+            return false;
+        }
 		Calendar cal = (Calendar) object;
 		return getTimeInMillis() == cal.getTimeInMillis()
 				&& isLenient() == cal.isLenient()
@@ -313,8 +319,9 @@
 	 */
 	public int getActualMaximum(int field) {
 		int value, next;
-		if (getMaximum(field) == (next = getLeastMaximum(field)))
-			return next;
+		if (getMaximum(field) == (next = getLeastMaximum(field))) {
+            return next;
+        }
 		complete();
 		long orgTime = time;
 		set(field, next);
@@ -337,8 +344,9 @@
 	 */
 	public int getActualMinimum(int field) {
 		int value, next;
-		if (getMinimum(field) == (next = getGreatestMinimum(field)))
-			return next;
+		if (getMinimum(field) == (next = getGreatestMinimum(field))) {
+            return next;
+        }
 		complete();
 		long orgTime = time;
 		set(field, next);
@@ -514,7 +522,8 @@
 	 * 
 	 * @see #equals
 	 */
-	public int hashCode() {
+	@Override
+    public int hashCode() {
 		return (isLenient() ? 1237 : 1231) + getFirstDayOfWeek()
 				+ getMinimalDaysInFirstWeek() + getTimeZone().hashCode();
 	}
@@ -565,8 +574,9 @@
 	public void roll(int field, int value) {
 		boolean increment = value >= 0;
 		int count = increment ? value : -value;
-		for (int i = 0; i < count; i++)
-			roll(field, increment);
+		for (int i = 0; i < count; i++) {
+            roll(field, increment);
+        }
 	}
 
 	/**
@@ -594,10 +604,12 @@
 		fields[field] = value;
 		isSet[field] = true;
 		areFieldsSet = isTimeSet = false;
-		if (field > MONTH && field < AM_PM)
-			lastDateFieldSet = field;
-		if (field == HOUR || field == HOUR_OF_DAY)
-			lastTimeFieldSet = field;
+		if (field > MONTH && field < AM_PM) {
+            lastDateFieldSet = field;
+        }
+		if (field == HOUR || field == HOUR_OF_DAY) {
+            lastTimeFieldSet = field;
+        }
 	}
 
 	/**
@@ -729,7 +741,8 @@
 	 * 
 	 * @return the string representation of this Calendar
 	 */
-	public String toString() {
+	@Override
+    public String toString() {
 		StringBuffer result = new StringBuffer(getClass().getName() + "[time=" //$NON-NLS-1$
 				+ (isTimeSet ? String.valueOf(time) : "?") + ",areFieldsSet="  //$NON-NLS-1$//$NON-NLS-2$
 				+ areFieldsSet +
@@ -741,10 +754,11 @@
 			result.append(',');
 			result.append(fieldNames[i]);
 			result.append('=');
-			if (isSet[i])
-				result.append(fields[i]);
-			else
-				result.append('?');
+			if (isSet[i]) {
+                result.append(fields[i]);
+            } else {
+                result.append('?');
+            }
 		}
 		result.append(']');
 		return result.toString();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java?view=diff&rev=440606&r1=440605&r2=440606
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java Tue Sep  5 21:01:21 2006
@@ -42,15 +42,18 @@
 			element = object;
 		}
 
-		public boolean contains(Object object) {
+		@Override
+        public boolean contains(Object object) {
 			return element == null ? object == null : element.equals(object);
 		}
 
-		public int size() {
+		@Override
+        public int size() {
 			return n;
 		}
 
-		public E get(int location) {
+		@Override
+        public E get(int location) {
 			if (0 <= location && location < n) {
                 return element;
             }
@@ -63,15 +66,18 @@
 			Serializable {
 		private static final long serialVersionUID = 8842843931221139166L;
 
-		public boolean contains(Object object) {
+		@Override
+        public boolean contains(Object object) {
 			return false;
 		}
 
-		public int size() {
+		@Override
+        public int size() {
 			return 0;
 		}
 
-		public Object get(int location) {
+		@Override
+        public Object get(int location) {
 			throw new IndexOutOfBoundsException();
 		}
         
@@ -85,15 +91,18 @@
 			Serializable {
 		private static final long serialVersionUID = 1582296315990362920L;
 
-		public boolean contains(Object object) {
+		@Override
+        public boolean contains(Object object) {
 			return false;
 		}
 
-		public int size() {
+		@Override
+        public int size() {
 			return 0;
 		}
 
-		public Iterator iterator() {
+		@Override
+        public Iterator iterator() {
 			return new Iterator() {
 				public boolean hasNext() {
 					return false;
@@ -119,27 +128,33 @@
 			Serializable {
 		private static final long serialVersionUID = 6428348081105594320L;
 
-		public boolean containsKey(Object key) {
+		@Override
+        public boolean containsKey(Object key) {
 			return false;
 		}
 
-		public boolean containsValue(Object value) {
+		@Override
+        public boolean containsValue(Object value) {
 			return false;
 		}
 
-		public Set entrySet() {
+		@Override
+        public Set entrySet() {
 			return EMPTY_SET;
 		}
 
-		public Object get(Object key) {
+		@Override
+        public Object get(Object key) {
 			return null;
 		}
 
-		public Set keySet() {
+		@Override
+        public Set keySet() {
 			return EMPTY_SET;
 		}
 
-		public Collection values() {
+		@Override
+        public Collection values() {
 			return EMPTY_LIST;
 		}
         
@@ -192,15 +207,18 @@
 			element = object;
 		}
 
-		public boolean contains(Object object) {
+		@Override
+        public boolean contains(Object object) {
 			return element == null ? object == null : element.equals(object);
 		}
 
-		public int size() {
+		@Override
+        public int size() {
 			return 1;
 		}
 
-		public Iterator<E> iterator() {
+		@Override
+        public Iterator<E> iterator() {
 			return new Iterator<E>() {
 				boolean hasNext = true;
 
@@ -212,9 +230,8 @@
 					if (hasNext) {
 						hasNext = false;
 						return element;
-					} else {
-                        throw new NoSuchElementException();
-                    }
+					}
+                    throw new NoSuchElementException();
 				}
 
 				public void remove() {
@@ -234,18 +251,21 @@
 			element = object;
 		}
 
-		public boolean contains(Object object) {
+		@Override
+        public boolean contains(Object object) {
 			return element == null ? object == null : element.equals(object);
 		}
 
-		public E get(int location) {
+		@Override
+        public E get(int location) {
 			if (location == 0) {
                 return element;
             }
 			throw new IndexOutOfBoundsException();
 		}
 
-		public int size() {
+		@Override
+        public int size() {
 			return 1;
 		}
 	}
@@ -262,28 +282,34 @@
 			v = value;
 		}
 
-		public boolean containsKey(Object key) {
+		@Override
+        public boolean containsKey(Object key) {
 			return k == null ? key == null : k.equals(key);
 		}
 
-		public boolean containsValue(Object value) {
+		@Override
+        public boolean containsValue(Object value) {
 			return v == null ? value == null : v.equals(value);
 		}
 
-		public V get(Object key) {
+		@Override
+        public V get(Object key) {
 			if (containsKey(key)) {
                 return v;
             }
 			return null;
 		}
 
-		public int size() {
+		@Override
+        public int size() {
 			return 1;
 		}
 
-		public Set<Map.Entry<K, V>> entrySet() {
+		@Override
+        public Set<Map.Entry<K, V>> entrySet() {
 			return new AbstractSet<Map.Entry<K, V>>() {
-				public boolean contains(Object object) {
+				@Override
+                public boolean contains(Object object) {
 					if (object instanceof Map.Entry) {
 						Map.Entry<?, ?> entry = (Map.Entry) object;
 						return containsKey(entry.getKey())
@@ -292,11 +318,13 @@
 					return false;
 				}
 
-				public int size() {
+				@Override
+                public int size() {
 					return 1;
 				}
 
-				public Iterator<Map.Entry<K, V>> iterator() {
+				@Override
+                public Iterator<Map.Entry<K, V>> iterator() {
 					return new Iterator<Map.Entry<K, V>>() {
 						boolean hasNext = true;
 
@@ -308,7 +336,8 @@
 							if (hasNext) {
 								hasNext = false;
 								return new Map.Entry<K, V>() {
-									public boolean equals(Object object) {
+									@Override
+                                    public boolean equals(Object object) {
 										return contains(object);
 									}
 
@@ -320,7 +349,8 @@
 										return v;
 									}
 
-									public int hashCode() {
+									@Override
+                                    public int hashCode() {
 										return (k == null ? 0 : k.hashCode())
 												^ (v == null ? 0 : v.hashCode());
 									}
@@ -329,9 +359,8 @@
 										throw new UnsupportedOperationException();
 									}
 								};
-							} else {
-                                throw new NoSuchElementException();
-                            }
+							}
+                            throw new NoSuchElementException();
 						}
 
 						public void remove() {
@@ -431,7 +460,8 @@
 			}
 		}
 
-		public String toString() {
+		@Override
+        public String toString() {
 			synchronized (mutex) {
 				return c.toString();
 			}
@@ -462,7 +492,8 @@
 			super(l, mutex);
 		}
 
-		public List<E> subList(int start, int end) {
+		@Override
+        public List<E> subList(int start, int end) {
 			synchronized (mutex) {
 				return new SynchronizedRandomAccessList<E>(list
 						.subList(start, end), mutex);
@@ -512,7 +543,8 @@
 			}
 		}
 
-		public boolean equals(Object object) {
+		@Override
+        public boolean equals(Object object) {
 			synchronized (mutex) {
 				return list.equals(object);
 			}
@@ -524,7 +556,8 @@
 			}
 		}
 
-		public int hashCode() {
+		@Override
+        public int hashCode() {
 			synchronized (mutex) {
 				return list.hashCode();
 			}
@@ -595,9 +628,8 @@
 		private Object readResolve() {
 			if (list instanceof RandomAccess) {
                 return new SynchronizedRandomAccessList<E>(list, mutex);
-            } else {
-                return this;
             }
+            return this;
 		}
 	}
 
@@ -641,7 +673,8 @@
 			}
 		}
 
-		public boolean equals(Object object) {
+		@Override
+        public boolean equals(Object object) {
 			synchronized (mutex) {
 				return m.equals(object);
 			}
@@ -653,7 +686,8 @@
 			}
 		}
 
-		public int hashCode() {
+		@Override
+        public int hashCode() {
 			synchronized (mutex) {
 				return m.hashCode();
 			}
@@ -701,7 +735,8 @@
 			}
 		}
 
-		public String toString() {
+		@Override
+        public String toString() {
 			synchronized (mutex) {
 				return m.toString();
 			}
@@ -725,13 +760,15 @@
 			super(set, mutex);
 		}
 
-		public boolean equals(Object object) {
+		@Override
+        public boolean equals(Object object) {
 			synchronized (mutex) {
 				return c.equals(object);
 			}
 		}
 
-		public int hashCode() {
+		@Override
+        public int hashCode() {
 			synchronized (mutex) {
 				return c.hashCode();
 			}
@@ -939,6 +976,7 @@
             return c.toArray(array);
         }
 
+        @Override
         public String toString() {
             return c.toString();
         }
@@ -952,7 +990,8 @@
 			super(l);
 		}
 
-		public List<E> subList(int start, int end) {
+		@Override
+        public List<E> subList(int start, int end) {
 			return new UnmodifiableRandomAccessList<E>(list.subList(start, end));
 		}
 
@@ -990,7 +1029,8 @@
 			throw new UnsupportedOperationException();
 		}
 
-		public boolean equals(Object object) {
+		@Override
+        public boolean equals(Object object) {
 			return list.equals(object);
 		}
 
@@ -998,7 +1038,8 @@
 			return list.get(location);
 		}
 
-		public int hashCode() {
+		@Override
+        public int hashCode() {
 			return list.hashCode();
 		}
 
@@ -1086,9 +1127,8 @@
 		private Object readResolve() {
 			if (list instanceof RandomAccess) {
                 return new UnmodifiableRandomAccessList<E>(list);
-            } else {
-                return this;
             }
+            return this;
 		}
 	}
 
@@ -1107,7 +1147,8 @@
 					mapEntry = entry;
 				}
 
-				public boolean equals(Object object) {
+				@Override
+                public boolean equals(Object object) {
 					return mapEntry.equals(object);
 				}
 
@@ -1119,7 +1160,8 @@
 					return mapEntry.getValue();
 				}
 
-				public int hashCode() {
+				@Override
+                public int hashCode() {
 					return mapEntry.hashCode();
 				}
 
@@ -1127,7 +1169,8 @@
 					throw new UnsupportedOperationException();
 				}
 
-				public String toString() {
+				@Override
+                public String toString() {
 					return mapEntry.toString();
 				}
 			}
@@ -1136,7 +1179,8 @@
 				super(set);
 			}
 
-			public Iterator<Map.Entry<K, V>> iterator() {
+			@Override
+            public Iterator<Map.Entry<K, V>> iterator() {
 				return new Iterator<Map.Entry<K, V>>() {
 					Iterator<Map.Entry<K, V>> iterator = c.iterator();
 
@@ -1154,7 +1198,8 @@
 				};
 			}
 
-			public Object[] toArray() {
+			@Override
+            public Object[] toArray() {
 				int length = c.size();
 				Object[] result = new Object[length];
 				Iterator<?> it = iterator();
@@ -1164,7 +1209,8 @@
 				return result;
 			}
 
-			@SuppressWarnings("unchecked")
+			@Override
+            @SuppressWarnings("unchecked")
             public <T> T[] toArray(T[] contents) {
 				int size = c.size(), index = 0;
 				Iterator<Map.Entry<K, V>> it = iterator();
@@ -1202,7 +1248,8 @@
 			return new UnmodifiableEntrySet<K, V>(m.entrySet());
 		}
 
-		public boolean equals(Object object) {
+		@Override
+        public boolean equals(Object object) {
 			return m.equals(object);
 		}
 
@@ -1210,7 +1257,8 @@
 			return m.get(key);
 		}
 
-		public int hashCode() {
+		@Override
+        public int hashCode() {
 			return m.hashCode();
 		}
 
@@ -1242,7 +1290,8 @@
 			return new UnmodifiableCollection<V>(m.values());
 		}
 
-		public String toString() {
+		@Override
+        public String toString() {
 		    return m.toString();
 		}
 	}
@@ -1255,11 +1304,13 @@
 			super(set);
 		}
 
-		public boolean equals(Object object) {
+		@Override
+        public boolean equals(Object object) {
 			return c.equals(object);
 		}
 
-		public int hashCode() {
+		@Override
+        public int hashCode() {
 			return c.hashCode();
 		}
 	}
@@ -1368,9 +1419,8 @@
 				if ((result = key.compareTo(it.next())) <= 0) {
                     if (result == 0) {
                         return it.previousIndex();
-                    } else {
-                        return -it.previousIndex() - 1;
                     }
+                    return -it.previousIndex() - 1;
                 }
 			}
 			return -list.size() - 1;
@@ -1421,9 +1471,8 @@
 				if ((result = comparator.compare(object, it.next())) <= 0) {
                     if (result == 0) {
                         return it.previousIndex();
-                    } else {
-                        return -it.previousIndex() - 1;
                     }
+                    return -it.previousIndex() - 1;
                 }
 			}
 			return -list.size() - 1;
@@ -1992,13 +2041,12 @@
 					Object element = sublistIt.next();
 					if (!listIt.hasNext()) {
                         return -1;
-                    } else {
-						if ((element == null) ? listIt.next() != null
-								: !element.equals(listIt.next())) {
-							difFound = true;
-							break;
-						}
-					}
+                    }
+                    if ((element == null) ? listIt.next() != null
+                    		: !element.equals(listIt.next())) {
+                    	difFound = true;
+                    	break;
+                    }
 				}
 				// All elements of sublist are found in main list
 				// starting from index.
@@ -2057,13 +2105,12 @@
 					Object element = sublistIt.previous();
 					if (!listIt.hasPrevious()) {
                         return -1;
-                    } else {
-						if ((element == null) ? listIt.previous() != null
-								: !element.equals(listIt.previous())) {
-							difFound = true;
-							break;
-						}
-					}
+                    }
+                    if ((element == null) ? listIt.previous() != null
+                    		: !element.equals(listIt.previous())) {
+                    	difFound = true;
+                    	break;
+                    }
 				}
 				// All elements of sublist are found in main list
 				// starting from listIt.nextIndex().
@@ -2125,9 +2172,8 @@
         }
 		if (list instanceof RandomAccess) {
             return new SynchronizedRandomAccessList<T>(list);
-        } else {
-            return new SynchronizedList<T>(list);
         }
+        return new SynchronizedList<T>(list);
 	}
 
 	/**
@@ -2223,9 +2269,8 @@
         }
 		if (list instanceof RandomAccess) {
             return new UnmodifiableRandomAccessList<E>((List<E>)list);
-        } else {
-            return new UnmodifiableList<E>((List<E>)list);
         }
+        return new UnmodifiableList<E>((List<E>)list);
 	}
 
 	/**
@@ -2397,9 +2442,8 @@
     public static <E> List<E> checkedList(List<E> list, Class<E> type) {
         if (list instanceof RandomAccess) {
             return new CheckedRandomAccessList<E>(list, type);
-        } else {
-            return new CheckedList<E>(list, type);
         }
+        return new CheckedList<E>(list, type);
     }
 
     /**
@@ -2639,6 +2683,7 @@
         /**
          * @see java.lang.Object#toString()
          */
+        @Override
         public String toString() {
             return c.toString();
         }
@@ -2832,6 +2877,7 @@
         /**
          * @see java.util.List#equals(Object)
          */
+        @Override
         public boolean equals(Object obj) {
             return l.equals(obj);
         }
@@ -2839,6 +2885,7 @@
         /**
          * @see java.util.List#hashCode()
          */
+        @Override
         public int hashCode() {
             return l.hashCode();
         }
@@ -2885,6 +2932,7 @@
         /**
          * @see java.util.Set#equals(Object)
          */
+        @Override
         public boolean equals(Object obj) {
             return c.equals(obj);
         }
@@ -2892,6 +2940,7 @@
         /**
          * @see java.util.Set#hashCode()
          */
+        @Override
         public int hashCode() {
             return c.hashCode();
         }
@@ -3028,6 +3077,7 @@
         /**
          * @see java.util.Map#equals(Object)
          */
+        @Override
         public boolean equals(Object obj) {
             return m.equals(obj);
         }
@@ -3035,6 +3085,7 @@
         /**
          * @see java.util.Map#hashCode()
          */
+        @Override
         public int hashCode() {
             return m.hashCode();
         }
@@ -3042,6 +3093,7 @@
         /**
          * @see java.lang.Object#toString()
          */
+        @Override
         public String toString() {
             return m.toString();
         }
@@ -3095,6 +3147,7 @@
             /**
              * @see java.util.Map.Entry#equals(Object)
              */
+            @Override
             public boolean equals(Object obj) {
                 return e.equals(obj);
             }
@@ -3102,6 +3155,7 @@
             /**
              * @see java.util.Map.Entry#hashCode()
              */
+            @Override
             public int hashCode() {
                 return e.hashCode();
             }
@@ -3242,6 +3296,7 @@
             /**
              * @see java.util.Set#hashCode()
              */
+            @Override
             public int hashCode() {
                 return s.hashCode();
             }
@@ -3249,6 +3304,7 @@
             /**
              * @see java.util.Set#equals(Object)
              */
+            @Override
             public boolean equals(Object object) {
                 return s.equals(object);
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Currency.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Currency.java?view=diff&rev=440606&r1=440605&r2=440606
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Currency.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Currency.java Tue Sep  5 21:01:21 2006
@@ -54,7 +54,7 @@
 	 *             code
 	 */
 	public static Currency getInstance(String currencyCode) {
-		Currency currency = (Currency) codesToCurrencies.get(currencyCode);
+		Currency currency = codesToCurrencies.get(currencyCode);
 
 		if (currency == null) {
 			ResourceBundle bundle = Locale.getBundle(
@@ -89,8 +89,9 @@
 	public static Currency getInstance(Locale locale) {
 		String country = locale.getCountry();
 		String variant = locale.getVariant();
-		if (!variant.equals("") && currencyVars.indexOf(variant) > -1) //$NON-NLS-1$
-			country = country + "_" + variant; //$NON-NLS-1$
+		if (!variant.equals("") && currencyVars.indexOf(variant) > -1) {
+            country = country + "_" + variant; //$NON-NLS-1$
+        }
 
 		ResourceBundle bundle = Locale.getBundle(
 				"ISO4Currencies", Locale.getDefault()); //$NON-NLS-1$
@@ -102,8 +103,9 @@
 					"K0323", locale.toString())); //$NON-NLS-1$
 		}
 
-		if (currencyCode.equals("None")) //$NON-NLS-1$
-			return null;
+		if (currencyCode.equals("None")) {
+            return null;
+        }
 
 		return getInstance(currencyCode);
 	}
@@ -153,13 +155,15 @@
 	 *         symbol in this locale
 	 */
 	public String getSymbol(Locale locale) {
-		if (locale.getCountry().equals("")) //$NON-NLS-1$
-			return currencyCode;
+		if (locale.getCountry().equals("")) {
+            return currencyCode;
+        }
 
 		// check in the Locale bundle first, if the local has the same currency
 		ResourceBundle bundle = Locale.getBundle("Locale", locale); //$NON-NLS-1$
-		if (((String) bundle.getObject("IntCurrencySymbol")).equals(currencyCode)) //$NON-NLS-1$
-			return (String) bundle.getObject("CurrencySymbol"); //$NON-NLS-1$
+		if (((String) bundle.getObject("IntCurrencySymbol")).equals(currencyCode)) {
+            return (String) bundle.getObject("CurrencySymbol"); //$NON-NLS-1$
+        }
 
 		// search for a Currency bundle
 		bundle = null;
@@ -171,16 +175,17 @@
 
 		// is the bundle found for a different country? (for instance the
 		// default locale's currency bundle)
-		if (!bundle.getLocale().getCountry().equals(locale.getCountry()))
-			return currencyCode;
+		if (!bundle.getLocale().getCountry().equals(locale.getCountry())) {
+            return currencyCode;
+        }
 
 		// check if the currency bundle for this locale
 		// has an entry for this currency
 		String result = (String) bundle.handleGetObject(currencyCode);
-		if (result != null)
-			return result;
-		else
-			return currencyCode;
+		if (result != null) {
+            return result;
+        }
+        return currencyCode;
 	}
 
     /**
@@ -200,7 +205,8 @@
      * 
      * @return this currency's ISO 4217 currency code
      */
-	public String toString() {
+	@Override
+    public String toString() {
 		return currencyCode;
 	}
 



Mime
View raw message