Commit 98182da5 by Tom Tromey

PushbackReader.java: Merged with Classpath.

	* java/io/PushbackReader.java: Merged with Classpath.
	* java/util/Arrays.java: Updated from Classpath.

	* scripts/blocks.pl: New file.
	* java/lang/Character.java (Subset): New class.
	(UnicodeBlock): New class.

	* java/lang/Math.java (toDegrees, toRadians): New methods.

	* java/lang/Float.java: Implement Comparable.
	(compareTo): New methods.
	* java/lang/Double.java: Implement Comparable.
	(compareTo): New methods.

From-SVN: r37512
parent dd3b81b4
...@@ -18,7 +18,7 @@ package java.lang; ...@@ -18,7 +18,7 @@ package java.lang;
* Status: Believed complete and correct. * Status: Believed complete and correct.
*/ */
public final class Double extends Number public final class Double extends Number implements Comparable
{ {
public static final double MIN_VALUE = 5e-324; public static final double MIN_VALUE = 5e-324;
public static final double MAX_VALUE = 1.7976931348623157e+308; public static final double MAX_VALUE = 1.7976931348623157e+308;
...@@ -147,5 +147,26 @@ public final class Double extends Number ...@@ -147,5 +147,26 @@ public final class Double extends Number
public static native long doubleToLongBits (double value); public static native long doubleToLongBits (double value);
public static native double longBitsToDouble (long bits); public static native double longBitsToDouble (long bits);
}
public int compareTo (Double d)
{
double v = d.value;
if (isNaN (value))
return isNaN (v) ? 1 : 0;
else if (isNaN (v))
return -1;
else if (value == 0.0 && v == -0.0)
return 1;
else if (value == -0.0 && v == 0.0)
return -1;
else if (value == v)
return 0;
return value > v ? 1 : -1;
}
public int compareTo (Object o)
{
return compareTo ((Double) o);
}
}
...@@ -18,7 +18,7 @@ package java.lang; ...@@ -18,7 +18,7 @@ package java.lang;
* Status: Believed complete and correct. * Status: Believed complete and correct.
*/ */
public final class Float extends Number public final class Float extends Number implements Comparable
{ {
public static final float MAX_VALUE = 3.4028235e+38f; public static final float MAX_VALUE = 3.4028235e+38f;
public static final float MIN_VALUE = 1.4e-45f; public static final float MIN_VALUE = 1.4e-45f;
...@@ -147,5 +147,25 @@ public final class Float extends Number ...@@ -147,5 +147,25 @@ public final class Float extends Number
public static native float intBitsToFloat (int bits); public static native float intBitsToFloat (int bits);
} public int compareTo (Float d)
{
float v = d.value;
if (isNaN (value))
return isNaN (v) ? 1 : 0;
else if (isNaN (v))
return -1;
else if (value == 0.0 && v == -0.0)
return 1;
else if (value == -0.0 && v == 0.0)
return -1;
else if (value == v)
return 0;
return value > v ? 1 : -1;
}
public int compareTo (Object o)
{
return compareTo ((Float) o);
}
}
/* Copyright (C) 1998, 1999 Free Software Foundation /* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -110,6 +110,16 @@ public final class Math ...@@ -110,6 +110,16 @@ public final class Math
public static native double max (double a, double b); public static native double max (double a, double b);
public static double toDegrees (double radians)
{
return radians * 180 / PI;
}
public static double toRadians (double degrees)
{
return degrees * PI / 180;
}
// Don't allow objects to be made. // Don't allow objects to be made.
private Math () private Math ()
{ {
......
#! /usr/bin/perl
if ($ARGV[0] eq '')
{
$file = 'Blocks.txt';
if (! -f $file)
{
# Too painful to figure out how to get Perl to do it.
# FIXME.
system 'wget -o .wget-log http://www.isi.edu/in-notes/iana/unidata/Blocks.txt';
}
}
else
{
$file = $ARGV[0];
}
open (INPUT, "< $file") || die "couldn't open $file: $!";
@array = ();
while (<INPUT>)
{
next if /^#/;
chop;
($start, $to, $text) = split (/; /);
($symbol = $text) =~ tr/a-z/A-Z/;
$symbol =~ s/[- ]/_/g;
# Special case for one of the SPECIALS.
next if $start eq 'FEFF';
printf " public static final UnicodeBlock %s = new UnicodeBlock (\"%s\", '\\u%s', '\\u%s');\n",
$symbol, $text, $start, $to;
push (@array, $symbol);
}
printf " private static final UnicodeBlock[] blocks = {\n";
foreach (@array)
{
printf " %s", $_;
printf "," unless $_ eq 'SPECIALS';
printf "\n";
}
printf " };\n";
close (INPUT);
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