public final class Multipliable2f extends Object
Multipliable2f
encapsulates a Decimal of scale 2 and facilitates
exact typed multiplication. The multipliable object acts as first factor in the multiplication
and provides a set of overloaded methods for different scales. Each one of those methods
delivers a different result scale which represents the appropriate scale for the product of
an exact multiplication.
A Multipliable2f
object is returned by Decimal2f.multiplyExact()
,
hence an exact typed multiplication can be written as:
Decimal2f value = ... //some value Decimal4f product = value.multiplyExact().by(Decimal2f.FIVE);
Constructor and Description |
---|
Multipliable2f(Decimal<Scale2f> value)
Constructor with Decimal value to be encapsulated.
|
Modifier and Type | Method and Description |
---|---|
Decimal4f |
by(Decimal<Scale2f> factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal2f |
by(Decimal0f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal12f |
by(Decimal10f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal13f |
by(Decimal11f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal14f |
by(Decimal12f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal15f |
by(Decimal13f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal16f |
by(Decimal14f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal17f |
by(Decimal15f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal18f |
by(Decimal16f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal3f |
by(Decimal1f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal5f |
by(Decimal3f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal6f |
by(Decimal4f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal7f |
by(Decimal5f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal8f |
by(Decimal6f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal9f |
by(Decimal7f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal10f |
by(Decimal8f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal11f |
by(Decimal9f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal2f |
by(MutableDecimal0f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal12f |
by(MutableDecimal10f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal13f |
by(MutableDecimal11f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal14f |
by(MutableDecimal12f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal15f |
by(MutableDecimal13f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal16f |
by(MutableDecimal14f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal17f |
by(MutableDecimal15f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal18f |
by(MutableDecimal16f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal3f |
by(MutableDecimal1f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal5f |
by(MutableDecimal3f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal6f |
by(MutableDecimal4f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal7f |
by(MutableDecimal5f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal8f |
by(MutableDecimal6f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal9f |
by(MutableDecimal7f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal10f |
by(MutableDecimal8f factor)
Returns a
Decimal whose value is (this * factor) . |
Decimal11f |
by(MutableDecimal9f factor)
Returns a
Decimal whose value is (this * factor) . |
boolean |
equals(Object obj)
Compares this Multipliable2f to the specified object.
|
Decimal<Scale2f> |
getValue()
Returns the value underlying this Multipliable2f.
|
int |
hashCode()
Returns a hash code for this Multipliable2f which happens to be the
hash code of the underlying
Decimal2f value. |
Decimal4f |
square()
Returns a
Decimal whose value is (this2). |
String |
toString()
Returns a string representation of this
Multipliable2f which is
simply the string representation of the underlying Decimal value . |
public Multipliable2f(Decimal<Scale2f> value)
value
- the decimal value to be wrapped as a multipliable objectpublic Decimal<Scale2f> getValue()
public Decimal4f square()
Decimal
whose value is (this2). The
result is exact and has scale 4 which is twice the scale of
the Decimal that this multipliable object represents. An
ArithmeticException
is thrown if the product is out of the
possible range for a Decimal4f
.
Note that the result is always a new instance.
ArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal4f
public Decimal4f by(Decimal<Scale2f> factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 4 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal4f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal4f
public Decimal2f by(Decimal0f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 2 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal2f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal2f
public Decimal2f by(MutableDecimal0f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 2 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal2f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal2f
public Decimal3f by(Decimal1f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 3 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal3f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal3f
public Decimal3f by(MutableDecimal1f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 3 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal3f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal3f
public Decimal5f by(Decimal3f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 5 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal5f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal5f
public Decimal5f by(MutableDecimal3f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 5 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal5f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal5f
public Decimal6f by(Decimal4f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 6 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal6f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal6f
public Decimal6f by(MutableDecimal4f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 6 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal6f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal6f
public Decimal7f by(Decimal5f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 7 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal7f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal7f
public Decimal7f by(MutableDecimal5f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 7 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal7f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal7f
public Decimal8f by(Decimal6f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 8 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal8f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal8f
public Decimal8f by(MutableDecimal6f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 8 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal8f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal8f
public Decimal9f by(Decimal7f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 9 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal9f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal9f
public Decimal9f by(MutableDecimal7f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 9 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal9f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal9f
public Decimal10f by(Decimal8f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 10 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal10f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal10f
public Decimal10f by(MutableDecimal8f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 10 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal10f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal10f
public Decimal11f by(Decimal9f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 11 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal11f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal11f
public Decimal11f by(MutableDecimal9f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 11 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal11f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal11f
public Decimal12f by(Decimal10f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 12 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal12f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal12f
public Decimal12f by(MutableDecimal10f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 12 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal12f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal12f
public Decimal13f by(Decimal11f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 13 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal13f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal13f
public Decimal13f by(MutableDecimal11f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 13 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal13f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal13f
public Decimal14f by(Decimal12f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 14 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal14f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal14f
public Decimal14f by(MutableDecimal12f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 14 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal14f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal14f
public Decimal15f by(Decimal13f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 15 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal15f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal15f
public Decimal15f by(MutableDecimal13f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 15 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal15f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal15f
public Decimal16f by(Decimal14f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 16 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal16f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal16f
public Decimal16f by(MutableDecimal14f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 16 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal16f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal16f
public Decimal17f by(Decimal15f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 17 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal17f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal17f
public Decimal17f by(MutableDecimal15f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 17 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal17f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal17f
public Decimal18f by(Decimal16f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 18 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal18f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal18f
public Decimal18f by(MutableDecimal16f factor)
Decimal
whose value is (this * factor)
. The
result is exact and has scale 18 which is the sum of the scales
of the Decimal that this multipliable object represents and the scale of
the factor
argument. An ArithmeticException
is thrown if the
product is out of the possible range for a Decimal18f
.
Note that the result is always a new instance.
factor
- the factor to multiply with the Decimal that this multipliable representsArithmeticException
- if an overflow occurs and product is out of the possible
range for a Decimal18f
public int hashCode()
Decimal2f
value.hashCode
in class Object
Decimal.hashCode()
public boolean equals(Object obj)
true
if and only if the argument is a Multipliable2f
with an equal underlying
value
.equals
in class Object
obj
- the object to compare withtrue
if the argument is a Multipliable2f
and if its value
is equal to this multipliables's value; false
otherwisegetValue()
,
Decimal.equals(Object)
public String toString()
Multipliable2f
which is
simply the string representation of the underlying Decimal value
.toString
in class Object
String
Decimal representation of this Multipliable2f
's
value with all the fraction digits (including trailing zeros)getValue()
,
Decimal.toString()