harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r598628 [1/6] - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/
Date Tue, 27 Nov 2007 13:03:23 GMT
Author: tellison
Date: Tue Nov 27 05:03:19 2007
New Revision: 598628

URL: http://svn.apache.org/viewvc?rev=598628&view=rev
Log:
Code formatting (tabs -> spaces).

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/RandomAccess.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Set.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/SimpleTimeZone.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/StringTokenizer.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TimeZone.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TimeZones.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TooManyListenersException.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeSet.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UUID.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UnknownFormatConversionException.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/UnknownFormatFlagsException.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java?rev=598628&r1=598627&r2=598628&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java Tue Nov 27 05:03:19 2007
@@ -17,7 +17,6 @@
 
 package java.util;
 
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -54,483 +53,484 @@
  * @see Hashtable
  * @see java.lang.System#getProperties
  */
-public class Properties extends Hashtable<Object,Object> {
-	
-	private static final long serialVersionUID = 4112578634029874840L;
+public class Properties extends Hashtable<Object, Object> {
+
+    private static final long serialVersionUID = 4112578634029874840L;
 
     private transient DocumentBuilder builder = null;
 
-    private static final String PROP_DTD_NAME 
-            = "http://java.sun.com/dtd/properties.dtd";
+    private static final String PROP_DTD_NAME = "http://java.sun.com/dtd/properties.dtd";
 
-    private static final String PROP_DTD 
-            = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+    private static final String PROP_DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
             + "    <!ELEMENT properties (comment?, entry*) >"
             + "    <!ATTLIST properties version CDATA #FIXED \"1.0\" >"
             + "    <!ELEMENT comment (#PCDATA) >"
             + "    <!ELEMENT entry (#PCDATA) >"
             + "    <!ATTLIST entry key CDATA #REQUIRED >";
-	
-	/**
-	 * The default values for this Properties.
-	 */
-	protected Properties defaults;
-
-	private static final int NONE = 0, SLASH = 1, UNICODE = 2, CONTINUE = 3,
-			KEY_DONE = 4, IGNORE = 5;
-
-	/**
-	 * Constructs a new Properties object.
-	 */
-	public Properties() {
-		super();
-	}
-
-	/**
-	 * Constructs a new Properties object using the specified default
-	 * properties.
-	 * 
-	 * @param properties
-	 *            the default properties
-	 */
-	public Properties(Properties properties) {
-		defaults = properties;
-	}
-
-	private void dumpString(StringBuilder buffer, String string, boolean key) {
-		int i = 0;
-		if (!key && i < string.length() && string.charAt(i) == ' ') {
-			buffer.append("\\ "); //$NON-NLS-1$
-			i++;
-		}
-
-		for (; i < string.length(); i++) {
-			char ch = string.charAt(i);
-			switch (ch) {
-			case '\t':
-				buffer.append("\\t"); //$NON-NLS-1$
-				break;
-			case '\n':
-				buffer.append("\\n"); //$NON-NLS-1$
-				break;
-			case '\f':
-				buffer.append("\\f"); //$NON-NLS-1$
-				break;
-			case '\r':
-				buffer.append("\\r"); //$NON-NLS-1$
-				break;
-			default:
-				if ("\\#!=:".indexOf(ch) >= 0 || (key && ch == ' ')) {
+
+    /**
+     * The default values for this Properties.
+     */
+    protected Properties defaults;
+
+    private static final int NONE = 0, SLASH = 1, UNICODE = 2, CONTINUE = 3,
+            KEY_DONE = 4, IGNORE = 5;
+
+    /**
+     * Constructs a new Properties object.
+     */
+    public Properties() {
+        super();
+    }
+
+    /**
+     * Constructs a new Properties object using the specified default
+     * properties.
+     * 
+     * @param properties
+     *            the default properties
+     */
+    public Properties(Properties properties) {
+        defaults = properties;
+    }
+
+    private void dumpString(StringBuilder buffer, String string, boolean key) {
+        int i = 0;
+        if (!key && i < string.length() && string.charAt(i) == ' ') {
+            buffer.append("\\ "); //$NON-NLS-1$
+            i++;
+        }
+
+        for (; i < string.length(); i++) {
+            char ch = string.charAt(i);
+            switch (ch) {
+            case '\t':
+                buffer.append("\\t"); //$NON-NLS-1$
+                break;
+            case '\n':
+                buffer.append("\\n"); //$NON-NLS-1$
+                break;
+            case '\f':
+                buffer.append("\\f"); //$NON-NLS-1$
+                break;
+            case '\r':
+                buffer.append("\\r"); //$NON-NLS-1$
+                break;
+            default:
+                if ("\\#!=:".indexOf(ch) >= 0 || (key && ch == ' ')) {
                     buffer.append('\\');
                 }
-				if (ch >= ' ' && ch <= '~') {
-					buffer.append(ch);
-				} else {
-					String hex = Integer.toHexString(ch);
-					buffer.append("\\u"); //$NON-NLS-1$
-					for (int j = 0; j < 4 - hex.length(); j++) {
+                if (ch >= ' ' && ch <= '~') {
+                    buffer.append(ch);
+                } else {
+                    String hex = Integer.toHexString(ch);
+                    buffer.append("\\u"); //$NON-NLS-1$
+                    for (int j = 0; j < 4 - hex.length(); j++) {
                         buffer.append("0"); //$NON-NLS-1$
                     }
-					buffer.append(hex);
-				}
-			}
-		}
-	}
-
-	/**
-	 * Searches for the property with the specified name. If the property is not
-	 * found, look in the default properties. If the property is not found in
-	 * the default properties, answer null.
-	 * 
-	 * @param name
-	 *            the name of the property to find
-	 * @return the named property value
-	 */
-	public String getProperty(String name) {
-		Object result = super.get(name);
-		String property = result instanceof String ? (String) result : null;
-		if (property == null && defaults != null) {
-			property = defaults.getProperty(name);
-		}
-		return property;
-	}
-
-	/**
-	 * Searches for the property with the specified name. If the property is not
-	 * found, look in the default properties. If the property is not found in
-	 * the default properties, answer the specified default.
-	 * 
-	 * @param name
-	 *            the name of the property to find
-	 * @param defaultValue
-	 *            the default value
-	 * @return the named property value
-	 */
-	public String getProperty(String name, String defaultValue) {
-		Object result = super.get(name);
-		String property = result instanceof String ? (String) result : null;
-		if (property == null && defaults != null) {
-			property = defaults.getProperty(name);
-		}
-		if (property == null) {
+                    buffer.append(hex);
+                }
+            }
+        }
+    }
+
+    /**
+     * Searches for the property with the specified name. If the property is not
+     * found, look in the default properties. If the property is not found in
+     * the default properties, answer null.
+     * 
+     * @param name
+     *            the name of the property to find
+     * @return the named property value
+     */
+    public String getProperty(String name) {
+        Object result = super.get(name);
+        String property = result instanceof String ? (String) result : null;
+        if (property == null && defaults != null) {
+            property = defaults.getProperty(name);
+        }
+        return property;
+    }
+
+    /**
+     * Searches for the property with the specified name. If the property is not
+     * found, look in the default properties. If the property is not found in
+     * the default properties, answer the specified default.
+     * 
+     * @param name
+     *            the name of the property to find
+     * @param defaultValue
+     *            the default value
+     * @return the named property value
+     */
+    public String getProperty(String name, String defaultValue) {
+        Object result = super.get(name);
+        String property = result instanceof String ? (String) result : null;
+        if (property == null && defaults != null) {
+            property = defaults.getProperty(name);
+        }
+        if (property == null) {
             return defaultValue;
         }
-		return property;
-	}
+        return property;
+    }
 
-	/**
-	 * Lists the mappings in this Properties to the specified PrintStream in a
-	 * human readable form.
-	 * 
-	 * @param out
-	 *            the PrintStream
-	 */
-	public void list(PrintStream out) {
-		if (out == null) {
+    /**
+     * Lists the mappings in this Properties to the specified PrintStream in a
+     * human readable form.
+     * 
+     * @param out
+     *            the PrintStream
+     */
+    public void list(PrintStream out) {
+        if (out == null) {
             throw new NullPointerException();
         }
-		StringBuffer buffer = new StringBuffer(80);
-		Enumeration<?> keys = propertyNames();
-		while (keys.hasMoreElements()) {
-			String key = (String) keys.nextElement();
-			buffer.append(key);
-			buffer.append('=');
-			String property = (String) super.get(key);
-			Properties def = defaults;
-			while (property == null) {
-				property = (String) def.get(key);
-				def = def.defaults;
-			}
-			if (property.length() > 40) {
-				buffer.append(property.substring(0, 37));
-				buffer.append("..."); //$NON-NLS-1$
-			} else {
+        StringBuffer buffer = new StringBuffer(80);
+        Enumeration<?> keys = propertyNames();
+        while (keys.hasMoreElements()) {
+            String key = (String) keys.nextElement();
+            buffer.append(key);
+            buffer.append('=');
+            String property = (String) super.get(key);
+            Properties def = defaults;
+            while (property == null) {
+                property = (String) def.get(key);
+                def = def.defaults;
+            }
+            if (property.length() > 40) {
+                buffer.append(property.substring(0, 37));
+                buffer.append("..."); //$NON-NLS-1$
+            } else {
                 buffer.append(property);
             }
-			out.println(buffer.toString());
-			buffer.setLength(0);
-		}
-	}
-
-	/**
-	 * Lists the mappings in this Properties to the specified PrintWriter in a
-	 * human readable form.
-	 * 
-	 * @param writer
-	 *            the PrintWriter
-	 */
-	public void list(PrintWriter writer) {
-		if (writer == null) {
+            out.println(buffer.toString());
+            buffer.setLength(0);
+        }
+    }
+
+    /**
+     * Lists the mappings in this Properties to the specified PrintWriter in a
+     * human readable form.
+     * 
+     * @param writer
+     *            the PrintWriter
+     */
+    public void list(PrintWriter writer) {
+        if (writer == null) {
             throw new NullPointerException();
         }
-		StringBuffer buffer = new StringBuffer(80);
-		Enumeration<?> keys = propertyNames();
-		while (keys.hasMoreElements()) {
-			String key = (String) keys.nextElement();
-			buffer.append(key);
-			buffer.append('=');
-			String property = (String) super.get(key);
-			Properties def = defaults;
-			while (property == null) {
-				property = (String) def.get(key);
-				def = def.defaults;
-			}
-			if (property.length() > 40) {
-				buffer.append(property.substring(0, 37));
-				buffer.append("..."); //$NON-NLS-1$
-			} else {
+        StringBuffer buffer = new StringBuffer(80);
+        Enumeration<?> keys = propertyNames();
+        while (keys.hasMoreElements()) {
+            String key = (String) keys.nextElement();
+            buffer.append(key);
+            buffer.append('=');
+            String property = (String) super.get(key);
+            Properties def = defaults;
+            while (property == null) {
+                property = (String) def.get(key);
+                def = def.defaults;
+            }
+            if (property.length() > 40) {
+                buffer.append(property.substring(0, 37));
+                buffer.append("..."); //$NON-NLS-1$
+            } else {
                 buffer.append(property);
             }
-			writer.println(buffer.toString());
-			buffer.setLength(0);
-		}
-	}
-
-	/**
-	 * Loads properties from the specified InputStream. The properties are of
-	 * the form <code>key=value</code>, one property per line.
-	 * 
-	 * @param in
-	 *            the input stream
-	 * @throws IOException 
-	 */
-	public synchronized void load(InputStream in) throws IOException {
-		int mode = NONE, unicode = 0, count = 0;
-		char nextChar, buf[] = new char[40];
-		int offset = 0, keyLength = -1;
-		boolean firstChar = true;
-		byte[] inbuf = new byte[256];
-		int inbufCount = 0, inbufPos = 0;
-
-		while (true) {
-			if (inbufPos == inbufCount) {
-				if ((inbufCount = in.read(inbuf)) == -1) {
+            writer.println(buffer.toString());
+            buffer.setLength(0);
+        }
+    }
+
+    /**
+     * Loads properties from the specified InputStream. The properties are of
+     * the form <code>key=value</code>, one property per line.
+     * 
+     * @param in
+     *            the input stream
+     * @throws IOException
+     */
+    public synchronized void load(InputStream in) throws IOException {
+        int mode = NONE, unicode = 0, count = 0;
+        char nextChar, buf[] = new char[40];
+        int offset = 0, keyLength = -1;
+        boolean firstChar = true;
+        byte[] inbuf = new byte[256];
+        int inbufCount = 0, inbufPos = 0;
+
+        while (true) {
+            if (inbufPos == inbufCount) {
+                if ((inbufCount = in.read(inbuf)) == -1) {
                     break;
                 }
-				inbufPos = 0;
-			}
-			nextChar = (char) (inbuf[inbufPos++] & 0xff);
-
-			if (offset == buf.length) {
-				char[] newBuf = new char[buf.length * 2];
-				System.arraycopy(buf, 0, newBuf, 0, offset);
-				buf = newBuf;
-			}
-			if (mode == UNICODE) {
-				int digit = Character.digit(nextChar, 16);
-				if (digit >= 0) {
-					unicode = (unicode << 4) + digit;
-					if (++count < 4) {
+                inbufPos = 0;
+            }
+            nextChar = (char) (inbuf[inbufPos++] & 0xff);
+
+            if (offset == buf.length) {
+                char[] newBuf = new char[buf.length * 2];
+                System.arraycopy(buf, 0, newBuf, 0, offset);
+                buf = newBuf;
+            }
+            if (mode == UNICODE) {
+                int digit = Character.digit(nextChar, 16);
+                if (digit >= 0) {
+                    unicode = (unicode << 4) + digit;
+                    if (++count < 4) {
                         continue;
                     }
-				}
-				mode = NONE;
-				buf[offset++] = (char) unicode;
-				if (nextChar != '\n') {
+                }
+                mode = NONE;
+                buf[offset++] = (char) unicode;
+                if (nextChar != '\n') {
                     continue;
                 }
-			}
-			if (mode == SLASH) {
-				mode = NONE;
-				switch (nextChar) {
-				case '\r':
-					mode = CONTINUE; // Look for a following \n
-					continue;
-				case '\n':
-					mode = IGNORE; // Ignore whitespace on the next line
-					continue;
-				case 'b':
-					nextChar = '\b';
-					break;
-				case 'f':
-					nextChar = '\f';
-					break;
-				case 'n':
-					nextChar = '\n';
-					break;
-				case 'r':
-					nextChar = '\r';
-					break;
-				case 't':
-					nextChar = '\t';
-					break;
-				case 'u':
-					mode = UNICODE;
-					unicode = count = 0;
-					continue;
-				}
-			} else {
-				switch (nextChar) {
-				case '#':
-				case '!':
-					if (firstChar) {
-						while (true) {
-							if (inbufPos == inbufCount) {
-								if ((inbufCount = in.read(inbuf)) == -1) {
-									inbufPos = -1;
-									break;
-								}
-								inbufPos = 0;
-							}
-							nextChar = (char) inbuf[inbufPos++]; // & 0xff
-																	// not
-																	// required
-							if (nextChar == '\r' || nextChar == '\n') {
+            }
+            if (mode == SLASH) {
+                mode = NONE;
+                switch (nextChar) {
+                case '\r':
+                    mode = CONTINUE; // Look for a following \n
+                    continue;
+                case '\n':
+                    mode = IGNORE; // Ignore whitespace on the next line
+                    continue;
+                case 'b':
+                    nextChar = '\b';
+                    break;
+                case 'f':
+                    nextChar = '\f';
+                    break;
+                case 'n':
+                    nextChar = '\n';
+                    break;
+                case 'r':
+                    nextChar = '\r';
+                    break;
+                case 't':
+                    nextChar = '\t';
+                    break;
+                case 'u':
+                    mode = UNICODE;
+                    unicode = count = 0;
+                    continue;
+                }
+            } else {
+                switch (nextChar) {
+                case '#':
+                case '!':
+                    if (firstChar) {
+                        while (true) {
+                            if (inbufPos == inbufCount) {
+                                if ((inbufCount = in.read(inbuf)) == -1) {
+                                    inbufPos = -1;
+                                    break;
+                                }
+                                inbufPos = 0;
+                            }
+                            nextChar = (char) inbuf[inbufPos++]; // & 0xff
+                            // not
+                            // required
+                            if (nextChar == '\r' || nextChar == '\n') {
                                 break;
                             }
-						}
-						continue;
-					}
-					break;
-				case '\n':
-					if (mode == CONTINUE) { // Part of a \r\n sequence
-						mode = IGNORE; // Ignore whitespace on the next line
-						continue;
-					}
-				// fall into the next case
-				case '\r':
-					mode = NONE;
-					firstChar = true;
-					if (offset > 0) {
-						if (keyLength == -1) {
-							keyLength = offset;
-						}
-						String temp = new String(buf, 0, offset);
-						put(temp.substring(0, keyLength), temp
-								.substring(keyLength));
-					}
-					keyLength = -1;
-					offset = 0;
-					continue;
-				case '\\':
-					if (mode == KEY_DONE) {
-						keyLength = offset;
-					}
-					mode = SLASH;
-					continue;
-				case ':':
-				case '=':
-					if (keyLength == -1) { // if parsing the key
-						mode = NONE;
-						keyLength = offset;
-						continue;
-					}
-					break;
-				}
-				if (Character.isWhitespace(nextChar)) {
-					if (mode == CONTINUE) {
+                        }
+                        continue;
+                    }
+                    break;
+                case '\n':
+                    if (mode == CONTINUE) { // Part of a \r\n sequence
+                        mode = IGNORE; // Ignore whitespace on the next line
+                        continue;
+                    }
+                    // fall into the next case
+                case '\r':
+                    mode = NONE;
+                    firstChar = true;
+                    if (offset > 0) {
+                        if (keyLength == -1) {
+                            keyLength = offset;
+                        }
+                        String temp = new String(buf, 0, offset);
+                        put(temp.substring(0, keyLength), temp
+                                .substring(keyLength));
+                    }
+                    keyLength = -1;
+                    offset = 0;
+                    continue;
+                case '\\':
+                    if (mode == KEY_DONE) {
+                        keyLength = offset;
+                    }
+                    mode = SLASH;
+                    continue;
+                case ':':
+                case '=':
+                    if (keyLength == -1) { // if parsing the key
+                        mode = NONE;
+                        keyLength = offset;
+                        continue;
+                    }
+                    break;
+                }
+                if (Character.isWhitespace(nextChar)) {
+                    if (mode == CONTINUE) {
                         mode = IGNORE;
                     }
-					// if key length == 0 or value length == 0
-					if (offset == 0 || offset == keyLength || mode == IGNORE) {
+                    // if key length == 0 or value length == 0
+                    if (offset == 0 || offset == keyLength || mode == IGNORE) {
                         continue;
                     }
-					if (keyLength == -1) { // if parsing the key
-						mode = KEY_DONE;
-						continue;
-					}
-				}
-				if (mode == IGNORE || mode == CONTINUE) {
+                    if (keyLength == -1) { // if parsing the key
+                        mode = KEY_DONE;
+                        continue;
+                    }
+                }
+                if (mode == IGNORE || mode == CONTINUE) {
                     mode = NONE;
                 }
-			}
-			firstChar = false;
-			if (mode == KEY_DONE) {
-				keyLength = offset;
-				mode = NONE;
-			}
-			buf[offset++] = nextChar;
-		}
-        if(keyLength==-1 && offset>0){
+            }
+            firstChar = false;
+            if (mode == KEY_DONE) {
+                keyLength = offset;
+                mode = NONE;
+            }
+            buf[offset++] = nextChar;
+        }
+        if (keyLength == -1 && offset > 0) {
             keyLength = offset;
         }
-		if (keyLength >= 0) {
-			String temp = new String(buf, 0, offset);
-			put(temp.substring(0, keyLength), temp.substring(keyLength));
-		}
-	}
-
-	/**
-	 * Answers all of the property names that this Properties contains.
-	 * 
-	 * @return an Enumeration containing the names of all properties
-	 */
-	public Enumeration<?> propertyNames() {
-		if (defaults == null) {
+        if (keyLength >= 0) {
+            String temp = new String(buf, 0, offset);
+            put(temp.substring(0, keyLength), temp.substring(keyLength));
+        }
+    }
+
+    /**
+     * Answers all of the property names that this Properties contains.
+     * 
+     * @return an Enumeration containing the names of all properties
+     */
+    public Enumeration<?> propertyNames() {
+        if (defaults == null) {
             return keys();
         }
 
-		Hashtable<Object, Object> set = new Hashtable<Object, Object>(defaults.size() + size());
-		Enumeration<?> keys = defaults.propertyNames();
-		while (keys.hasMoreElements()) {
-			set.put(keys.nextElement(), set);
-		}
-		keys = keys();
-		while (keys.hasMoreElements()) {
-			set.put(keys.nextElement(), set);
-		}
-		return set.keys();
-	}
-
-	/**
-	 * Saves the mappings in this Properties to the specified OutputStream,
-	 * putting the specified comment at the beginning. The output from this
-	 * method is suitable for being read by the load() method.
-	 * 
-	 * @param out
-	 *            the OutputStream
-	 * @param comment
-	 *            the comment
-	 * 
-	 * @exception ClassCastException
-	 *                when the key or value of a mapping is not a String
-	 * 
-	 * @deprecated Does not throw an IOException, use store()
-	 */
-	@Deprecated
+        Hashtable<Object, Object> set = new Hashtable<Object, Object>(defaults
+                .size()
+                + size());
+        Enumeration<?> keys = defaults.propertyNames();
+        while (keys.hasMoreElements()) {
+            set.put(keys.nextElement(), set);
+        }
+        keys = keys();
+        while (keys.hasMoreElements()) {
+            set.put(keys.nextElement(), set);
+        }
+        return set.keys();
+    }
+
+    /**
+     * Saves the mappings in this Properties to the specified OutputStream,
+     * putting the specified comment at the beginning. The output from this
+     * method is suitable for being read by the load() method.
+     * 
+     * @param out
+     *            the OutputStream
+     * @param comment
+     *            the comment
+     * 
+     * @exception ClassCastException
+     *                when the key or value of a mapping is not a String
+     * 
+     * @deprecated Does not throw an IOException, use store()
+     */
+    @Deprecated
     public void save(OutputStream out, String comment) {
-		try {
-			store(out, comment);
-		} catch (IOException e) {
-		}
-	}
-
-	/**
-	 * Maps the specified key to the specified value. If the key already exists,
-	 * the old value is replaced. The key and value cannot be null.
-	 * 
-	 * @param name
-	 *            the key
-	 * @param value
-	 *            the value
-	 * @return the old value mapped to the key, or null
-	 */
-	public Object setProperty(String name, String value) {
-		return put(name, value);
-	}
-
-	private static String lineSeparator;
-
-	/**
-	 * Stores the mappings in this Properties to the specified OutputStream,
-	 * putting the specified comment at the beginning. The output from this
-	 * method is suitable for being read by the load() method.
-	 * 
-	 * @param out
-	 *            the OutputStream
-	 * @param comment
-	 *            the comment
-	 * @throws IOException 
-	 * 
-	 * @exception ClassCastException
-	 *                when the key or value of a mapping is not a String
-	 */
-	public synchronized void store(OutputStream out, String comment)
-			throws IOException {
-		if (lineSeparator == null) {
-			lineSeparator = AccessController
-					.doPrivileged(new PriviAction<String>("line.separator")); //$NON-NLS-1$
-        }
-
-		StringBuilder buffer = new StringBuilder(200);
-		OutputStreamWriter writer = new OutputStreamWriter(out, "ISO8859_1"); //$NON-NLS-1$
-		if (comment != null) {
+        try {
+            store(out, comment);
+        } catch (IOException e) {
+        }
+    }
+
+    /**
+     * Maps the specified key to the specified value. If the key already exists,
+     * the old value is replaced. The key and value cannot be null.
+     * 
+     * @param name
+     *            the key
+     * @param value
+     *            the value
+     * @return the old value mapped to the key, or null
+     */
+    public Object setProperty(String name, String value) {
+        return put(name, value);
+    }
+
+    private static String lineSeparator;
+
+    /**
+     * Stores the mappings in this Properties to the specified OutputStream,
+     * putting the specified comment at the beginning. The output from this
+     * method is suitable for being read by the load() method.
+     * 
+     * @param out
+     *            the OutputStream
+     * @param comment
+     *            the comment
+     * @throws IOException
+     * 
+     * @exception ClassCastException
+     *                when the key or value of a mapping is not a String
+     */
+    public synchronized void store(OutputStream out, String comment)
+            throws IOException {
+        if (lineSeparator == null) {
+            lineSeparator = AccessController
+                    .doPrivileged(new PriviAction<String>("line.separator")); //$NON-NLS-1$
+        }
+
+        StringBuilder buffer = new StringBuilder(200);
+        OutputStreamWriter writer = new OutputStreamWriter(out, "ISO8859_1"); //$NON-NLS-1$
+        if (comment != null) {
             writer.write("#"); //$NON-NLS-1$
             writer.write(comment);
-			writer.write(lineSeparator); 
+            writer.write(lineSeparator);
         }
         writer.write("#"); //$NON-NLS-1$
         writer.write(new Date().toString());
-        writer.write(lineSeparator); 
+        writer.write(lineSeparator);
 
-		for (Map.Entry<Object, Object> entry : entrySet()) {
-			String key = (String) entry.getKey();
-			dumpString(buffer, key, true);
-			buffer.append('=');
-			dumpString(buffer, (String) entry.getValue(), false);
-			buffer.append(lineSeparator);
-			writer.write(buffer.toString());
-			buffer.setLength(0);
-		}
-		writer.flush();
-	}
+        for (Map.Entry<Object, Object> entry : entrySet()) {
+            String key = (String) entry.getKey();
+            dumpString(buffer, key, true);
+            buffer.append('=');
+            dumpString(buffer, (String) entry.getValue(), false);
+            buffer.append(lineSeparator);
+            writer.write(buffer.toString());
+            buffer.setLength(0);
+        }
+        writer.flush();
+    }
 
-    public synchronized void loadFromXML(InputStream in) 
-            throws IOException, InvalidPropertiesFormatException {
+    public synchronized void loadFromXML(InputStream in) throws IOException,
+            InvalidPropertiesFormatException {
         if (in == null) {
             throw new NullPointerException();
         }
-        
+
         if (builder == null) {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilderFactory factory = DocumentBuilderFactory
+                    .newInstance();
             factory.setValidating(true);
-            
+
             try {
                 builder = factory.newDocumentBuilder();
             } catch (ParserConfigurationException e) {
                 throw new Error(e);
             }
-            
+
             builder.setErrorHandler(new ErrorHandler() {
                 public void warning(SAXParseException e) throws SAXException {
                     throw e;
@@ -544,38 +544,38 @@
                     throw e;
                 }
             });
-            
+
             builder.setEntityResolver(new EntityResolver() {
-                public InputSource resolveEntity(String publicId, String systemId)
-                        throws SAXException, IOException {
+                public InputSource resolveEntity(String publicId,
+                        String systemId) throws SAXException, IOException {
                     if (systemId.equals(PROP_DTD_NAME)) {
                         InputSource result = new InputSource(new StringReader(
                                 PROP_DTD));
                         result.setSystemId(PROP_DTD_NAME);
                         return result;
                     }
-                    throw new SAXException(
-                            "Invalid DOCTYPE declaration: " + systemId);
+                    throw new SAXException("Invalid DOCTYPE declaration: "
+                            + systemId);
                 }
             });
         }
-        
+
         try {
             Document doc = builder.parse(in);
-            NodeList entries = doc.getElementsByTagName("entry"); 
+            NodeList entries = doc.getElementsByTagName("entry");
             if (entries == null) {
                 return;
             }
             int entriesListLength = entries.getLength();
-            
+
             for (int i = 0; i < entriesListLength; i++) {
                 Element entry = (Element) entries.item(i);
                 String key = entry.getAttribute("key");
                 String value = entry.getTextContent();
-                
+
                 /*
-                 * key != null & value != null
-                 * but key or(and) value can be empty String
+                 * key != null & value != null but key or(and) value can be
+                 * empty String
                  */
                 put(key, value);
             }
@@ -585,26 +585,25 @@
             throw new InvalidPropertiesFormatException(e);
         }
     }
-    
-    public void storeToXML(OutputStream os, String comment) 
-            throws IOException {
+
+    public void storeToXML(OutputStream os, String comment) throws IOException {
         storeToXML(os, comment, "UTF-8");
     }
-    
+
     public synchronized void storeToXML(OutputStream os, String comment,
             String encoding) throws IOException {
 
         if (os == null || encoding == null) {
             throw new NullPointerException();
         }
-        
+
         /*
          * We can write to XML file using encoding parameter but note that some
          * aliases for encodings are not supported by the XML parser. Thus we
          * have to know canonical name for encoding used to store data in XML
          * since the XML parser must recognize encoding name used to store data.
          */
-        
+
         String encodingCanonicalName;
         try {
             encodingCanonicalName = Charset.forName(encoding).name();
@@ -618,18 +617,19 @@
             encodingCanonicalName = "UTF-8";
         }
 
-        PrintStream printStream = new PrintStream(os, false, encodingCanonicalName);
-        
+        PrintStream printStream = new PrintStream(os, false,
+                encodingCanonicalName);
+
         printStream.print("<?xml version=\"1.0\" encoding=\"");
         printStream.print(encodingCanonicalName);
         printStream.println("\"?>");
-        
+
         printStream.print("<!DOCTYPE properties SYSTEM \"");
         printStream.print(PROP_DTD_NAME);
         printStream.println("\">");
-        
+
         printStream.println("<properties>");
-        
+
         if (comment != null) {
             printStream.print("<comment>");
             printStream.print(substitutePredefinedEntries(comment));
@@ -648,17 +648,15 @@
         printStream.println("</properties>");
         printStream.flush();
     }
-    
+
     private String substitutePredefinedEntries(String s) {
-        
+
         /*
-         * substitution for predefined character entities
-         * to use them safely in XML
+         * substitution for predefined character entities to use them safely in
+         * XML
          */
-        return s.replaceAll("&", "&amp;")
-            .replaceAll("<", "&lt;")
-            .replaceAll(">", "&gt;")
-            .replaceAll("\u0027", "&apos;")
-            .replaceAll("\"", "&quot;");
-    }	
+        return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(
+                ">", "&gt;").replaceAll("\u0027", "&apos;").replaceAll("\"",
+                "&quot;");
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/RandomAccess.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/RandomAccess.java?rev=598628&r1=598627&r2=598628&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/RandomAccess.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/RandomAccess.java Tue Nov 27 05:03:19 2007
@@ -17,11 +17,10 @@
 
 package java.util;
 
-
 /**
- * RandomAccess is implemented by <code>List</code> implementations that support
- * fast (usually constant time) random access.
+ * RandomAccess is implemented by <code>List</code> implementations that
+ * support fast (usually constant time) random access.
  */
 public interface RandomAccess {
-	/*empty*/
+    /* empty */
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java?rev=598628&r1=598627&r2=598628&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java Tue Nov 27 05:03:19 2007
@@ -58,18 +58,17 @@
  */
 public final class Scanner implements Iterator<String> {
 
-    //  Default delimiting pattern.
+    // Default delimiting pattern.
     private static final Pattern DEFAULT_DELIMITER = Pattern
             .compile("\\p{javaWhitespace}+"); //$NON-NLS-1$
-    
+
     // The boolean's pattern.
     private static final Pattern BOOLEAN_PATTERN = Pattern.compile(
             "true|false", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
-    
-    
+
     // Pattern used to recognize line terminator.
     private static final Pattern LINE_TERMINATOR;
-    
+
     // Pattern used to recognize multiple line terminators.
     private static final Pattern MULTI_LINE_TERMINATOR;
 
@@ -77,24 +76,19 @@
     private static final Pattern LINE_PATTERN;
 
     static {
-        String terminator = "\n|\r\n|\r|\u0085|\u2028|\u2029";  //$NON-NLS-1$
-        
+        String terminator = "\n|\r\n|\r|\u0085|\u2028|\u2029"; //$NON-NLS-1$
+
         LINE_TERMINATOR = Pattern.compile(terminator);
-        
+
         StringBuilder multiTerminator = new StringBuilder();
-        MULTI_LINE_TERMINATOR = Pattern
-            .compile(multiTerminator.append("(") //$NON-NLS-1$
-                    .append(terminator)
-                    .append(")+").toString()); //$NON-NLS-1$
+        MULTI_LINE_TERMINATOR = Pattern.compile(multiTerminator.append("(") //$NON-NLS-1$
+                .append(terminator).append(")+").toString()); //$NON-NLS-1$
         StringBuilder line = new StringBuilder();
-        LINE_PATTERN = Pattern
-            .compile(line.append(".*(") //$NON-NLS-1$
-                    .append(terminator)
-                    .append(")|.+(") //$NON-NLS-1$
-                    .append(terminator)
-                    .append(")?").toString()); //$NON-NLS-1$
+        LINE_PATTERN = Pattern.compile(line.append(".*(") //$NON-NLS-1$
+                .append(terminator).append(")|.+(") //$NON-NLS-1$
+                .append(terminator).append(")?").toString()); //$NON-NLS-1$
     }
-    
+
     // The pattern matches anything.
     private static final Pattern ANY_PATTERN = Pattern.compile("(?s).*"); //$NON-NLS-1$
 
@@ -127,24 +121,24 @@
     // The length of the buffer.
     private int bufferLength = 0;
 
-    // Record the status of this scanner. True if the scanner 
+    // Record the status of this scanner. True if the scanner
     // is closed.
     private boolean closed = false;
 
     private IOException lastIOException;
-    
+
     private boolean matchSuccessful = false;
-    
+
     private DecimalFormat decimalFormat;
-    
+
     // Records whether the underlying readable has more input.
     private boolean inputExhausted = false;
-    
+
     private Object cacheHasNextValue = null;
-    
+
     private int cachehasNextIndex = -1;
-    
-    private enum DataType{
+
+    private enum DataType {
         /*
          * Stands for Integer
          */
@@ -179,7 +173,7 @@
      * @throws FileNotFoundException
      *             if the specified file is not found
      * @throws IllegalArgumentException
-     *            if the specified coding does not exist
+     *             if the specified coding does not exist
      */
     public Scanner(File src, String charsetName) throws FileNotFoundException {
         if (null == src) {
@@ -235,7 +229,7 @@
      * @param charsetName
      *            the encoding type of the input stream
      * @throws IllegalArgumentException
-     *            if the specified character set is not found
+     *             if the specified character set is not found
      */
     public Scanner(InputStream src, String charsetName) {
         if (null == src) {
@@ -284,7 +278,7 @@
      * @param charsetName
      *            the encoding type of the content in the ReadableByteChannel
      * @throws IllegalArgumentException
-     *            if the specified character set is not found           
+     *             if the specified character set is not found
      */
     public Scanner(ReadableByteChannel src, String charsetName) {
         if (null == src) {
@@ -372,10 +366,10 @@
         matcher.usePattern(pattern);
 
         /*
-         * TODO The following 2 statements are used to deal with regex's
-         * bug. java.util.regex.Matcher.region(int start, int end)
-         * implementation does not have any effects when called. They will be
-         * removed once the bug is fixed.
+         * TODO The following 2 statements are used to deal with regex's bug.
+         * java.util.regex.Matcher.region(int start, int end) implementation
+         * does not have any effects when called. They will be removed once the
+         * bug is fixed.
          */
         int oldLimit = buffer.limit();
         buffer.limit(horizonLineSeparator);
@@ -385,8 +379,9 @@
         if (matcher.find()) {
             // The scanner advances past the input that matched
             findStartIndex = matcher.end();
-            // If the matched pattern is immediately followed by line terminator. 
-            if(horizonLineSeparator == matcher.end()) {
+            // If the matched pattern is immediately followed by line
+            // terminator.
+            if (horizonLineSeparator == matcher.end()) {
                 findStartIndex += terminatorLength;
             }
             matchSuccessful = true;
@@ -534,11 +529,10 @@
     }
 
     /**
-     * Returns true if this scanner has one or more tokens remaining to 
-     * parse. Will block if the data is still being read.
+     * Returns true if this scanner has one or more tokens remaining to parse.
+     * Will block if the data is still being read.
      * 
-     * @return true 
-     *             if this scanner has one or more tokens remaining
+     * @return true if this scanner has one or more tokens remaining
      * @throws IllegalStateException
      *             if the scanner has been closed
      */
@@ -563,14 +557,15 @@
         checkNull(pattern);
         matchSuccessful = false;
         saveCurrentStatus();
-        //if the next token exists, set the match region, otherwise return false
+        // if the next token exists, set the match region, otherwise return
+        // false
         if (!setTokenRegion()) {
             recoverPreviousStatus();
             return false;
         }
         matcher.usePattern(pattern);
         boolean hasNext = false;
-        //check whether next token matches the specified pattern
+        // check whether next token matches the specified pattern
         if (matcher.matches()) {
             cachehasNextIndex = findStartIndex;
             matchSuccessful = true;
@@ -580,7 +575,6 @@
         return hasNext;
     }
 
-
     /**
      * Returns true if this scanner has one or more tokens remaining to parse
      * and the next token matches a pattern compiled from the given string. Will
@@ -668,8 +662,7 @@
      * Returns true if this scanner's next token can be translated into a valid
      * boolean value.
      * 
-     * @return true 
-     *             if the next token in this scanner's input can be translated
+     * @return true if the next token in this scanner's input can be translated
      *         into a valid boolean value
      * @throws IllegalStateException
      *             if the scanner has been closed
@@ -799,7 +792,7 @@
             String intString = matcher.group();
             intString = removeLocaleInfo(intString, DataType.INT);
             try {
-            	cacheHasNextValue = Integer.valueOf(intString, radix);
+                cacheHasNextValue = Integer.valueOf(intString, radix);
                 isIntValue = true;
             } catch (NumberFormatException e) {
                 matchSuccessful = false;
@@ -807,7 +800,7 @@
         }
         return isIntValue;
     }
-    
+
     /**
      * Returns true if there is another line in the input. Otherwise, returns
      * false. When waiting for input, the scanner may be blocked.
@@ -884,7 +877,6 @@
         return isLongValue;
     }
 
-
     /**
      * Returns true if this scanner's next token can be translated into a valid
      * short value in the default radix.
@@ -916,7 +908,7 @@
             String intString = matcher.group();
             intString = removeLocaleInfo(intString, DataType.INT);
             try {
-            	cacheHasNextValue = Short.valueOf(intString, radix);
+                cacheHasNextValue = Short.valueOf(intString, radix);
                 isShortValue = true;
             } catch (NumberFormatException e) {
                 matchSuccessful = false;
@@ -938,8 +930,7 @@
     /**
      * Return the locale of this scanner.
      * 
-     * @return 
-     *             the locale of this scanner
+     * @return the locale of this scanner
      */
     public Locale locale() {
         return locale;
@@ -1064,13 +1055,13 @@
      *             BigDecimal
      */
     public BigDecimal nextBigDecimal() {
-    	checkClosed();
-		Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof BigDecimal) {
-			findStartIndex = cachehasNextIndex;
-			return (BigDecimal) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof BigDecimal) {
+            findStartIndex = cachehasNextIndex;
+            return (BigDecimal) obj;
+        }
         Pattern floatPattern = getFloatPattern();
         String floatString = next(floatPattern);
         floatString = removeLocaleInfoFromFloat(floatString);
@@ -1128,13 +1119,13 @@
      *             BigInteger
      */
     public BigInteger nextBigInteger(int radix) {
-    	checkClosed();
-		Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof BigInteger) {
-			findStartIndex = cachehasNextIndex;
-			return (BigInteger) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof BigInteger) {
+            findStartIndex = cachehasNextIndex;
+            return (BigInteger) obj;
+        }
         Pattern integerPattern = getIntegerPattern(radix);
         String intString = next(integerPattern);
         intString = removeLocaleInfo(intString, DataType.INT);
@@ -1150,8 +1141,7 @@
     }
 
     /**
-     * Returns the next token as a boolean. Will block if input is being
-     * read.
+     * Returns the next token as a boolean. Will block if input is being read.
      * 
      * @return the next token as a boolean
      * @throws IllegalStateException
@@ -1165,7 +1155,7 @@
     public boolean nextBoolean() {
         return Boolean.parseBoolean(next(BOOLEAN_PATTERN));
     }
-    
+
     /**
      * Returns the next token as a byte. Will block if input is being read.
      * 
@@ -1185,16 +1175,16 @@
     }
 
     /**
-     * Returns the next token as a byte with the specified radix. Will
-     * block if input is being read.
+     * Returns the next token as a byte with the specified radix. Will block if
+     * input is being read.
      * 
-     * If the next token can be translated into a byte the following is
-     * done: All locale specific prefixes, group separators, and locale specific
+     * If the next token can be translated into a byte the following is done:
+     * All locale specific prefixes, group separators, and locale specific
      * suffixes are removed. Then non-ASCII digits are mapped into ASCII digits
      * via {@link Character#digit(char, int)}, a negative sign (-) is added if
      * the locale specific negative prefix or suffix was present. Finally the
-     * resulting String is passed to {@link Byte#parseByte(String, int)}}
-     * with the specified radix.
+     * resulting String is passed to {@link Byte#parseByte(String, int)}} with
+     * the specified radix.
      * 
      * @param radix
      *            the radix used to translate the token into byte value
@@ -1209,13 +1199,13 @@
      */
     @SuppressWarnings("boxing")
     public byte nextByte(int radix) {
-    	checkClosed();
-    	Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof Byte) {
-			findStartIndex = cachehasNextIndex;
-			return (Byte) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof Byte) {
+            findStartIndex = cachehasNextIndex;
+            return (Byte) obj;
+        }
         Pattern integerPattern = getIntegerPattern(radix);
         String intString = next(integerPattern);
         intString = removeLocaleInfo(intString, DataType.INT);
@@ -1253,13 +1243,13 @@
      */
     @SuppressWarnings("boxing")
     public double nextDouble() {
-    	checkClosed();
-    	Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof Double) {
-			findStartIndex = cachehasNextIndex;
-			return (Double) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof Double) {
+            findStartIndex = cachehasNextIndex;
+            return (Double) obj;
+        }
         Pattern floatPattern = getFloatPattern();
         String floatString = next(floatPattern);
         floatString = removeLocaleInfoFromFloat(floatString);
@@ -1297,13 +1287,13 @@
      */
     @SuppressWarnings("boxing")
     public float nextFloat() {
-    	checkClosed();
-    	Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof Float) {
-			findStartIndex = cachehasNextIndex;
-			return (Float) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof Float) {
+            findStartIndex = cachehasNextIndex;
+            return (Float) obj;
+        }
         Pattern floatPattern = getFloatPattern();
         String floatString = next(floatPattern);
         floatString = removeLocaleInfoFromFloat(floatString);
@@ -1361,15 +1351,15 @@
      */
     @SuppressWarnings("boxing")
     public int nextInt(int radix) {
-    	checkClosed();
-    	Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof Integer) {
-			findStartIndex = cachehasNextIndex;
-			return (Integer) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof Integer) {
+            findStartIndex = cachehasNextIndex;
+            return (Integer) obj;
+        }
         Pattern integerPattern = getIntegerPattern(radix);
-        String intString=next(integerPattern);
+        String intString = next(integerPattern);
         intString = removeLocaleInfo(intString, DataType.INT);
         int intValue = 0;
         try {
@@ -1419,7 +1409,7 @@
             if (!inputExhausted) {
                 readMore();
                 resetMatcher();
-            } 
+            }
         }
         // Find text without line terminator here.
         if (null != result) {
@@ -1458,8 +1448,8 @@
      * suffixes are removed. Then non-ASCII digits are mapped into ASCII digits
      * via {@link Character#digit(char, int)}, a negative sign (-) is added if
      * the locale specific negative prefix or suffix was present. Finally the
-     * resulting String is passed to  {@link Long#parseLong(String, int)}}
-     * with the specified radix.
+     * resulting String is passed to {@link Long#parseLong(String, int)}} with
+     * the specified radix.
      * 
      * @param radix
      *            the radix used to translate the token into a long value
@@ -1474,13 +1464,13 @@
      */
     @SuppressWarnings("boxing")
     public long nextLong(int radix) {
-    	checkClosed();
-    	Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof Long) {
-			findStartIndex = cachehasNextIndex;
-			return (Long) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof Long) {
+            findStartIndex = cachehasNextIndex;
+            return (Long) obj;
+        }
         Pattern integerPattern = getIntegerPattern(radix);
         String intString = next(integerPattern);
         intString = removeLocaleInfo(intString, DataType.INT);
@@ -1522,7 +1512,7 @@
      * suffixes are removed. Then non-ASCII digits are mapped into ASCII digits
      * via {@link Character#digit(char, int)}, a negative sign (-) is added if
      * the locale specific negative prefix or suffix was present. Finally the
-     * resulting String is passed to  {@link Short#parseShort(String, int)}}
+     * resulting String is passed to {@link Short#parseShort(String, int)}}
      * with the specified radix.
      * 
      * @param radix
@@ -1538,13 +1528,13 @@
      */
     @SuppressWarnings("boxing")
     public short nextShort(int radix) {
-    	checkClosed();
-    	Object obj = cacheHasNextValue;
-		cacheHasNextValue = null;
-		if (obj instanceof Short) {
-			findStartIndex = cachehasNextIndex;
-			return (Short) obj;
-		}
+        checkClosed();
+        Object obj = cacheHasNextValue;
+        cacheHasNextValue = null;
+        if (obj instanceof Short) {
+            findStartIndex = cachehasNextIndex;
+            return (Short) obj;
+        }
         Pattern integerPattern = getIntegerPattern(radix);
         String intString = next(integerPattern);
         intString = removeLocaleInfo(intString, DataType.INT);
@@ -1680,12 +1670,11 @@
 
     /**
      * 
-     * Set the locale of this scanner to a specified locale. 
-     *
+     * Set the locale of this scanner to a specified locale.
+     * 
      * @param l
-     *              the specified locale to use
-     * @return
-     *              this scanner
+     *            the specified locale to use
+     * @return this scanner
      */
     public Scanner useLocale(Locale l) {
         if (null == l) {
@@ -1729,7 +1718,7 @@
         buffer.limit(0);
         matcher = delimiter.matcher(buffer);
     }
-    
+
     /*
      * Check the scanner's state, if it is closed, IllegalStateException will be
      * thrown.
@@ -1739,10 +1728,10 @@
             throw new IllegalStateException();
         }
     }
-    
+
     /*
-     * Check the given pattern. If it is null, then a NullPointerException
-     * will be thrown.
+     * Check the given pattern. If it is null, then a NullPointerException will
+     * be thrown.
      */
     private void checkNull(Pattern pattern) {
         if (null == pattern) {
@@ -1770,12 +1759,12 @@
     }
 
     /*
-     * Change the matcher's status to  last find position
+     * Change the matcher's status to last find position
      */
     private void recoverPreviousStatus() {
         findStartIndex = preStartIndex;
     }
-    
+
     /*
      * Get integer's pattern
      */
@@ -1785,10 +1774,10 @@
                     .getString("KA00e", radix)); //$NON-NLS-1$
         }
         decimalFormat = (DecimalFormat) NumberFormat.getInstance(locale);
-        
-        String allAvailableDigits="0123456789abcdefghijklmnopqrstuvwxyz"; //$NON-NLS-1$ 
-        String ASCIIDigit=allAvailableDigits.substring(0, radix);
-        String nonZeroASCIIDigit=allAvailableDigits.substring(1, radix);
+
+        String allAvailableDigits = "0123456789abcdefghijklmnopqrstuvwxyz"; //$NON-NLS-1$ 
+        String ASCIIDigit = allAvailableDigits.substring(0, radix);
+        String nonZeroASCIIDigit = allAvailableDigits.substring(1, radix);
 
         StringBuilder digit = new StringBuilder("((?i)[").append(ASCIIDigit) //$NON-NLS-1$ 
                 .append("]|\\p{javaDigit})"); //$NON-NLS-1$
@@ -1869,10 +1858,10 @@
         String positivePrefix = ""; //$NON-NLS-1$
         String positiveSuffix = ""; //$NON-NLS-1$
         if (!decimalFormat.getPositivePrefix().equals("")) { //$NON-NLS-1$
-            positivePrefix = "\\Q" + decimalFormat.getPositivePrefix()+"\\E"; //$NON-NLS-1$ //$NON-NLS-2$
+            positivePrefix = "\\Q" + decimalFormat.getPositivePrefix() + "\\E"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         if (!decimalFormat.getPositiveSuffix().equals("")) { //$NON-NLS-1$
-            positiveSuffix = "\\Q" + decimalFormat.getPositiveSuffix()+"\\E"; //$NON-NLS-1$ //$NON-NLS-2$
+            positiveSuffix = "\\Q" + decimalFormat.getPositiveSuffix() + "\\E"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         StringBuilder signedNumeral = new StringBuilder()
                 .append(positivePrefix).append(unSignNumeral).append(
@@ -1887,10 +1876,10 @@
         String negativePrefix = ""; //$NON-NLS-1$
         String negativeSuffix = ""; //$NON-NLS-1$
         if (!decimalFormat.getNegativePrefix().equals("")) { //$NON-NLS-1$
-            negativePrefix = "\\Q" + decimalFormat.getNegativePrefix()+"\\E"; //$NON-NLS-1$//$NON-NLS-2$
+            negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; //$NON-NLS-1$//$NON-NLS-2$
         }
         if (!decimalFormat.getNegativeSuffix().equals("")) { //$NON-NLS-1$
-            negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix()+"\\E"; //$NON-NLS-1$//$NON-NLS-2$
+            negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; //$NON-NLS-1$//$NON-NLS-2$
         }
         StringBuilder signedNumeral = new StringBuilder()
                 .append(negativePrefix).append(unSignNumeral).append(
@@ -1903,11 +1892,10 @@
      */
     private String removeLocaleInfoFromFloat(String floatString) {
         // If the token is HexFloat
-        if (-1 != floatString.indexOf('x')
-                || -1 != floatString.indexOf('X')) {
+        if (-1 != floatString.indexOf('x') || -1 != floatString.indexOf('X')) {
             return floatString;
         }
-        
+
         int exponentIndex;
         String decimalNumeralString;
         String exponentString;
@@ -1923,7 +1911,7 @@
         }
         return removeLocaleInfo(floatString, DataType.FLOAT);
     }
-    
+
     /*
      * Remove the locale specific prefixes, group separators, and locale
      * specific suffixes from input string
@@ -1952,11 +1940,11 @@
             }
         }
         if (DataType.FLOAT == type) {
-            if (tokenBuilder.toString().equals(decimalFormat.getDecimalFormatSymbols()
-                    .getNaN())) {
+            if (tokenBuilder.toString().equals(
+                    decimalFormat.getDecimalFormatSymbols().getNaN())) {
                 result.append("NaN");//$NON-NLS-1$ 
-            } else if (tokenBuilder.toString().equals(decimalFormat
-                    .getDecimalFormatSymbols().getInfinity())) {
+            } else if (tokenBuilder.toString().equals(
+                    decimalFormat.getDecimalFormatSymbols().getInfinity())) {
                 result.append("Infinity");//$NON-NLS-1$ 
             } else {
                 for (int i = 0; i < tokenBuilder.length(); i++) {
@@ -1980,7 +1968,7 @@
         }
         return result.toString();
     }
-    
+
     /*
      * Remove positive and negative sign from the parameter stringBuilder, and
      * return whether the input string is negative
@@ -2167,7 +2155,8 @@
             }
         } catch (IOException e) {
             // Consider the scenario: readable puts 4 chars into
-            // buffer and then an IOException is thrown out. In this case, buffer is
+            // buffer and then an IOException is thrown out. In this case,
+            // buffer is
             // actually grown, but readable.read() will never return.
             bufferLength = buffer.position();
             /*
@@ -2177,7 +2166,6 @@
             readCount = -1;
             lastIOException = e;
         }
-
 
         buffer.flip();
         buffer.position(oldPosition);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Set.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Set.java?rev=598628&r1=598627&r2=598628&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Set.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Set.java Tue Nov 27 05:03:19 2007
@@ -17,182 +17,182 @@
 
 package java.util;
 
-
 /**
  * Set is a collection which does not allow duplicate elements.
+ * 
  * @since 1.2
  */
 public interface Set<E> extends Collection<E> {
-	
-	/**
-	 * Adds the specified object to this Set. The Set is not modified if it
-	 * already contains the object.
-	 * 
-	 * @param object
-	 *            the object to add
-	 * @return true if this Set is modified, false otherwise
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when adding to this Set is not supported
-	 * @exception ClassCastException
-	 *                when the class of the object is inappropriate for this Set
-	 * @exception IllegalArgumentException
-	 *                when the object cannot be added to this Set
-	 */
-	public boolean add(E object);
-
-	/**
-	 * Adds the objects in the specified Collection which do not exist in this
-	 * Set.
-	 * 
-	 * @param collection
-	 *            the Collection of objects
-	 * @return true if this Set is modified, false otherwise
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when adding to this Set is not supported
-	 * @exception ClassCastException
-	 *                when the class of an object is inappropriate for this Set
-	 * @exception IllegalArgumentException
-	 *                when an object cannot be added to this Set
-	 */
-	public boolean addAll(Collection<? extends E> collection);
-
-	/**
-	 * Removes all elements from this Set, leaving it empty.
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when removing from this Set is not supported
-	 * 
-	 * @see #isEmpty
-	 * @see #size
-	 */
-	public void clear();
-
-	/**
-	 * Searches this Set for the specified object.
-	 * 
-	 * @param object
-	 *            the object to search for
-	 * @return true if object is an element of this Set, false otherwise
-	 */
-	public boolean contains(Object object);
-
-	/**
-	 * Searches this Set for all objects in the specified Collection.
-	 * 
-	 * @param collection
-	 *            the Collection of objects
-	 * @return true if all objects in the specified Collection are elements of
-	 *         this Set, false otherwise
-	 */
-	public boolean containsAll(Collection<?> collection);
-
-	/**
-	 * Compares the argument to the receiver, and answers true if they represent
-	 * the <em>same</em> object using a class specific comparison.
-	 * 
-	 * @param object
-	 *            Object the object to compare with this object.
-	 * @return boolean <code>true</code> if the object is the same as this
-	 *         object <code>false</code> if it is different from this object.
-	 * @see #hashCode
-	 */
-	public boolean equals(Object object);
-
-	/**
-	 * Answers an integer hash code for the receiver. Objects which are equal
-	 * answer the same value for this method.
-	 * 
-	 * @return the receiver's hash
-	 * 
-	 * @see #equals
-	 */
-	public int hashCode();
-
-	/**
-	 * Answers if this Set has no elements, a size of zero.
-	 * 
-	 * @return true if this Set has no elements, false otherwise
-	 * 
-	 * @see #size
-	 */
-	public boolean isEmpty();
-
-	/**
-	 * Answers an Iterator on the elements of this Set.
-	 * 
-	 * @return an Iterator on the elements of this Set
-	 * 
-	 * @see Iterator
-	 */
-	public Iterator<E> iterator();
-
-	/**
-	 * Removes any occurrence of the specified object from this Set.
-	 * 
-	 * @param object
-	 *            the object to remove
-	 * @return true if this Set is modified, false otherwise
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when removing from this Set is not supported
-	 */
-	public boolean remove(Object object);
-
-	/**
-	 * Removes all objects in the specified Collection from this Set.
-	 * 
-	 * @param collection
-	 *            the Collection of objects to remove
-	 * @return true if this Set is modified, false otherwise
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when removing from this Set is not supported
-	 */
-	public boolean removeAll(Collection<?> collection);
-
-	/**
-	 * Removes all objects from this Set that are not contained in the specified
-	 * Collection.
-	 * 
-	 * @param collection
-	 *            the Collection of objects to retain
-	 * @return true if this Set is modified, false otherwise
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when removing from this Set is not supported
-	 */
-	public boolean retainAll(Collection<?> collection);
-
-	/**
-	 * Answers the number of elements in this Set.
-	 * 
-	 * @return the number of elements in this Set
-	 */
-	public int size();
-
-	/**
-	 * Answers an array containing all elements contained in this Set.
-	 * 
-	 * @return an array of the elements from this Set
-	 */
-	public Object[] toArray();
-
-	/**
-	 * Answers an array containing all elements contained in this Set. If the
-	 * specified array is large enough to hold the elements, the specified array
-	 * is used, otherwise an array of the same type is created. If the specified
-	 * array is used and is larger than this Set, the array element following
-	 * the collection elements is set to null.
-	 * 
-	 * @param array
-	 *            the array
-	 * @return an array of the elements from this Set
-	 * 
-	 * @exception ArrayStoreException
-	 *                when the type of an element in this Set cannot be stored
-	 *                in the type of the specified array
-	 */
-	public <T> T[] toArray(T[] array);
+
+    /**
+     * Adds the specified object to this Set. The Set is not modified if it
+     * already contains the object.
+     * 
+     * @param object
+     *            the object to add
+     * @return true if this Set is modified, false otherwise
+     * 
+     * @exception UnsupportedOperationException
+     *                when adding to this Set is not supported
+     * @exception ClassCastException
+     *                when the class of the object is inappropriate for this Set
+     * @exception IllegalArgumentException
+     *                when the object cannot be added to this Set
+     */
+    public boolean add(E object);
+
+    /**
+     * Adds the objects in the specified Collection which do not exist in this
+     * Set.
+     * 
+     * @param collection
+     *            the Collection of objects
+     * @return true if this Set is modified, false otherwise
+     * 
+     * @exception UnsupportedOperationException
+     *                when adding to this Set is not supported
+     * @exception ClassCastException
+     *                when the class of an object is inappropriate for this Set
+     * @exception IllegalArgumentException
+     *                when an object cannot be added to this Set
+     */
+    public boolean addAll(Collection<? extends E> collection);
+
+    /**
+     * Removes all elements from this Set, leaving it empty.
+     * 
+     * @exception UnsupportedOperationException
+     *                when removing from this Set is not supported
+     * 
+     * @see #isEmpty
+     * @see #size
+     */
+    public void clear();
+
+    /**
+     * Searches this Set for the specified object.
+     * 
+     * @param object
+     *            the object to search for
+     * @return true if object is an element of this Set, false otherwise
+     */
+    public boolean contains(Object object);
+
+    /**
+     * Searches this Set for all objects in the specified Collection.
+     * 
+     * @param collection
+     *            the Collection of objects
+     * @return true if all objects in the specified Collection are elements of
+     *         this Set, false otherwise
+     */
+    public boolean containsAll(Collection<?> collection);
+
+    /**
+     * Compares the argument to the receiver, and answers true if they represent
+     * the <em>same</em> object using a class specific comparison.
+     * 
+     * @param object
+     *            Object the object to compare with this object.
+     * @return boolean <code>true</code> if the object is the same as this
+     *         object <code>false</code> if it is different from this object.
+     * @see #hashCode
+     */
+    public boolean equals(Object object);
+
+    /**
+     * Answers an integer hash code for the receiver. Objects which are equal
+     * answer the same value for this method.
+     * 
+     * @return the receiver's hash
+     * 
+     * @see #equals
+     */
+    public int hashCode();
+
+    /**
+     * Answers if this Set has no elements, a size of zero.
+     * 
+     * @return true if this Set has no elements, false otherwise
+     * 
+     * @see #size
+     */
+    public boolean isEmpty();
+
+    /**
+     * Answers an Iterator on the elements of this Set.
+     * 
+     * @return an Iterator on the elements of this Set
+     * 
+     * @see Iterator
+     */
+    public Iterator<E> iterator();
+
+    /**
+     * Removes any occurrence of the specified object from this Set.
+     * 
+     * @param object
+     *            the object to remove
+     * @return true if this Set is modified, false otherwise
+     * 
+     * @exception UnsupportedOperationException
+     *                when removing from this Set is not supported
+     */
+    public boolean remove(Object object);
+
+    /**
+     * Removes all objects in the specified Collection from this Set.
+     * 
+     * @param collection
+     *            the Collection of objects to remove
+     * @return true if this Set is modified, false otherwise
+     * 
+     * @exception UnsupportedOperationException
+     *                when removing from this Set is not supported
+     */
+    public boolean removeAll(Collection<?> collection);
+
+    /**
+     * Removes all objects from this Set that are not contained in the specified
+     * Collection.
+     * 
+     * @param collection
+     *            the Collection of objects to retain
+     * @return true if this Set is modified, false otherwise
+     * 
+     * @exception UnsupportedOperationException
+     *                when removing from this Set is not supported
+     */
+    public boolean retainAll(Collection<?> collection);
+
+    /**
+     * Answers the number of elements in this Set.
+     * 
+     * @return the number of elements in this Set
+     */
+    public int size();
+
+    /**
+     * Answers an array containing all elements contained in this Set.
+     * 
+     * @return an array of the elements from this Set
+     */
+    public Object[] toArray();
+
+    /**
+     * Answers an array containing all elements contained in this Set. If the
+     * specified array is large enough to hold the elements, the specified array
+     * is used, otherwise an array of the same type is created. If the specified
+     * array is used and is larger than this Set, the array element following
+     * the collection elements is set to null.
+     * 
+     * @param array
+     *            the array
+     * @return an array of the elements from this Set
+     * 
+     * @exception ArrayStoreException
+     *                when the type of an element in this Set cannot be stored
+     *                in the type of the specified array
+     */
+    public <T> T[] toArray(T[] array);
 }



Mime
View raw message