Merge branch 'master' of oss.readytalk.com:/var/local/git/avian

This commit is contained in:
Joel Dice 2008-07-11 18:11:29 -06:00
commit dc52bae1cf
7 changed files with 115 additions and 156 deletions

View File

@ -11,11 +11,11 @@
package java.lang; package java.lang;
public interface CharSequence { public interface CharSequence {
public char charAt(int index); public char charAt(int index);
int length(); int length();
CharSequence subSequence(int start, int end); CharSequence subSequence(int start, int end);
String toString(); String toString();
} }

View File

@ -417,6 +417,6 @@ public final class Class <T> {
} }
public boolean desiredAssertionStatus() { public boolean desiredAssertionStatus() {
return false; return false;
} }
} }

View File

@ -44,12 +44,12 @@ public final class String implements Comparable<String>, CharSequence {
public String(byte[] data, String charset) public String(byte[] data, String charset)
throws UnsupportedEncodingException throws UnsupportedEncodingException
{ {
this(data); this(data);
if (! charset.equals("US-ASCII")) { if (! charset.equals("US-ASCII")) {
throw new UnsupportedEncodingException(charset); throw new UnsupportedEncodingException(charset);
}
} }
}
private String(Object data, int offset, int length, boolean copy) { private String(Object data, int offset, int length, boolean copy) {
int l; int l;
@ -253,11 +253,11 @@ public final class String implements Comparable<String>, CharSequence {
if (data instanceof char[]) { if (data instanceof char[]) {
char[] buf = new char[length]; char[] buf = new char[length];
for (int i=0; i < length; i++) { for (int i=0; i < length; i++) {
if (charAt(i) == oldChar) { if (charAt(i) == oldChar) {
buf[i] = newChar; buf[i] = newChar;
} else { } else {
buf[i] = charAt(i); buf[i] = charAt(i);
} }
} }
return new String(buf, 0, length, false); return new String(buf, 0, length, false);
} else { } else {
@ -266,11 +266,11 @@ public final class String implements Comparable<String>, CharSequence {
byte oldByte = (byte)oldChar; byte oldByte = (byte)oldChar;
byte newByte = (byte)newChar; byte newByte = (byte)newChar;
for (int i=0; i < length; i++) { for (int i=0; i < length; i++) {
if (orig[i+offset] == oldByte) { if (orig[i+offset] == oldByte) {
buf[i] = newByte; buf[i] = newByte;
} else { } else {
buf[i] = orig[i+offset]; buf[i] = orig[i+offset];
} }
} }
return new String(buf, 0, length, false); return new String(buf, 0, length, false);
} }
@ -425,9 +425,9 @@ public final class String implements Comparable<String>, CharSequence {
return array; return array;
} }
public CharSequence subSequence(int start, int end) { public CharSequence subSequence(int start, int end) {
return substring(start, end); return substring(start, end);
} }
public native String intern(); public native String intern();

View File

@ -295,7 +295,7 @@ public class StringBuilder implements CharSequence {
getChars(start, len, buf,0 ); getChars(start, len, buf,0 );
return new String(buf, 0, len, false); return new String(buf, 0, len, false);
} }
public CharSequence subSequence(int start, int end) { public CharSequence subSequence(int start, int end) {
return substring(start, end); return substring(start, end);
} }

View File

@ -21,9 +21,9 @@ import java.io.FileDescriptor;
public abstract class System { public abstract class System {
private static Property properties; private static Property properties;
// static { // static {
// loadLibrary("natives"); // loadLibrary("natives");
// } // }
public static final PrintStream out = new PrintStream public static final PrintStream out = new PrintStream
(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true); (new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true);
@ -55,11 +55,11 @@ public abstract class System {
} }
public static String getProperty(String name, String defaultValue) { public static String getProperty(String name, String defaultValue) {
String result = getProperty(name); String result = getProperty(name);
if (result==null) { if (result==null) {
return defaultValue; return defaultValue;
} }
return result; return result;
} }

View File

@ -15,98 +15,57 @@ package java.util;
* *
*/ */
public abstract class AbstractCollection<T> implements Collection<T> { public abstract class AbstractCollection<T> implements Collection<T> {
public boolean add(T element) {
throw new UnsupportedOperationException("adding to "
+ this.getClass().getName());
}
/* public boolean addAll(Collection<? extends T> collection) {
* (non-Javadoc) boolean result = false;
* for (T obj : collection) {
* @see java.util.Collection#add(java.lang.Object) result |= add(obj);
*/ }
public boolean add(T element) { return result;
throw new UnsupportedOperationException("adding to " }
+ this.getClass().getName());
}
/* public void clear() {
* (non-Javadoc) throw new UnsupportedOperationException("clear() in "
* + this.getClass().getName());
* @see java.util.Collection#addAll(java.util.Collection) }
*/
public boolean addAll(Collection<? extends T> collection) {
boolean result = false;
for (T obj : collection) {
result |= add(obj);
}
return result;
}
/* public boolean contains(T element) {
* (non-Javadoc) if (element != null) {
* for (Iterator<T> iter = iterator(); iter.hasNext();) {
* @see java.util.Collection#clear() if (element.equals(iter.next())) {
*/ return true;
public void clear() { }
throw new UnsupportedOperationException("clear() in " }
+ this.getClass().getName()); } else {
} for (Iterator<T> iter = iterator(); iter.hasNext();) {
if (iter.next()==null) {
return true;
}
}
}
return false;
}
/* public boolean isEmpty() {
* (non-Javadoc) return size() == 0;
* }
* @see java.util.Collection#contains(java.lang.Object)
*/
public boolean contains(T element) {
if (element != null) {
for (Iterator<T> iter = iterator(); iter.hasNext();) {
if (element.equals(iter.next())) {
return true;
}
}
} else {
for (Iterator<T> iter = iterator(); iter.hasNext();) {
if (iter.next()==null) {
return true;
}
}
}
return false;
}
/* public boolean remove(T element) {
* (non-Javadoc) throw new UnsupportedOperationException("remove(T) in "
* + this.getClass().getName());
* @see java.util.Collection#isEmpty() }
*/
public boolean isEmpty() {
return size() == 0;
}
/* public abstract int size();
* (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 <S> S[] toArray(S[] array) {
* (non-Javadoc) return Collections.toArray(this, array);
* }
* @see java.util.Collection#size()
*/
public abstract int size();
/* public abstract Iterator<T> iterator();
* (non-Javadoc)
*
* @see java.util.Collection#toArray(S[])
*/
public <S> S[] toArray(S[] array) {
return Collections.toArray(this, array);
}
public abstract Iterator<T> iterator();
} }

