001/**
002 * The MIT License (MIT)
003 *
004 * Copyright (c) 2015-2016 decimal4j (tools4j), Marco Terzer
005 *
006 * Permission is hereby granted, free of charge, to any person obtaining a copy
007 * of this software and associated documentation files (the "Software"), to deal
008 * in the Software without restriction, including without limitation the rights
009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
010 * copies of the Software, and to permit persons to whom the Software is
011 * furnished to do so, subject to the following conditions:
012 *
013 * The above copyright notice and this permission notice shall be included in all
014 * copies or substantial portions of the Software.
015 *
016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
022 * SOFTWARE.
023 */
024package org.decimal4j.api;
025
026import java.math.BigDecimal;
027import java.math.BigInteger;
028import java.math.RoundingMode;
029
030import org.decimal4j.scale.ScaleMetrics;
031import org.decimal4j.truncate.OverflowMode;
032import org.decimal4j.truncate.TruncationPolicy;
033
034/**
035 * Interface implemented by mutable {@link Decimal} classes of different scales.
036 * Mutable Decimals modify their state when performing arithmetic operations;
037 * they represent the result after the operation. Arithmetic operations
038 * therefore return {@code this} as return value. Note however that the
039 * {@link #getScale() scale} of a Mutable Decimal does not change and remains
040 * constant throughout the lifetime of a {@code MutableDecimal} instance.
041 * <p>
042 * Mutable Decimals may be preferred over {@link ImmutableDecimal} descendants
043 * e.g. if the allocation of new objects is undesired or if a chain of
044 * operations is performed.
045 * <p>
046 * Mutable Decimals are <i>NOT</i> thread safe.
047 * 
048 * @param <S>
049 *            the scale metrics type associated with this Decimal
050 */
051public interface MutableDecimal<S extends ScaleMetrics> extends Decimal<S> {
052
053        /**
054         * Sets {@code this} Decimal to 0 and returns {@code this} now representing
055         * zero.
056         * 
057         * @return {@code this} Decimal after assigning the value {@code 0}
058         */
059        MutableDecimal<S> setZero();
060
061        /**
062         * Sets {@code this} Decimal to 1 and returns {@code this} now representing
063         * one.
064         * 
065         * @return {@code this} Decimal after assigning the value {@code 1}
066         */
067        MutableDecimal<S> setOne();
068
069        /**
070         * Sets {@code this} Decimal to -1 and returns {@code this} now representing
071         * minus one.
072         * 
073         * @return {@code this} Decimal after assigning the value {@code -1}
074         */
075        MutableDecimal<S> setMinusOne();
076
077        /**
078         * Sets {@code this} Decimal to the smallest positive value representable by
079         * this Mutable Decimal and returns {@code this} now representing one ULP.
080         * 
081         * @return {@code this} Decimal after assigning the value
082         *         <tt>ULP=10<sup>-scale</sup></tt>
083         */
084        MutableDecimal<S> setUlp();
085
086        /**
087         * Sets {@code this} Decimal to the specified {@code value} and returns
088         * {@code this} now representing {@code value}.
089         * 
090         * @param value
091         *            value to be set
092         * @return {@code this} Decimal after assigning the given {@code value}
093         */
094        MutableDecimal<S> set(Decimal<S> value);
095
096        /**
097         * Sets {@code this} Decimal to the specified {@code value} and returns
098         * {@code this} now representing {@code value}. The specified
099         * {@link Decimal} argument is rounded to the {@link #getScale() scale} of
100         * this mutable Decimal using {@link RoundingMode#HALF_UP} rounding. An
101         * exception is thrown if the specified value is too large to be represented
102         * as a Decimal of this mutable Decimal's scale.
103         * 
104         * @param value
105         *            value to be set
106         * @param roundingMode
107         *            the rounding mode to apply during the conversion if necessary
108         * @return {@code this} Decimal after assigning:
109         *         <tt>round<sub>HALF_UP</sub>(value)</tt>
110         * @throws IllegalArgumentException
111         *             if {@code value} is too large to be represented as a Decimal
112         *             with the scale of this mutable Decimal
113         * @throws ArithmeticException
114         *             if {@code roundingMode} is {@link RoundingMode#UNNECESSARY
115         *             UNNESSESSARY} and rounding is necessary
116         */
117        MutableDecimal<S> set(Decimal<?> value, RoundingMode roundingMode);
118
119        /**
120         * Sets {@code this} Decimal to the specified {@code value} and returns
121         * {@code this} now representing {@code value}. An exception is thrown if
122         * the specified value is too large to be represented as a Decimal of this
123         * mutable Decimal's scale.
124         * 
125         * @param value
126         *            value to be set
127         * @return {@code this} Decimal after assigning the given {@code value}
128         * @throws IllegalArgumentException
129         *             if {@code value} is too large to be represented as a Decimal
130         *             with the scale of this mutable Decimal
131         */
132        MutableDecimal<S> set(long value);
133
134        /**
135         * Sets {@code this} Decimal to the specified {@code value} and returns
136         * {@code this} now representing {@code value}. An exception is thrown if
137         * the specified value is too large to be represented as a Decimal of this
138         * mutable Decimal's scale.
139         * 
140         * @param value
141         *            value to be set
142         * @return {@code this} Decimal after assigning the given {@code value}
143         * @throws IllegalArgumentException
144         *             if {@code value} is too large to be represented as a Decimal
145         *             with the scale of this mutable Decimal
146         */
147        MutableDecimal<S> set(BigInteger value);
148
149        /**
150         * Sets {@code this} Decimal to the specified {@code value} and returns
151         * {@code this} now representing {@code value}. The specified {@code float}
152         * argument is rounded to the {@link #getScale() scale} of this mutable
153         * Decimal using {@link RoundingMode#HALF_UP} rounding. An exception is
154         * thrown if the specified value is too large to be represented as a Decimal
155         * of this mutable Decimal's scale.
156         * 
157         * @param value
158         *            value to be set
159         * @return {@code this} Decimal after assigning:
160         *         <tt>round<sub>HALF_UP</sub>(value)</tt>
161         * @throws IllegalArgumentException
162         *             if {@code value} is NaN or infinite or if the magnitude is
163         *             too large for the float to be represented as a Decimal with
164         *             the scale of this mutable Decimal
165         */
166        MutableDecimal<S> set(float value);
167
168        /**
169         * Sets {@code this} Decimal to the specified {@code value} and returns
170         * {@code this} now representing {@code value}. The specified {@code float}
171         * argument is rounded to the {@link #getScale() scale} of this mutable
172         * Decimal using the specified {@code roundingMode}. An exception is thrown
173         * if the specified value is too large to be represented as a Decimal of
174         * this mutable Decimal's scale.
175         * 
176         * @param value
177         *            value to be set
178         * @param roundingMode
179         *            the rounding mode to apply during the conversion if necessary
180         * @return {@code this} Decimal after assigning: <tt>round(value)</tt>
181         * @throws IllegalArgumentException
182         *             if {@code value} is NaN or infinite or if the magnitude is
183         *             too large for the float to be represented as a Decimal with
184         *             the scale of this mutable Decimal
185         * @throws ArithmeticException
186         *             if {@code roundingMode} is {@link RoundingMode#UNNECESSARY
187         *             UNNESSESSARY} and rounding is necessary
188         */
189        MutableDecimal<S> set(float value, RoundingMode roundingMode);
190
191        /**
192         * Sets {@code this} Decimal to the specified {@code value} and returns
193         * {@code this} now representing {@code value}. The specified {@code double}
194         * argument is rounded to the {@link #getScale() scale} of this mutable
195         * Decimal using {@link RoundingMode#HALF_UP} rounding. An exception is
196         * thrown if the specified value is too large to be represented as a Decimal
197         * of this mutable Decimal's scale.
198         * 
199         * @param value
200         *            value to be set
201         * @return {@code this} Decimal after assigning:
202         *         <tt>round<sub>HALF_UP</sub>(value)</tt>
203         * @throws IllegalArgumentException
204         *             if {@code value} is NaN or infinite or if the magnitude is
205         *             too large for the double to be represented as a Decimal with
206         *             the scale of this mutable Decimal
207         */
208        MutableDecimal<S> set(double value);
209
210        /**
211         * Sets {@code this} Decimal to the specified {@code value} and returns
212         * {@code this} now representing {@code value}. The specified {@code double}
213         * argument is rounded to the {@link #getScale() scale} of this mutable
214         * Decimal using the specified {@code roundingMode}. An exception is thrown
215         * if the specified value is too large to be represented as a Decimal of
216         * this mutable Decimal's scale.
217         * 
218         * @param value
219         *            value to be set
220         * @param roundingMode
221         *            the rounding mode to apply during the conversion if necessary
222         * @return {@code this} Decimal after assigning: <tt>round(value)</tt>
223         * @throws IllegalArgumentException
224         *             if {@code value} is NaN or infinite or if the magnitude is
225         *             too large for the double to be represented as a Decimal with
226         *             the scale of this mutable Decimal
227         * @throws ArithmeticException
228         *             if {@code roundingMode} is {@link RoundingMode#UNNECESSARY
229         *             UNNESSESSARY} and rounding is necessary
230         */
231        MutableDecimal<S> set(double value, RoundingMode roundingMode);
232
233        /**
234         * Sets {@code this} Decimal to the specified {@code value} and returns
235         * {@code this} now representing {@code value}. The specified
236         * {@link BigDecimal} argument is rounded to the {@link #getScale() scale}
237         * of this mutable Decimal using {@link RoundingMode#HALF_UP} rounding. An
238         * exception is thrown if the specified value is too large to be represented
239         * as a Decimal of this mutable Decimal's scale.
240         * 
241         * @param value
242         *            value to be set
243         * @return {@code this} Decimal after assigning:
244         *         <tt>round<sub>HALF_UP</sub>(value)</tt>
245         * @throws IllegalArgumentException
246         *             if {@code value} is too large to be represented as a Decimal
247         *             with the scale of this mutable Decimal
248         */
249        MutableDecimal<S> set(BigDecimal value);
250
251        /**
252         * Sets {@code this} Decimal to the specified {@code value} and returns
253         * {@code this} now representing {@code value}. The specified
254         * {@link BigDecimal} argument is rounded to the {@link #getScale() scale}
255         * of this mutable Decimal using the specified {@code roundingMode}. An
256         * exception is thrown if the specified value is too large to be represented
257         * as a Decimal of this mutable Decimal's scale.
258         * 
259         * @param value
260         *            value to be set
261         * @param roundingMode
262         *            the rounding mode to apply if rounding is necessary
263         * @return {@code this} Decimal after assigning: <tt>round(value)</tt>
264         * @throws IllegalArgumentException
265         *             if {@code value} is too large to be represented as a Decimal
266         *             with the scale of this mutable Decimal
267         * @throws ArithmeticException
268         *             if {@code roundingMode} is {@link RoundingMode#UNNECESSARY
269         *             UNNESSESSARY} and rounding is necessary
270         */
271        MutableDecimal<S> set(BigDecimal value, RoundingMode roundingMode);
272
273        /**
274         * Sets {@code this} Decimal to the specified {@code unscaledValue} and
275         * returns {@code this} now representing <tt>(unscaledValue * 10
276         * <sup>-scale</sup>)</tt> where scale refers to the {@link #getScale()
277         * scale} of this mutable Decimal.
278         * 
279         * @param unscaledValue
280         *            value to be set
281         * @return {@code this} Decimal after assigning:
282         *         <tt>unscaledValue * 10<sup>-scale</sup></tt>.
283         */
284        MutableDecimal<S> setUnscaled(long unscaledValue);
285
286        /**
287         * Sets {@code this} Decimal to the specified {@code unscaledValue} with the
288         * given {@code scale} and returns {@code this} now representing
289         * <tt>(unscaledValue * 10<sup>-scale</sup>)</tt>. The value is rounded to
290         * the {@link #getScale() scale} of this mutable Decimal using
291         * {@link RoundingMode#HALF_UP HALF_UP} rounding. An exception is thrown if
292         * the specified value is too large to be represented as a Decimal of this
293         * of this mutable Decimal's scale.
294         * 
295         * @param unscaledValue
296         *            value to be set
297         * @param scale
298         *            the scale used for {@code unscaledValue}
299         * @return {@code this} Decimal after assigning:
300         *         <tt>round<sub>HALF_UP</sub>(unscaledValue * 10<sup>-scale</sup>)</tt>
301         * @throws IllegalArgumentException
302         *             if the value is too large to be represented as a Decimal with
303         *             the scale of this mutable Decimal
304         */
305        MutableDecimal<S> setUnscaled(long unscaledValue, int scale);
306
307        /**
308         * Sets {@code this} Decimal to the specified {@code unscaledValue} with the
309         * given {@code scale} and returns {@code this} now representing
310         * <tt>(unscaledValue * 10<sup>-scale</sup>)</tt>. The value is rounded to
311         * the {@link #getScale() scale} of this mutable Decimal using the specified
312         * {@code roundingMode}. An exception is thrown if the specified value is
313         * too large to be represented as a Decimal of this of this mutable
314         * Decimal's scale.
315         * 
316         * @param unscaledValue
317         *            value to be set
318         * @param scale
319         *            the scale used for {@code unscaledValue}
320         * @param roundingMode
321         *            the rounding mode to apply during the conversion if necessary
322         * @return {@code this} Decimal after assigning:
323         *         <tt>round(unscaledValue * 10<sup>-scale</sup>)</tt>
324         * @throws IllegalArgumentException
325         *             if the value is too large to be represented as a Decimal with
326         *             the scale of this mutable Decimal
327         * @throws ArithmeticException
328         *             if {@code roundingMode} is {@link RoundingMode#UNNECESSARY
329         *             UNNESSESSARY} and rounding is necessary
330         */
331        MutableDecimal<S> setUnscaled(long unscaledValue, int scale, RoundingMode roundingMode);
332
333        /**
334         * Parses the given string value and sets {@code this} Decimal to the parsed
335         * {@code value}.
336         * <p>
337         * The string representation of a {@code Decimal} consists of an optional
338         * sign, {@code '+'} or {@code '-'} , followed by a sequence of zero or more
339         * decimal digits ("the integer"), optionally followed by a fraction.
340         * <p>
341         * The fraction consists of a decimal point followed by zero or more decimal
342         * digits. The string must contain at least one digit in either the integer
343         * or the fraction. If the fraction contains more digits than this mutable
344         * Decimal's {@link #getScale() scale}, the value is rounded using
345         * {@link RoundingMode#HALF_UP HALF_UP} rounding. An exception is thrown if
346         * the value is too large to be represented as a Decimal of this mutable
347         * Decimals's scale.
348         * 
349         * @param value
350         *            the string value to parse and assign
351         * @return {@code this} Decimal after assigning the parsed value
352         * @throws NumberFormatException
353         *             if {@code value} does not represent a valid {@code Decimal}
354         *             or if the value is too large to be represented as a Decimal
355         *             with the scale of this mutable Decimal's scale
356         */
357        MutableDecimal<S> set(String value);
358
359        /**
360         * Parses the given string value and sets {@code this} Decimal to the parsed
361         * {@code value}.
362         * <p>
363         * The string representation of a {@code Decimal} consists of an optional
364         * sign, {@code '+'} or {@code '-'} , followed by a sequence of zero or more
365         * decimal digits ("the integer"), optionally followed by a fraction.
366         * <p>
367         * The fraction consists of a decimal point followed by zero or more decimal
368         * digits. The string must contain at least one digit in either the integer
369         * or the fraction. If the fraction contains more digits than this mutable
370         * Decimal's {@link #getScale() scale}, the value is rounded using the
371         * specified {@code roundingMode}. An exception is thrown if the value is
372         * too large to be represented as a Decimal of this mutable Decimals's
373         * scale.
374         * 
375         * @param value
376         *            the string value to parse and assign
377         * @param roundingMode
378         *            the rounding mode to apply if the fraction contains more
379         *            digits than the scale of this mutable Decimal
380         * @return {@code this} Decimal after assigning the parsed value
381         * @throws NumberFormatException
382         *             if {@code value} does not represent a valid {@code Decimal}
383         *             or if the value is too large to be represented as a Decimal
384         *             with the scale of this mutable Decimal's scale
385         * @throws ArithmeticException
386         *             if {@code roundingMode==UNNECESSARY} and rounding is
387         *             necessary
388         */
389        MutableDecimal<S> set(String value, RoundingMode roundingMode);
390
391        /**
392         * Returns the minimum of this {@code Decimal} and {@code val}.
393         *
394         * @param val
395         *            value with which the minimum is to be computed.
396         * @return the {@code Decimal} whose value is the lesser of this
397         *         {@code Decimal} and {@code val}. If they are equal, as defined by
398         *         the {@link #compareTo(Decimal) compareTo} method, {@code this} is
399         *         returned.
400         * @see #compareTo(Decimal)
401         */
402        MutableDecimal<S> min(MutableDecimal<S> val);
403
404        /**
405         * Returns the maximum of this {@code Decimal} and {@code val}.
406         *
407         * @param val
408         *            value with which the maximum is to be computed.
409         * @return the {@code Decimal} whose value is the greater of this
410         *         {@code Decimal} and {@code val}. If they are equal, as defined by
411         *         the {@link #compareTo(Decimal) compareTo} method, {@code this} is
412         *         returned.
413         * @see #compareTo(Decimal)
414         */
415        MutableDecimal<S> max(MutableDecimal<S> val);
416
417        /**
418         * Returns a clone of this mutable Decimal numerically identical to this
419         * value.
420         * 
421         * @return a numerically identical clone of this value
422         */
423        MutableDecimal<S> clone();
424
425        // override some methods with specialized return type
426
427        @Override
428        MutableDecimal<S> integralPart();
429
430        @Override
431        MutableDecimal<S> fractionalPart();
432
433        @Override
434        MutableDecimal<S> round(int precision);
435
436        @Override
437        MutableDecimal<S> round(int precision, RoundingMode roundingMode);
438
439        @Override
440        MutableDecimal<S> round(int precision, TruncationPolicy truncationPolicy);
441
442        @Override
443        MutableDecimal<?> scale(int scale);
444
445        @SuppressWarnings("hiding")
446        @Override
447        <S extends ScaleMetrics> MutableDecimal<S> scale(S scaleMetrics);
448
449        @Override
450        MutableDecimal<?> scale(int scale, RoundingMode roundingMode);
451
452        @SuppressWarnings("hiding")
453        @Override
454        <S extends ScaleMetrics> MutableDecimal<S> scale(S scaleMetrics, RoundingMode roundingMode);
455
456        @Override
457        MutableDecimal<S> add(Decimal<S> augend);
458
459        @Override
460        MutableDecimal<S> add(Decimal<S> augend, OverflowMode overflowMode);
461
462        @Override
463        MutableDecimal<S> add(Decimal<?> augend, RoundingMode roundingMode);
464
465        @Override
466        MutableDecimal<S> add(Decimal<?> augend, TruncationPolicy truncationPolicy);
467
468        @Override
469        MutableDecimal<S> add(long augend);
470
471        @Override
472        MutableDecimal<S> add(long augend, OverflowMode overflowMode);
473
474        @Override
475        MutableDecimal<S> add(double augend);
476
477        @Override
478        MutableDecimal<S> add(double augend, RoundingMode roundingMode);
479
480        @Override
481        MutableDecimal<S> addUnscaled(long unscaledAugend);
482
483        @Override
484        MutableDecimal<S> addUnscaled(long unscaledAugend, OverflowMode overflowMode);
485
486        @Override
487        MutableDecimal<S> addUnscaled(long unscaledAugend, int scale);
488
489        @Override
490        MutableDecimal<S> addUnscaled(long unscaledAugend, int scale, RoundingMode roundingMode);
491
492        @Override
493        MutableDecimal<S> addUnscaled(long unscaledAugend, int scale, TruncationPolicy truncationPolicy);
494
495        @Override
496        MutableDecimal<S> addSquared(Decimal<S> value);
497
498        @Override
499        MutableDecimal<S> addSquared(Decimal<S> value, RoundingMode roundingMode);
500
501        @Override
502        MutableDecimal<S> addSquared(Decimal<S> value, TruncationPolicy truncationPolicy);
503
504        @Override
505        MutableDecimal<S> subtract(Decimal<S> subtrahend);
506
507        @Override
508        MutableDecimal<S> subtract(Decimal<S> subtrahend, OverflowMode overflowMode);
509
510        @Override
511        MutableDecimal<S> subtract(Decimal<?> subtrahend, RoundingMode roundingMode);
512
513        @Override
514        MutableDecimal<S> subtract(Decimal<?> subtrahend, TruncationPolicy truncationPolicy);
515
516        @Override
517        MutableDecimal<S> subtract(long subtrahend);
518
519        @Override
520        MutableDecimal<S> subtract(long subtrahend, OverflowMode overflowMode);
521
522        @Override
523        MutableDecimal<S> subtract(double subtrahend);
524
525        @Override
526        MutableDecimal<S> subtract(double subtrahend, RoundingMode roundingMode);
527
528        @Override
529        MutableDecimal<S> subtractUnscaled(long unscaledSubtrahend);
530
531        @Override
532        MutableDecimal<S> subtractUnscaled(long unscaledSubtrahend, OverflowMode overflowMode);
533
534        @Override
535        MutableDecimal<S> subtractUnscaled(long unscaledSubtrahend, int scale);
536
537        @Override
538        MutableDecimal<S> subtractUnscaled(long unscaledSubtrahend, int scale, RoundingMode roundingMode);
539
540        @Override
541        MutableDecimal<S> subtractUnscaled(long unscaledSubtrahend, int scale, TruncationPolicy truncationPolicy);
542
543        @Override
544        MutableDecimal<S> subtractSquared(Decimal<S> value);
545
546        @Override
547        MutableDecimal<S> subtractSquared(Decimal<S> value, RoundingMode roundingMode);
548
549        @Override
550        MutableDecimal<S> subtractSquared(Decimal<S> value, TruncationPolicy truncationPolicy);
551
552        @Override
553        MutableDecimal<S> multiply(Decimal<S> multiplicand);
554
555        @Override
556        MutableDecimal<S> multiply(Decimal<S> multiplicand, RoundingMode roundingMode);
557
558        @Override
559        MutableDecimal<S> multiply(Decimal<S> multiplicand, TruncationPolicy truncationPolicy);
560
561        @Override
562        MutableDecimal<S> multiplyBy(Decimal<?> multiplicand);
563
564        @Override
565        MutableDecimal<S> multiplyBy(Decimal<?> multiplicand, RoundingMode roundingMode);
566
567        @Override
568        MutableDecimal<S> multiplyBy(Decimal<?> multiplicand, TruncationPolicy truncationPolicy);
569
570        @Override
571        MutableDecimal<?> multiplyExact(Decimal<?> multiplicand);
572
573        @Override
574        MutableDecimal<S> multiply(long multiplicand);
575
576        @Override
577        MutableDecimal<S> multiply(long multiplicand, OverflowMode overflowMode);
578
579        @Override
580        MutableDecimal<S> multiply(double multiplicand);
581
582        @Override
583        MutableDecimal<S> multiply(double multiplicand, RoundingMode roundingMode);
584
585        @Override
586        MutableDecimal<S> multiplyUnscaled(long unscaledMultiplicand);
587
588        @Override
589        MutableDecimal<S> multiplyUnscaled(long unscaledMultiplicand, RoundingMode roundingMode);
590
591        @Override
592        MutableDecimal<S> multiplyUnscaled(long unscaledMultiplicand, TruncationPolicy truncationPolicy);
593
594        @Override
595        MutableDecimal<S> multiplyUnscaled(long unscaledMultiplicand, int scale);
596
597        @Override
598        MutableDecimal<S> multiplyUnscaled(long unscaledMultiplicand, int scale, RoundingMode roundingMode);
599
600        @Override
601        MutableDecimal<S> multiplyUnscaled(long unscaledMultiplicand, int scale, TruncationPolicy truncationPolicy);
602
603        @Override
604        MutableDecimal<S> multiplyByPowerOfTen(int n);
605
606        @Override
607        MutableDecimal<S> multiplyByPowerOfTen(int n, RoundingMode roundingMode);
608
609        @Override
610        MutableDecimal<S> multiplyByPowerOfTen(int n, TruncationPolicy truncationPolicy);
611
612        @Override
613        MutableDecimal<S> divide(Decimal<S> divisor);
614
615        @Override
616        MutableDecimal<S> divide(Decimal<S> divisor, RoundingMode roundingMode);
617
618        @Override
619        MutableDecimal<S> divide(Decimal<S> divisor, TruncationPolicy truncationPolicy);
620
621        @Override
622        MutableDecimal<S> divideBy(Decimal<?> divisor);
623
624        @Override
625        MutableDecimal<S> divideBy(Decimal<?> divisor, RoundingMode roundingMode);
626
627        @Override
628        MutableDecimal<S> divideBy(Decimal<?> divisor, TruncationPolicy truncationPolicy);
629
630        @Override
631        MutableDecimal<S> divideTruncate(Decimal<S> divisor);
632
633        @Override
634        MutableDecimal<S> divideExact(Decimal<S> divisor);
635
636        @Override
637        MutableDecimal<S> divide(long divisor);
638
639        @Override
640        MutableDecimal<S> divide(long divisor, RoundingMode roundingMode);
641
642        @Override
643        MutableDecimal<S> divide(long divisor, TruncationPolicy truncationPolicy);
644
645        @Override
646        MutableDecimal<S> divide(double divisor);
647
648        @Override
649        MutableDecimal<S> divide(double divisor, RoundingMode roundingMode);
650
651        @Override
652        MutableDecimal<S> divideUnscaled(long unscaledDivisor);
653
654        @Override
655        MutableDecimal<S> divideUnscaled(long unscaledDivisor, RoundingMode roundingMode);
656
657        @Override
658        MutableDecimal<S> divideUnscaled(long unscaledDivisor, TruncationPolicy truncationPolicy);
659
660        @Override
661        MutableDecimal<S> divideUnscaled(long unscaledDivisor, int scale);
662
663        @Override
664        MutableDecimal<S> divideUnscaled(long unscaledDivisor, int scale, RoundingMode roundingMode);
665
666        @Override
667        MutableDecimal<S> divideUnscaled(long unscaledDivisor, int scale, TruncationPolicy truncationPolicy);
668
669        @Override
670        MutableDecimal<S> divideByPowerOfTen(int n);
671
672        @Override
673        MutableDecimal<S> divideByPowerOfTen(int n, RoundingMode roundingMode);
674
675        @Override
676        MutableDecimal<S> divideByPowerOfTen(int n, TruncationPolicy truncationPolicy);
677
678        @Override
679        MutableDecimal<S> divideToIntegralValue(Decimal<S> divisor);
680
681        @Override
682        MutableDecimal<S> divideToIntegralValue(Decimal<S> divisor, OverflowMode overflowMode);
683
684        @Override
685        MutableDecimal<S>[] divideAndRemainder(Decimal<S> divisor);
686
687        @Override
688        MutableDecimal<S>[] divideAndRemainder(Decimal<S> divisor, OverflowMode overflowMode);
689
690        @Override
691        MutableDecimal<S> remainder(Decimal<S> divisor);
692
693        @Override
694        MutableDecimal<S> negate();
695
696        @Override
697        MutableDecimal<S> negate(OverflowMode overflowMode);
698
699        @Override
700        MutableDecimal<S> abs();
701
702        @Override
703        MutableDecimal<S> abs(OverflowMode overflowMode);
704
705        @Override
706        MutableDecimal<S> invert();
707
708        @Override
709        MutableDecimal<S> invert(RoundingMode roundingMode);
710
711        @Override
712        MutableDecimal<S> invert(TruncationPolicy truncationPolicy);
713
714        @Override
715        MutableDecimal<S> square();
716
717        @Override
718        MutableDecimal<S> square(RoundingMode roundingMode);
719
720        @Override
721        MutableDecimal<S> square(TruncationPolicy truncationPolicy);
722
723        @Override
724        MutableDecimal<S> sqrt();
725
726        @Override
727        MutableDecimal<S> sqrt(RoundingMode roundingMode);
728
729        @Override
730        MutableDecimal<S> shiftLeft(int n);
731
732        @Override
733        MutableDecimal<S> shiftLeft(int n, RoundingMode roundingMode);
734
735        @Override
736        MutableDecimal<S> shiftLeft(int n, TruncationPolicy truncationPolicy);
737
738        @Override
739        MutableDecimal<S> shiftRight(int n);
740
741        @Override
742        MutableDecimal<S> shiftRight(int n, RoundingMode roundingMode);
743
744        @Override
745        MutableDecimal<S> shiftRight(int n, TruncationPolicy truncationPolicy);
746
747        @Override
748        MutableDecimal<S> pow(int n);
749
750        @Override
751        MutableDecimal<S> pow(int n, RoundingMode roundingMode);
752
753        @Override
754        MutableDecimal<S> pow(int n, TruncationPolicy truncationPolicy);
755
756        @Override
757        MutableDecimal<S> avg(Decimal<S> val);
758
759        @Override
760        MutableDecimal<S> avg(Decimal<S> val, RoundingMode roundingMode);
761}