enum SpecialMultiplicationResult extends Enum<SpecialMultiplicationResult>
| Enum Constant and Description |
|---|
FACTOR_1_IS_MINUS_ONE
a*b with a==-1 leading to -b |
FACTOR_1_IS_ONE
a*b with a==1 leading to b |
FACTOR_2_IS_MINUS_ONE
a*b with b==-1 leading to -a |
FACTOR_2_IS_ONE
a*b with b==1 leading to a |
FACTOR_IS_ZERO
a*b with a==0 or b==0 leading to 0 |
FACTORS_ARE_EQUAL
a*b with a==b leading to a^2 |
| Modifier and Type | Method and Description |
|---|---|
(package private) static SpecialMultiplicationResult |
getFor(DecimalArithmetic arithmetic,
long uDecimal1,
long uDecimal2)
Returns the special multiplication case if it is one and null otherwise.
|
(package private) abstract long |
multiply(DecimalArithmetic arithmetic,
long uDecimal1,
long uDecimal2)
Performs the multiplication for this special multiplication result.
|
static SpecialMultiplicationResult |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SpecialMultiplicationResult[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SpecialMultiplicationResult FACTOR_IS_ZERO
a*b with a==0 or b==0 leading to 0public static final SpecialMultiplicationResult FACTOR_1_IS_ONE
a*b with a==1 leading to bpublic static final SpecialMultiplicationResult FACTOR_2_IS_ONE
a*b with b==1 leading to apublic static final SpecialMultiplicationResult FACTOR_1_IS_MINUS_ONE
a*b with a==-1 leading to -bpublic static final SpecialMultiplicationResult FACTOR_2_IS_MINUS_ONE
a*b with b==-1 leading to -apublic static final SpecialMultiplicationResult FACTORS_ARE_EQUAL
a*b with a==b leading to a^2public static SpecialMultiplicationResult[] values()
for (SpecialMultiplicationResult c : SpecialMultiplicationResult.values()) System.out.println(c);
public static SpecialMultiplicationResult valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullabstract long multiply(DecimalArithmetic arithmetic, long uDecimal1, long uDecimal2)
arithmetic - the arithmetic associated with the valuesuDecimal1 - the first factoruDecimal2 - the second factorArithmeticException - if an overflow occurs and the arithmetic's
OverflowMode is set to throw an exceptionstatic final SpecialMultiplicationResult getFor(DecimalArithmetic arithmetic, long uDecimal1, long uDecimal2)
arithmetic - the arithmetic objectuDecimal1 - the first factoruDecimal2 - the second factor