Commit a79cb46c by Tom Tromey Committed by Tom Tromey

StringBuilder.java (appendCodePoint): New method.

	* java/lang/StringBuilder.java (appendCodePoint): New method.
	(insert): New overloads.
	* java/lang/StringBuffer.java (StringBuffer): New constructor.
	(charAt): Remerged javadoc.
	(codePointAt, codePointBefore): New methods.
	(appendCodePoint): New method.
	(append): New overloads.
	(insert): Likewise.
	(trimToSize, codePointCount, offsetByCodePoints): New methods.
	* java/lang/Float.java (SIZE): New field.
	(valueOf): New method.
	* java/lang/natDouble.cc (initIDs): Removed.
	* java/lang/Double.java (static initializer): Removed.
	(SIZE): New field.
	(valueOf): New method.
	(initIDs): Removed.

From-SVN: r109497
parent 5109f57e
2006-01-08 Tom Tromey <tromey@redhat.com>
* java/lang/StringBuilder.java (appendCodePoint): New method.
(insert): New overloads.
* java/lang/StringBuffer.java (StringBuffer): New constructor.
(charAt): Remerged javadoc.
(codePointAt, codePointBefore): New methods.
(appendCodePoint): New method.
(append): New overloads.
(insert): Likewise.
(trimToSize, codePointCount, offsetByCodePoints): New methods.
* java/lang/Float.java (SIZE): New field.
(valueOf): New method.
* java/lang/natDouble.cc (initIDs): Removed.
* java/lang/Double.java (static initializer): Removed.
(SIZE): New field.
(valueOf): New method.
(initIDs): Removed.
2006-01-07 Jakub Jelinek <jakub@redhat.com>
PR libgcj/24940
......
/* Double.java -- object wrapper for double
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,7 +38,6 @@ exception statement from your version. */
package java.lang;
import gnu.classpath.Configuration;
/**
* Instances of class <code>Double</code> represent primitive
......@@ -89,6 +88,12 @@ public final class Double extends Number implements Comparable
public static final double NaN = 0.0 / 0.0;
/**
* The number of bits needed to represent a <code>double</code>.
* @since 1.5
*/
public static final int SIZE = 64;
/**
* The primitive type <code>double</code> is represented by this
* <code>Class</code> object.
* @since 1.1
......@@ -103,18 +108,6 @@ public final class Double extends Number implements Comparable
private final double value;
/**
* Load native routines necessary for this class.
*/
static
{
if (Configuration.INIT_LOAD_LIBRARY)
{
System.loadLibrary("javalang");
initIDs();
}
}
/**
* Create a <code>Double</code> from the primitive <code>double</code>
* specified.
*
......@@ -180,6 +173,22 @@ public final class Double extends Number implements Comparable
}
/**
* Returns a <code>Double</code> object wrapping the value.
* In contrast to the <code>Double</code> constructor, this method
* may cache some values. It is used by boxing conversion.
*
* @param val the value to wrap
* @return the <code>Double</code>
*
* @since 1.5
*/
public static Double valueOf(double val)
{
// We don't actually cache, but we could.
return new Double(val);
}
/**
* Create a new <code>Double</code> object using the <code>String</code>.
*
* @param s the <code>String</code> to convert
......@@ -534,10 +543,4 @@ public final class Double extends Number implements Comparable
*/
// Package visible for use by Float.
static native String toString(double d, boolean isFloat);
/**
* Initialize JNI cache. This method is called only by the
* static initializer when using JNI.
*/
private static native void initIDs();
}
/* Float.java -- object wrapper for float
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -94,6 +94,12 @@ public final class Float extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('F');
/**
* The number of bits needed to represent a <code>float</code>.
* @since 1.5
*/
public static final int SIZE = 32;
/**
* The immutable value of this Float.
*
* @serial the wrapped float
......@@ -192,6 +198,22 @@ public final class Float extends Number implements Comparable
}
/**
* Returns a <code>Float</code> object wrapping the value.
* In contrast to the <code>Float</code> constructor, this method
* may cache some values. It is used by boxing conversion.
*
* @param val the value to wrap
* @return the <code>Float</code>
*
* @since 1.5
*/
public static Float valueOf(float val)
{
// We don't actually cache, but we could.
return new Float(val);
}
/**
* Parse the specified <code>String</code> as a <code>float</code>. The
* extended BNF grammar is as follows:<br>
* <pre>
......
/* StringBuilder.java -- Unsynchronized growable strings
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -464,6 +464,25 @@ public final class StringBuilder
}
/**
* Append the code point to this <code>StringBuilder</code>.
* This is like #append(char), but will append two characters
* if a supplementary code point is given.
*
* @param code the code point to append
* @return this <code>StringBuilder</code>
* @see Character#toChars(int, char[], int)
* @since 1.5
*/
public synchronized StringBuilder appendCodePoint(int code)
{
int len = Character.charCount(code);
ensureCapacity(count + len);
Character.toChars(code, value, count);
count += len;
return this;
}
/**
* Append the <code>String</code> value of the argument to this
* <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
* to <code>String</code>.
......@@ -705,6 +724,52 @@ public final class StringBuilder
}
/**
* Insert the <code>CharSequence</code> argument into this
* <code>StringBuilder</code>. If the sequence is null, the String
* "null" is used instead.
*
* @param offset the place to insert in this buffer
* @param sequence the <code>CharSequence</code> to insert
* @return this <code>StringBuilder</code>
* @throws IndexOutOfBoundsException if offset is out of bounds
*/
public synchronized StringBuilder insert(int offset, CharSequence sequence)
{
if (sequence == null)
sequence = "null";
return insert(offset, sequence, 0, sequence.length());
}
/**
* Insert a subsequence of the <code>CharSequence</code> argument into this
* <code>StringBuilder</code>. If the sequence is null, the String
* "null" is used instead.
*
* @param offset the place to insert in this buffer
* @param sequence the <code>CharSequence</code> to insert
* @param start the starting index of the subsequence
* @param end one past the ending index of the subsequence
* @return this <code>StringBuilder</code>
* @throws IndexOutOfBoundsException if offset, start,
* or end are out of bounds
*/
public synchronized StringBuilder insert(int offset, CharSequence sequence,
int start, int end)
{
if (sequence == null)
sequence = "null";
if (start < 0 || end < 0 || start > end || end > sequence.length())
throw new IndexOutOfBoundsException();
int len = end - start;
ensureCapacity(count + len);
System.arraycopy(value, offset, value, offset + len, count - offset);
for (int i = start; i < end; ++i)
value[offset++] = sequence.charAt(i);
count += len;
return this;
}
/**
* Insert the <code>char[]</code> argument into this
* <code>StringBuilder</code>.
*
......
// natDouble.cc - Implementation of java.lang.Double native methods.
/* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005, 2006 Free Software Foundation
This file is part of libgcj.
......@@ -211,9 +211,3 @@ java::lang::Double::parseDouble(jstring str)
}
throw new NumberFormatException(str);
}
void
java::lang::Double::initIDs()
{
// Not used in libgcj
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment