From bba4f75c2f0dc33dddb1fc21b4b79aaeb4583f79 Mon Sep 17 00:00:00 2001 From: Eric Scharff Date: Thu, 3 Jul 2008 10:49:08 -0600 Subject: [PATCH] Tweaked code indentation and formatting to match existing style --- classpath/java/lang/CharSequence.java | 14 +-- classpath/java/lang/Class.java | 2 +- classpath/java/lang/String.java | 36 +++--- classpath/java/lang/StringBuilder.java | 2 +- classpath/java/lang/System.java | 16 +-- classpath/java/util/AbstractCollection.java | 129 +++++++------------- classpath/java/util/Collections.java | 72 +++++------ 7 files changed, 115 insertions(+), 156 deletions(-) diff --git a/classpath/java/lang/CharSequence.java b/classpath/java/lang/CharSequence.java index 56f653a5cc..0ef602ca24 100644 --- a/classpath/java/lang/CharSequence.java +++ b/classpath/java/lang/CharSequence.java @@ -11,11 +11,11 @@ package java.lang; public interface CharSequence { - public char charAt(int index); - - int length(); - - CharSequence subSequence(int start, int end); - - String toString(); + public char charAt(int index); + + int length(); + + CharSequence subSequence(int start, int end); + + String toString(); } diff --git a/classpath/java/lang/Class.java b/classpath/java/lang/Class.java index 8d5a651262..213d8d58c6 100644 --- a/classpath/java/lang/Class.java +++ b/classpath/java/lang/Class.java @@ -417,6 +417,6 @@ public final class Class { } public boolean desiredAssertionStatus() { - return false; + return false; } } diff --git a/classpath/java/lang/String.java b/classpath/java/lang/String.java index 6fc73e2474..afec95c50b 100644 --- a/classpath/java/lang/String.java +++ b/classpath/java/lang/String.java @@ -44,12 +44,12 @@ public final class String implements Comparable, CharSequence { public String(byte[] data, String charset) throws UnsupportedEncodingException - { - this(data); - if (! charset.equals("US-ASCII")) { - throw new UnsupportedEncodingException(charset); + { + this(data); + if (! charset.equals("US-ASCII")) { + throw new UnsupportedEncodingException(charset); + } } - } private String(Object data, int offset, int length, boolean copy) { int l; @@ -253,11 +253,11 @@ public final class String implements Comparable, CharSequence { if (data instanceof char[]) { char[] buf = new char[length]; for (int i=0; i < length; i++) { - if (charAt(i) == oldChar) { - buf[i] = newChar; - } else { - buf[i] = charAt(i); - } + if (charAt(i) == oldChar) { + buf[i] = newChar; + } else { + buf[i] = charAt(i); + } } return new String(buf, 0, length, false); } else { @@ -266,11 +266,11 @@ public final class String implements Comparable, CharSequence { byte oldByte = (byte)oldChar; byte newByte = (byte)newChar; for (int i=0; i < length; i++) { - if (orig[i+offset] == oldByte) { - buf[i] = newByte; - } else { - buf[i] = orig[i+offset]; - } + if (orig[i+offset] == oldByte) { + buf[i] = newByte; + } else { + buf[i] = orig[i+offset]; + } } return new String(buf, 0, length, false); } @@ -425,9 +425,9 @@ public final class String implements Comparable, CharSequence { return array; } - public CharSequence subSequence(int start, int end) { - return substring(start, end); - } + public CharSequence subSequence(int start, int end) { + return substring(start, end); + } public native String intern(); diff --git a/classpath/java/lang/StringBuilder.java b/classpath/java/lang/StringBuilder.java index 6573445e19..78cfc8c287 100644 --- a/classpath/java/lang/StringBuilder.java +++ b/classpath/java/lang/StringBuilder.java @@ -295,7 +295,7 @@ public class StringBuilder implements CharSequence { getChars(start, len, buf,0 ); return new String(buf, 0, len, false); } - + public CharSequence subSequence(int start, int end) { return substring(start, end); } diff --git a/classpath/java/lang/System.java b/classpath/java/lang/System.java index 90f6f02887..78cecb92ff 100644 --- a/classpath/java/lang/System.java +++ b/classpath/java/lang/System.java @@ -21,9 +21,9 @@ import java.io.FileDescriptor; public abstract class System { private static Property properties; -// static { -// loadLibrary("natives"); -// } + // static { + // loadLibrary("natives"); + // } public static final PrintStream out = new PrintStream (new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true); @@ -55,11 +55,11 @@ public abstract class System { } public static String getProperty(String name, String defaultValue) { - String result = getProperty(name); - if (result==null) { - return defaultValue; - } - return result; + String result = getProperty(name); + if (result==null) { + return defaultValue; + } + return result; } diff --git a/classpath/java/util/AbstractCollection.java b/classpath/java/util/AbstractCollection.java index 9ee7085a84..bc4abfe7a5 100644 --- a/classpath/java/util/AbstractCollection.java +++ b/classpath/java/util/AbstractCollection.java @@ -15,98 +15,57 @@ package java.util; * */ public abstract class AbstractCollection implements Collection { + public boolean add(T element) { + throw new UnsupportedOperationException("adding to " + + this.getClass().getName()); + } - /* - * (non-Javadoc) - * - * @see java.util.Collection#add(java.lang.Object) - */ - public boolean add(T element) { - throw new UnsupportedOperationException("adding to " - + this.getClass().getName()); - } + public boolean addAll(Collection collection) { + boolean result = false; + for (T obj : collection) { + result |= add(obj); + } + return result; + } - /* - * (non-Javadoc) - * - * @see java.util.Collection#addAll(java.util.Collection) - */ - public boolean addAll(Collection collection) { - boolean result = false; - for (T obj : collection) { - result |= add(obj); - } - return result; - } + public void clear() { + throw new UnsupportedOperationException("clear() in " + + this.getClass().getName()); + } - /* - * (non-Javadoc) - * - * @see java.util.Collection#clear() - */ - public void clear() { - throw new UnsupportedOperationException("clear() in " - + this.getClass().getName()); - } + public boolean contains(T element) { + if (element != null) { + for (Iterator iter = iterator(); iter.hasNext();) { + if (element.equals(iter.next())) { + return true; + } + } + } else { + for (Iterator iter = iterator(); iter.hasNext();) { + if (iter.next()==null) { + return true; + } + } + + } + return false; + } - /* - * (non-Javadoc) - * - * @see java.util.Collection#contains(java.lang.Object) - */ - public boolean contains(T element) { - if (element != null) { - for (Iterator iter = iterator(); iter.hasNext();) { - if (element.equals(iter.next())) { - return true; - } - } - } else { - for (Iterator iter = iterator(); iter.hasNext();) { - if (iter.next()==null) { - return true; - } - } - - } - return false; - } + public boolean isEmpty() { + return size() == 0; + } - /* - * (non-Javadoc) - * - * @see java.util.Collection#isEmpty() - */ - public boolean isEmpty() { - return size() == 0; - } + public boolean remove(T element) { + throw new UnsupportedOperationException("remove(T) in " + + this.getClass().getName()); + } - /* - * (non-Javadoc) - * - * @see java.util.Collection#remove(java.lang.Object) - */ - public boolean remove(T element) { - throw new UnsupportedOperationException("remove(T) in " - + this.getClass().getName()); - } + public abstract int size(); - /* - * (non-Javadoc) - * - * @see java.util.Collection#size() - */ - public abstract int size(); + public S[] toArray(S[] array) { + return Collections.toArray(this, array); + } - /* - * (non-Javadoc) - * - * @see java.util.Collection#toArray(S[]) - */ - public S[] toArray(S[] array) { - return Collections.toArray(this, array); - } - - public abstract Iterator iterator(); + public abstract Iterator iterator(); } diff --git a/classpath/java/util/Collections.java b/classpath/java/util/Collections.java index b126ea4dd5..70639abd32 100644 --- a/classpath/java/util/Collections.java +++ b/classpath/java/util/Collections.java @@ -189,51 +189,51 @@ public class Collections { } static class UnmodifiableSet implements Set { - Set inner; + Set inner; - UnmodifiableSet(Set inner) { - this.inner = inner; - } - - public boolean add(T element) { - throw new UnsupportedOperationException("not supported"); - } + UnmodifiableSet(Set inner) { + this.inner = inner; + } + + public boolean add(T element) { + throw new UnsupportedOperationException("not supported"); + } - public boolean addAll(Collection collection) { - throw new UnsupportedOperationException("not supported"); - } + public boolean addAll(Collection collection) { + throw new UnsupportedOperationException("not supported"); + } - public void clear() { - throw new UnsupportedOperationException("not supported"); - } + public void clear() { + throw new UnsupportedOperationException("not supported"); + } - public boolean contains(T element) { - return inner.contains(element); - } + public boolean contains(T element) { + return inner.contains(element); + } - public boolean isEmpty() { - return inner.isEmpty(); - } + public boolean isEmpty() { + return inner.isEmpty(); + } - public Iterator iterator() { - return inner.iterator(); - } + public Iterator iterator() { + return inner.iterator(); + } - public boolean remove(T element) { - throw new UnsupportedOperationException("not supported"); - } + public boolean remove(T element) { + throw new UnsupportedOperationException("not supported"); + } - public int size() { - return inner.size(); - } + public int size() { + return inner.size(); + } - public S[] toArray(S[] array) { - return inner.toArray(array); - } - + public S[] toArray(S[] array) { + return inner.toArray(array); + } + } - public static Set unmodifiableSet(Set hs) { - return new UnmodifiableSet(hs); - } + public static Set unmodifiableSet(Set hs) { + return new UnmodifiableSet(hs); + } }