diff options
Diffstat (limited to 'libjava/java/util')
-rw-r--r-- | libjava/java/util/ArrayList.java | 2 | ||||
-rw-r--r-- | libjava/java/util/Arrays.java | 8 | ||||
-rw-r--r-- | libjava/java/util/BitSet.java | 35 | ||||
-rw-r--r-- | libjava/java/util/Dictionary.java | 13 | ||||
-rw-r--r-- | libjava/java/util/IdentityHashMap.java | 47 | ||||
-rw-r--r-- | libjava/java/util/MissingResourceException.java | 38 | ||||
-rw-r--r-- | libjava/java/util/Observer.java | 23 | ||||
-rw-r--r-- | libjava/java/util/TooManyListenersException.java | 24 | ||||
-rw-r--r-- | libjava/java/util/zip/DataFormatException.java | 29 | ||||
-rw-r--r-- | libjava/java/util/zip/ZipException.java | 30 |
10 files changed, 143 insertions, 106 deletions
diff --git a/libjava/java/util/ArrayList.java b/libjava/java/util/ArrayList.java index 99745d0..2d2146d 100644 --- a/libjava/java/util/ArrayList.java +++ b/libjava/java/util/ArrayList.java @@ -160,7 +160,7 @@ public class ArrayList extends AbstractList /** * Guarantees that this list will have at least enough capacity to * hold minCapacity elements. This implementation will grow the list to - * max(current * 2, minCapacity) if (minCapacity > current). The JCL says + * max(current * 2, minCapacity) if (minCapacity > current). The JCL says * explictly that "this method increases its capacity to minCap", while * the JDK 1.3 online docs specify that the list will grow to at least the * size specified. diff --git a/libjava/java/util/Arrays.java b/libjava/java/util/Arrays.java index 8126cf2..35e0e92 100644 --- a/libjava/java/util/Arrays.java +++ b/libjava/java/util/Arrays.java @@ -2205,9 +2205,9 @@ public class Arrays * comparable * @throws NullPointerException if an element is null (since * null.compareTo cannot work) - * @throws ArrayIndexOutOfBoundsException, if fromIndex and toIndex + * @throws ArrayIndexOutOfBoundsException if fromIndex and toIndex * are not in range. - * @throws IllegalArgumentException if fromIndex > toIndex + * @throws IllegalArgumentException if fromIndex > toIndex */ public static void sort(Object[] a, int fromIndex, int toIndex) { @@ -2229,9 +2229,9 @@ public class Arrays * the elements' natural order * @throws ClassCastException if any two elements are not mutually * comparable by the Comparator provided - * @throws ArrayIndexOutOfBoundsException, if fromIndex and toIndex + * @throws ArrayIndexOutOfBoundsException if fromIndex and toIndex * are not in range. - * @throws IllegalArgumentException if fromIndex > toIndex + * @throws IllegalArgumentException if fromIndex > toIndex * @throws NullPointerException if a null element is compared with natural * ordering (only possible when c is null) */ diff --git a/libjava/java/util/BitSet.java b/libjava/java/util/BitSet.java index 38a9be0..c56c0d1 100644 --- a/libjava/java/util/BitSet.java +++ b/libjava/java/util/BitSet.java @@ -398,22 +398,24 @@ public class BitSet implements Cloneable, Serializable * bit <code>k</code> is set in the BitSet (for non-negative values * of <code>k</code>) if and only if * - * <pre> - * ((k/64) < bits.length) && ((bits[k/64] & (1L << (bit % 64))) != 0) - * </pre> + * <code>((k/64) < bits.length) + * && ((bits[k/64] & (1L << (bit % 64))) != 0) + * </code> * * Then the following definition of the hashCode method * would be a correct implementation of the actual algorithm: * - * <pre> - * public int hashCode() { - * long h = 1234; - * for (int i = bits.length-1; i>=0; i--) { - * h ^= bits[i] * (i + 1); - * } - * return (int)((h >> 32) ^ h); - * } - * </pre> + * +<pre>public int hashCode() +{ + long h = 1234; + for (int i = bits.length-1; i >= 0; i--) + { + h ^= bits[i] * (i + 1); + } + + return (int)((h >> 32) ^ h); +}</pre> * * Note that the hash code values changes, if the set is changed. * @@ -526,10 +528,11 @@ public class BitSet implements Cloneable, Serializable * Returns the index of the next true bit, from the specified bit * (inclusive). If there is none, -1 is returned. You can iterate over * all true bits with this loop:<br> - * <pre> - * for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) - * { // operate on i here } - * </pre> + * +<pre>for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) +{ + // operate on i here +}</pre> * * @param from the start location * @return the first true bit, or -1 diff --git a/libjava/java/util/Dictionary.java b/libjava/java/util/Dictionary.java index 401e45a..53c4d64 100644 --- a/libjava/java/util/Dictionary.java +++ b/libjava/java/util/Dictionary.java @@ -1,6 +1,6 @@ /* Dictionary.java -- an abstract (and essentially worthless) class which is Hashtable's superclass - Copyright (C) 1998, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -47,18 +47,21 @@ package java.util; * People at Javasoft are probably embarrassed by it. At this point, * it might as well be an interface rather than a class, but it remains * this poor, laughable skeleton for the sake of backwards compatibility. - * At any rate, this was what came before the <pre>Map</pre> interface + * At any rate, this was what came before the {@link Map} interface * in the Collections framework. * * @author Jon Zeppieri - * @author Eric Blake <ebb9@email.byu.edu> + * @author Eric Blake (ebb9@email.byu.edu) * @see Map * @see Hashtable * @since 1.0 * @status updated to 1.4 */ -public abstract class Dictionary extends Object +public abstract class Dictionary { + // WARNING: Dictionary is a CORE class in the bootstrap cycle. See the + // comments in vm/reference/java/lang/Runtime for implications of this fact. + /** * Sole constructor (often called implicitly). */ @@ -130,4 +133,4 @@ public abstract class Dictionary extends Object * @return the number of keys in the Dictionary */ public abstract int size(); -} +} // class Dictionary diff --git a/libjava/java/util/IdentityHashMap.java b/libjava/java/util/IdentityHashMap.java index 4609f01..f48c430 100644 --- a/libjava/java/util/IdentityHashMap.java +++ b/libjava/java/util/IdentityHashMap.java @@ -162,9 +162,9 @@ public class IdentityHashMap extends AbstractMap // Need at least two slots, or hash() will break. if (max < 2) max = 2; - table = new Object[2 * max]; + table = new Object[max << 1]; Arrays.fill(table, emptyslot); - threshold = max / 4 * 3; + threshold = (max >> 2) * 3; } /** @@ -176,7 +176,7 @@ public class IdentityHashMap extends AbstractMap */ public IdentityHashMap(Map m) { - this(Math.max(m.size() * 2, DEFAULT_CAPACITY)); + this(Math.max(m.size() << 1, DEFAULT_CAPACITY)); putAll(m); } @@ -341,12 +341,14 @@ public class IdentityHashMap extends AbstractMap } /** - * Return the value in this Map associated with the supplied key, - * or <pre>null</pre> if the key maps to nothing. NOTE: Since the value - * could also be null, you must use containsKey to see if this key - * actually maps to something. Unlike normal maps, this tests for the key - * with <code>entry == key</code> instead of - * <code>entry == null ? key == null : entry.equals(key)</code>. + * Return the value in this Map associated with the supplied key, or + * <code>null</code> if the key maps to nothing. + * + * <p>NOTE: Since the value could also be null, you must use + * containsKey to see if this key actually maps to something. + * Unlike normal maps, this tests for the key with <code>entry == + * key</code> instead of <code>entry == null ? key == null : + * entry.equals(key)</code>. * * @param key the key for which to fetch an associated value * @return what the key maps to, if present @@ -487,10 +489,10 @@ public class IdentityHashMap extends AbstractMap Object[] old = table; // This isn't necessarily prime, but it is an odd number of key/value // slots, which has a higher probability of fewer collisions. - table = new Object[old.length * 2 + 2]; + table = new Object[old.length << 1 + 2]; Arrays.fill(table, emptyslot); size = 0; - threshold = (table.length / 2) / 4 * 3; + threshold = (table.length >>> 3) * 3; for (int i = old.length - 2; i >= 0; i -= 2) { @@ -531,13 +533,15 @@ public class IdentityHashMap extends AbstractMap } /** - * Removes from the HashMap and returns the value which is mapped by the - * supplied key. If the key maps to nothing, then the HashMap remains - * unchanged, and <pre>null</pre> is returned. NOTE: Since the value - * could also be null, you must use containsKey to see if you are - * actually removing a mapping. Unlike normal maps, this tests for the - * key with <code>entry == key</code> instead of - * <code>entry == null ? key == null : entry.equals(key)</code>. + * Removes from the HashMap and returns the value which is mapped by + * the supplied key. If the key maps to nothing, then the HashMap + * remains unchanged, and <code>null</code> is returned. + * + * NOTE: Since the value could also be null, you must use + * containsKey to see if you are actually removing a mapping. + * Unlike normal maps, this tests for the key with <code>entry == + * key</code> instead of <code>entry == null ? key == null : + * entry.equals(key)</code>. * * @param key the key used to locate the value to remove * @return whatever the key mapped to, if present @@ -642,7 +646,7 @@ public class IdentityHashMap extends AbstractMap // By requiring at least 2 key/value slots, and rehashing at 75% // capacity, we guarantee that there will always be either an emptyslot // or a tombstone somewhere in the table. - int h = 2 * Math.abs(System.identityHashCode(key) % (table.length / 2)); + int h = Math.abs(System.identityHashCode(key) % (table.length >> 1)) << 1; int del = -1; int save = h; @@ -735,7 +739,8 @@ public class IdentityHashMap extends AbstractMap /** * Removes from the backing Map the last element which was fetched - * with the <pre>next()</pre> method. + * with the <code>next()</code> method. + * * @throws ConcurrentModificationException if the Map was modified * @throws IllegalStateException if called when there is no last element */ @@ -894,7 +899,7 @@ public class IdentityHashMap extends AbstractMap s.defaultReadObject(); int num = s.readInt(); - table = new Object[2 * Math.max(num * 2, DEFAULT_CAPACITY)]; + table = new Object[Math.max(num << 1, DEFAULT_CAPACITY) << 1]; // Read key/value pairs. while (--num >= 0) put(s.readObject(), s.readObject()); diff --git a/libjava/java/util/MissingResourceException.java b/libjava/java/util/MissingResourceException.java index 1618c4f..47525e5 100644 --- a/libjava/java/util/MissingResourceException.java +++ b/libjava/java/util/MissingResourceException.java @@ -1,5 +1,5 @@ -/* java.util.MissingResourceException - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. +/* MissingResourceException.java -- thrown for a missing resource + Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,38 +38,42 @@ exception statement from your version. */ package java.util; -/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 - * "The Java Language Specification", ISBN 0-201-63451-1 - * plus online API docs for JDK 1.2 beta from http://www.javasoft.com. - * Status: Believed complete and correct. - */ - /** * This exception is thrown when a resource is missing. * - * @see ResourceBundle * @author Jochen Hoenicke * @author Warren Levy <warrenl@cygnus.com> + * @see ResourceBundle + * @since 1.1 + * @status updated to 1.4 */ public class MissingResourceException extends RuntimeException { + /** + * Compatible with JDK 1.1+. + */ private static final long serialVersionUID = -4876345176062000401L; /** * The name of the resource bundle requested by user. + * + * @serial the class name of the resource bundle */ - private String className; + private final String className; /** * The key of the resource in the bundle requested by user. + * + * @serial the name of the resouce */ - private String key; + private final String key; /** * Creates a new exception, with the specified parameters. - * @param s the detail message. - * @param className the name of the resource bundle. - * @param key the key of the missing resource. + * + * @param s the detail message + * @param className the name of the resource bundle + * @param key the key of the missing resource */ public MissingResourceException(String s, String className, String key) { @@ -80,7 +84,8 @@ public class MissingResourceException extends RuntimeException /** * Gets the name of the resource bundle, for which a resource is missing. - * @return the name of the resource bundle. + * + * @return the name of the resource bundle */ public String getClassName() { @@ -90,7 +95,8 @@ public class MissingResourceException extends RuntimeException /** * Gets the key of the resource that is missing bundle, this is an empty * string if the whole resource bundle is missing. - * @return the name of the resource bundle. + * + * @return the name of the resource bundle */ public String getKey() { diff --git a/libjava/java/util/Observer.java b/libjava/java/util/Observer.java index d18170d..a703e90 100644 --- a/libjava/java/util/Observer.java +++ b/libjava/java/util/Observer.java @@ -1,6 +1,5 @@ -/* Implemented when a class wants to be informed of changes in Observable - objects. - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. +/* Observer.java -- an object that will be informed of changes in an Observable + Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,21 +38,23 @@ exception statement from your version. */ package java.util; -/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 - * "The Java Language Specification", ISBN 0-201-63451-1 - * plus online API docs for JDK 1.2 beta from http://www.javasoft.com. - * Status: Believed complete and correct - */ - /** * Interface that is implemented when a class wants to be informed of changes * in Observable objects. * - * @see java.util.Observable * @author Warren Levy <warrenl@cygnus.com> - * @date August 25, 1998. + * @see Observable + * @status updated to 1.4 */ public interface Observer { + /** + * This method is called whenever the observable object changes, and has + * called <code>notifyObservers</code>. The Observable object can pass + * arbitrary information in the second parameter. + * + * @param observable the Observable object that changed + * @param arg arbitrary information, usually relating to the change + */ public void update(Observable observable, Object arg); } diff --git a/libjava/java/util/TooManyListenersException.java b/libjava/java/util/TooManyListenersException.java index 803cd78..883bdbc 100644 --- a/libjava/java/util/TooManyListenersException.java +++ b/libjava/java/util/TooManyListenersException.java @@ -1,5 +1,6 @@ -/* java.util.TooManyListenersException - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. +/* TooManyListenersException.java -- thrown when a unicast event can't accept + another Listener + Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,26 +39,24 @@ exception statement from your version. */ package java.util; -/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 - * "The Java Language Specification", ISBN 0-201-63451-1 - * plus online API docs for JDK 1.2 beta from http://www.javasoft.com. - * Status: Believed complete and correct. - */ - /** * This exception is part of the java event model. It is thrown if an * event listener is added via the addXyzEventListener method, but the * object doesn't support any more listeners, e.g. it only supports a * single event listener. * + * @author Jochen Hoenicke + * @author Warren Levy <warrenl@cygnus.com> * @see EventListener * @see EventObject - * @author Jochen Hoenicke - * @author Warren Levy <warrenl@cygnus.com> + * @since 1.1 + * @status updated to 1.4 */ - public class TooManyListenersException extends Exception { + /** + * Compatible with JDK 1.1+. + */ private static final long serialVersionUID = 5074640544770687831L; /** @@ -69,7 +68,8 @@ public class TooManyListenersException extends Exception /** * Constructs a TooManyListenersException with a detail message. - * @param detail the detail message. + * + * @param detail the detail message */ public TooManyListenersException(String detail) { diff --git a/libjava/java/util/zip/DataFormatException.java b/libjava/java/util/zip/DataFormatException.java index 28ecef0..e5a948e 100644 --- a/libjava/java/util/zip/DataFormatException.java +++ b/libjava/java/util/zip/DataFormatException.java @@ -1,5 +1,5 @@ -/* DataformatException.java - Exception thrown when compressed data is corrupt - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* DataformatException.java -- thrown when compressed data is corrupt + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,25 +37,34 @@ exception statement from your version. */ package java.util.zip; -/* Written using on-line Java Platform 1.2 API Specification. - * Believed complete and correct. - */ - /** * Exception thrown when compressed data is corrupt. * * @author Tom Tromey * @author John Leuner - * @since JDK 1.1 + * @since 1.1 + * @status updated to 1.4 */ public class DataFormatException extends Exception { - public DataFormatException () + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = 2219632870893641452L; + + /** + * Create an exception without a message. + */ + public DataFormatException() { - super(); } - public DataFormatException (String msg) + /** + * Create an exception with a message. + * + * @param msg the message + */ + public DataFormatException(String msg) { super(msg); } diff --git a/libjava/java/util/zip/ZipException.java b/libjava/java/util/zip/ZipException.java index ed02c85..9130ef2 100644 --- a/libjava/java/util/zip/ZipException.java +++ b/libjava/java/util/zip/ZipException.java @@ -1,5 +1,5 @@ -/* ZipException.java - Exception representing a zip related error - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* ZipException.java - exception representing a zip related error + Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,24 +37,34 @@ exception statement from your version. */ package java.util.zip; -/* Written using on-line Java Platform 1.2 API Specification. - * Believed complete and correct. - */ +import java.io.IOException; /** - * Is thrown during the creation or input of a zip file. + * Thrown during the creation or input of a zip file. * * @author Jochen Hoenicke * @author Per Bothner - * @since JDK 1.1 + * @status updated to 1.4 */ -public class ZipException extends java.io.IOException +public class ZipException extends IOException { - public ZipException () + /** + * Compatible with JDK 1.0+. + */ + private static final long serialVersionUID = 8000196834066748623L; + + /** + * Create an exception without a message. + */ + public ZipException() { - super(); } + /** + * Create an exception with a message. + * + * @param msg the message + */ public ZipException (String msg) { super(msg); |