Commit 7af8968e by Michael Koch Committed by Michael Koch

BigDecimal.java, [...]: Reorganized import statements, removed redundant and reorganized modifiers.

2004-10-16  Michael Koch  <konqueror@gmx.de>

	* java/math/BigDecimal.java, java/math/BigInteger.java:
	Reorganized import statements, removed redundant and
	reorganized modifiers.

From-SVN: r89149
parent f3bf8475
2004-10-16 Michael Koch <konqueror@gmx.de> 2004-10-16 Michael Koch <konqueror@gmx.de>
* java/math/BigDecimal.java, java/math/BigInteger.java:
Reorganized import statements, removed redundant and
reorganized modifiers.
2004-10-16 Michael Koch <konqueror@gmx.de>
* gnu/java/beans/ExplicitBeanInfo.java: * gnu/java/beans/ExplicitBeanInfo.java:
Explicitely import java.awt.Image. Explicitely import java.awt.Image.
(getIcon): Fixed off-by-one error. (getIcon): Fixed off-by-one error.
......
...@@ -37,28 +37,26 @@ exception statement from your version. */ ...@@ -37,28 +37,26 @@ exception statement from your version. */
package java.math; package java.math;
import java.math.BigInteger;
public class BigDecimal extends Number implements Comparable public class BigDecimal extends Number implements Comparable
{ {
private BigInteger intVal; private BigInteger intVal;
private int scale; private int scale;
private static final long serialVersionUID = 6108874887143696463L; private static final long serialVersionUID = 6108874887143696463L;
private final static BigDecimal ZERO = private static final BigDecimal ZERO =
new BigDecimal (BigInteger.valueOf (0), 0); new BigDecimal (BigInteger.valueOf (0), 0);
private final static BigDecimal ONE = private static final BigDecimal ONE =
new BigDecimal (BigInteger.valueOf (1), 0); new BigDecimal (BigInteger.valueOf (1), 0);
public final static int ROUND_UP = 0; public static final int ROUND_UP = 0;
public final static int ROUND_DOWN = 1; public static final int ROUND_DOWN = 1;
public final static int ROUND_CEILING = 2; public static final int ROUND_CEILING = 2;
public final static int ROUND_FLOOR = 3; public static final int ROUND_FLOOR = 3;
public final static int ROUND_HALF_UP = 4; public static final int ROUND_HALF_UP = 4;
public final static int ROUND_HALF_DOWN = 5; public static final int ROUND_HALF_DOWN = 5;
public final static int ROUND_HALF_EVEN = 6; public static final int ROUND_HALF_EVEN = 6;
public final static int ROUND_UNNECESSARY = 7; public static final int ROUND_UNNECESSARY = 7;
public BigDecimal (BigInteger num) public BigDecimal (BigInteger num)
{ {
......
...@@ -35,18 +35,15 @@ this exception to your version of the library, but you are not ...@@ -35,18 +35,15 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.math; package java.math;
import gnu.java.math.MPN; import gnu.java.math.MPN;
import java.util.Random;
import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.IOException; import java.util.Random;
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date December 20, 1999.
*/
/** /**
* Written using on-line Java Platform 1.2 API Specification, as well * Written using on-line Java Platform 1.2 API Specification, as well
...@@ -56,17 +53,18 @@ import java.io.IOException; ...@@ -56,17 +53,18 @@ import java.io.IOException;
* Based primarily on IntNum.java BitOps.java by Per Bothner <per@bothner.com> * Based primarily on IntNum.java BitOps.java by Per Bothner <per@bothner.com>
* (found in Kawa 1.6.62). * (found in Kawa 1.6.62).
* *
* Status: Believed complete and correct. * @author Warren Levy <warrenl@cygnus.com>
* @date December 20, 1999.
* @status believed complete and correct.
*/ */
public class BigInteger extends Number implements Comparable public class BigInteger extends Number implements Comparable
{ {
/** All integers are stored in 2's-complement form. /** All integers are stored in 2's-complement form.
* If words == null, the ival is the value of this BigInteger. * If words == null, the ival is the value of this BigInteger.
* Otherwise, the first ival elements of words make the value * Otherwise, the first ival elements of words make the value
* of this BigInteger, stored in little-endian order, 2's-complement form. */ * of this BigInteger, stored in little-endian order, 2's-complement form. */
transient private int ival; private transient int ival;
transient private int[] words; private transient int[] words;
// Serialization fields. // Serialization fields.
private int bitCount = -1; private int bitCount = -1;
...@@ -338,7 +336,7 @@ public class BigInteger extends Number implements Comparable ...@@ -338,7 +336,7 @@ public class BigInteger extends Number implements Comparable
} }
} }
private final boolean isNegative() private boolean isNegative()
{ {
return (words == null ? ival : words[ival - 1]) < 0; return (words == null ? ival : words[ival - 1]) < 0;
} }
...@@ -389,12 +387,12 @@ public class BigInteger extends Number implements Comparable ...@@ -389,12 +387,12 @@ public class BigInteger extends Number implements Comparable
return compareTo(this, val) > 0 ? this : val; return compareTo(this, val) > 0 ? this : val;
} }
private final boolean isZero() private boolean isZero()
{ {
return words == null && ival == 0; return words == null && ival == 0;
} }
private final boolean isOne() private boolean isOne()
{ {
return words == null && ival == 1; return words == null && ival == 1;
} }
...@@ -440,7 +438,7 @@ public class BigInteger extends Number implements Comparable ...@@ -440,7 +438,7 @@ public class BigInteger extends Number implements Comparable
} }
/** Add two ints, yielding a BigInteger. */ /** Add two ints, yielding a BigInteger. */
private static final BigInteger add(int x, int y) private static BigInteger add(int x, int y)
{ {
return valueOf((long) x + (long) y); return valueOf((long) x + (long) y);
} }
...@@ -480,13 +478,13 @@ public class BigInteger extends Number implements Comparable ...@@ -480,13 +478,13 @@ public class BigInteger extends Number implements Comparable
} }
/** Destructively add an int to this. */ /** Destructively add an int to this. */
private final void setAdd(int y) private void setAdd(int y)
{ {
setAdd(this, y); setAdd(this, y);
} }
/** Destructively set the value of this to a long. */ /** Destructively set the value of this to a long. */
private final void set(long y) private void set(long y)
{ {
int i = (int) y; int i = (int) y;
if ((long) i == y) if ((long) i == y)
...@@ -505,14 +503,14 @@ public class BigInteger extends Number implements Comparable ...@@ -505,14 +503,14 @@ public class BigInteger extends Number implements Comparable
/** Destructively set the value of this to the given words. /** Destructively set the value of this to the given words.
* The words array is reused, not copied. */ * The words array is reused, not copied. */
private final void set(int[] words, int length) private void set(int[] words, int length)
{ {
this.ival = length; this.ival = length;
this.words = words; this.words = words;
} }
/** Destructively set the value of this to that of y. */ /** Destructively set the value of this to that of y. */
private final void set(BigInteger y) private void set(BigInteger y)
{ {
if (y.words == null) if (y.words == null)
set(y.ival); set(y.ival);
...@@ -572,7 +570,7 @@ public class BigInteger extends Number implements Comparable ...@@ -572,7 +570,7 @@ public class BigInteger extends Number implements Comparable
return add(this, val, -1); return add(this, val, -1);
} }
private static final BigInteger times(BigInteger x, int y) private static BigInteger times(BigInteger x, int y)
{ {
if (y == 0) if (y == 0)
return ZERO; return ZERO;
...@@ -604,7 +602,7 @@ public class BigInteger extends Number implements Comparable ...@@ -604,7 +602,7 @@ public class BigInteger extends Number implements Comparable
return result.canonicalize(); return result.canonicalize();
} }
private static final BigInteger times(BigInteger x, BigInteger y) private static BigInteger times(BigInteger x, BigInteger y)
{ {
if (y.words == null) if (y.words == null)
return times(x, y.ival); return times(x, y.ival);
...@@ -1016,7 +1014,7 @@ public class BigInteger extends Number implements Comparable ...@@ -1016,7 +1014,7 @@ public class BigInteger extends Number implements Comparable
return BigInteger.make(rwords, rlen); return BigInteger.make(rwords, rlen);
} }
private static final int[] euclidInv(int a, int b, int prevDiv) private static int[] euclidInv(int a, int b, int prevDiv)
{ {
if (b == 0) if (b == 0)
throw new ArithmeticException("not invertible"); throw new ArithmeticException("not invertible");
...@@ -1033,7 +1031,7 @@ public class BigInteger extends Number implements Comparable ...@@ -1033,7 +1031,7 @@ public class BigInteger extends Number implements Comparable
return xy; return xy;
} }
private static final void euclidInv(BigInteger a, BigInteger b, private static void euclidInv(BigInteger a, BigInteger b,
BigInteger prevDiv, BigInteger[] xy) BigInteger prevDiv, BigInteger[] xy)
{ {
if (b.isZero()) if (b.isZero())
...@@ -1184,7 +1182,7 @@ public class BigInteger extends Number implements Comparable ...@@ -1184,7 +1182,7 @@ public class BigInteger extends Number implements Comparable
} }
/** Calculate Greatest Common Divisor for non-negative ints. */ /** Calculate Greatest Common Divisor for non-negative ints. */
private static final int gcd(int a, int b) private static int gcd(int a, int b)
{ {
// Euclid's algorithm, copied from libg++. // Euclid's algorithm, copied from libg++.
int tmp; int tmp;
...@@ -1786,7 +1784,7 @@ public class BigInteger extends Number implements Comparable ...@@ -1786,7 +1784,7 @@ public class BigInteger extends Number implements Comparable
} }
/** Destructively negate this. */ /** Destructively negate this. */
private final void setNegative() private void setNegative()
{ {
setNegative(this); setNegative(this);
} }
......
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