View File

@ -189,51 +189,51 @@ public class Collections {
} }
static class UnmodifiableSet<T> implements Set<T> { static class UnmodifiableSet<T> implements Set<T> {
Set<T> inner; Set<T> inner;
UnmodifiableSet(Set<T> inner) { UnmodifiableSet(Set<T> inner) {
this.inner = inner; this.inner = inner;
} }
public boolean add(T element) { public boolean add(T element) {
throw new UnsupportedOperationException("not supported"); throw new UnsupportedOperationException("not supported");
} }
public boolean addAll(Collection<? extends T> collection) { public boolean addAll(Collection<? extends T> collection) {
throw new UnsupportedOperationException("not supported"); throw new UnsupportedOperationException("not supported");
} }
public void clear() { public void clear() {
throw new UnsupportedOperationException("not supported"); throw new UnsupportedOperationException("not supported");
} }
public boolean contains(T element) { public boolean contains(T element) {
return inner.contains(element); return inner.contains(element);
} }
public boolean isEmpty() { public boolean isEmpty() {
return inner.isEmpty(); return inner.isEmpty();
} }
public Iterator<T> iterator() { public Iterator<T> iterator() {
return inner.iterator(); return inner.iterator();
} }
public boolean remove(T element) { public boolean remove(T element) {
throw new UnsupportedOperationException("not supported"); throw new UnsupportedOperationException("not supported");
} }
public int size() { public int size() {
return inner.size(); return inner.size();
} }
public <S> S[] toArray(S[] array) { public <S> S[] toArray(S[] array) {
return inner.toArray(array); return inner.toArray(array);
} }
} }
public static <T> Set<T> unmodifiableSet(Set<T> hs) { public static <T> Set<T> unmodifiableSet(Set<T> hs) {
return new UnmodifiableSet<T>(hs); return new UnmodifiableSet<T>(hs);
} }
} }