< prev index next >

src/java.base/share/classes/java/math/BigDecimal.java

Print this page

        

@@ -1534,11 +1534,11 @@
      * Returns a {@code BigDecimal} whose value is {@code (this /
      * divisor)}, and whose scale is as specified.  If rounding must
      * be performed to generate a result with the specified scale, the
      * specified rounding mode is applied.
      *
-     * <p>The new {@link #divide(BigDecimal, int, RoundingMode)} method
+     * @deprecated The method {@link #divide(BigDecimal, int, RoundingMode)}
      * should be used in preference to this legacy method.
      *
      * @param  divisor value by which this {@code BigDecimal} is to be divided.
      * @param  scale scale of the {@code BigDecimal} quotient to be returned.
      * @param  roundingMode rounding mode to apply.

@@ -1556,10 +1556,11 @@
      * @see    #ROUND_HALF_UP
      * @see    #ROUND_HALF_DOWN
      * @see    #ROUND_HALF_EVEN
      * @see    #ROUND_UNNECESSARY
      */
+    @Deprecated(since="9")
     public BigDecimal divide(BigDecimal divisor, int scale, int roundingMode) {
         if (roundingMode < ROUND_UP || roundingMode > ROUND_UNNECESSARY)
             throw new IllegalArgumentException("Invalid rounding mode");
         if (this.intCompact != INFLATED) {
             if ((divisor.intCompact != INFLATED)) {

@@ -1600,11 +1601,11 @@
      * Returns a {@code BigDecimal} whose value is {@code (this /
      * divisor)}, and whose scale is {@code this.scale()}.  If
      * rounding must be performed to generate a result with the given
      * scale, the specified rounding mode is applied.
      *
-     * <p>The new {@link #divide(BigDecimal, RoundingMode)} method
+     * @deprecated The method {@link #divide(BigDecimal, RoundingMode)} 
      * should be used in preference to this legacy method.
      *
      * @param  divisor value by which this {@code BigDecimal} is to be divided.
      * @param  roundingMode rounding mode to apply.
      * @return {@code this / divisor}

@@ -1621,10 +1622,11 @@
      * @see    #ROUND_HALF_UP
      * @see    #ROUND_HALF_DOWN
      * @see    #ROUND_HALF_EVEN
      * @see    #ROUND_UNNECESSARY
      */
+    @Deprecated(since="9")
     public BigDecimal divide(BigDecimal divisor, int roundingMode) {
         return this.divide(divisor, scale, roundingMode);
     }
 
     /**

@@ -2265,55 +2267,73 @@
 
     /**
      * Rounding mode to round away from zero.  Always increments the
      * digit prior to a nonzero discarded fraction.  Note that this rounding
      * mode never decreases the magnitude of the calculated value.
+     *
+     * @deprecated Use {@link RoundingMode#UP} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_UP =           0;
 
     /**
      * Rounding mode to round towards zero.  Never increments the digit
      * prior to a discarded fraction (i.e., truncates).  Note that this
      * rounding mode never increases the magnitude of the calculated value.
+     *
+     * @deprecated Use {@link RoundingMode#DOWN} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_DOWN =         1;
 
     /**
      * Rounding mode to round towards positive infinity.  If the
      * {@code BigDecimal} is positive, behaves as for
      * {@code ROUND_UP}; if negative, behaves as for
      * {@code ROUND_DOWN}.  Note that this rounding mode never
      * decreases the calculated value.
+     *
+     * @deprecated Use {@link RoundingMode#CEILING} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_CEILING =      2;
 
     /**
      * Rounding mode to round towards negative infinity.  If the
      * {@code BigDecimal} is positive, behave as for
      * {@code ROUND_DOWN}; if negative, behave as for
      * {@code ROUND_UP}.  Note that this rounding mode never
      * increases the calculated value.
+     *
+     * @deprecated Use {@link RoundingMode#FLOOR} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_FLOOR =        3;
 
     /**
      * Rounding mode to round towards {@literal "nearest neighbor"}
      * unless both neighbors are equidistant, in which case round up.
      * Behaves as for {@code ROUND_UP} if the discarded fraction is
      * &ge; 0.5; otherwise, behaves as for {@code ROUND_DOWN}.  Note
      * that this is the rounding mode that most of us were taught in
      * grade school.
+     *
+     * @deprecated Use {@link RoundingMode#HALF_UP} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_HALF_UP =      4;
 
     /**
      * Rounding mode to round towards {@literal "nearest neighbor"}
      * unless both neighbors are equidistant, in which case round
      * down.  Behaves as for {@code ROUND_UP} if the discarded
      * fraction is {@literal >} 0.5; otherwise, behaves as for
      * {@code ROUND_DOWN}.
+     *
+     * @deprecated Use {@link RoundingMode#HALF_DOWN} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_HALF_DOWN =    5;
 
     /**
      * Rounding mode to round towards the {@literal "nearest neighbor"}
      * unless both neighbors are equidistant, in which case, round

@@ -2321,19 +2341,25 @@
      * {@code ROUND_HALF_UP} if the digit to the left of the
      * discarded fraction is odd; behaves as for
      * {@code ROUND_HALF_DOWN} if it's even.  Note that this is the
      * rounding mode that minimizes cumulative error when applied
      * repeatedly over a sequence of calculations.
+     *
+     * @deprecated Use {@link RoundingMode#HALF_EVEN} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_HALF_EVEN =    6;
 
     /**
      * Rounding mode to assert that the requested operation has an exact
      * result, hence no rounding is necessary.  If this rounding mode is
      * specified on an operation that yields an inexact result, an
      * {@code ArithmeticException} is thrown.
+     *
+     * @deprecated Use {@link RoundingMode#UNNECESSARY} instead.
      */
+    @Deprecated(since="9")
     public static final int ROUND_UNNECESSARY =  7;
 
 
     // Scaling/Rounding Operations
 

@@ -2406,11 +2432,11 @@
      * modified, contrary to the usual convention of having methods
      * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
      * Instead, {@code setScale} returns an object with the proper
      * scale; the returned object may or may not be newly allocated.
      *
-     * <p>The new {@link #setScale(int, RoundingMode)} method should
+     * @deprecated The method {@link #setScale(int, RoundingMode)} should
      * be used in preference to this legacy method.
      *
      * @param  newScale scale of the {@code BigDecimal} value to be returned.
      * @param  roundingMode The rounding mode to apply.
      * @return a {@code BigDecimal} whose scale is the specified value,

@@ -2429,10 +2455,11 @@
      * @see    #ROUND_HALF_UP
      * @see    #ROUND_HALF_DOWN
      * @see    #ROUND_HALF_EVEN
      * @see    #ROUND_UNNECESSARY
      */
+    @Deprecated(since="9")
     public BigDecimal setScale(int newScale, int roundingMode) {
         if (roundingMode < ROUND_UP || roundingMode > ROUND_UNNECESSARY)
             throw new IllegalArgumentException("Invalid rounding mode");
 
         int oldScale = this.scale;
< prev index next >