enum SpecialDivisionResult extends Enum<SpecialDivisionResult>
Enum Constant and Description |
---|
DIVIDEND_IS_ZERO
a/b with a==0, b!=0 leading to 0/b=0 |
DIVISOR_EQUALS_DIVIDEND
a/b with a==b resulting in a/a=b/b=1 |
DIVISOR_EQUALS_MINUS_DIVIDEND
a/b with a==-b resulting in a/-a=-b/b=-1 |
DIVISOR_IS_MINUS_ONE
a/b with b==-1 resulting in a/-1=-a |
DIVISOR_IS_ONE
a/b with b==1 leading to a/1=a |
DIVISOR_IS_ZERO
a/b with b==0 leading to an arithmetic exception |
Modifier and Type | Method and Description |
---|---|
(package private) abstract long |
divide(DecimalArithmetic arithmetic,
long uDecimalDividend,
long uDecimalDivisor)
Performs the division for this special division result.
|
(package private) static SpecialDivisionResult |
getFor(DecimalArithmetic arithmetic,
long uDecimalDividend,
long uDecimalDivisor)
Returns the special division case if it is one and null otherwise.
|
static SpecialDivisionResult |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SpecialDivisionResult[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SpecialDivisionResult DIVIDEND_IS_ZERO
a/b
with a==0, b!=0
leading to 0/b=0
public static final SpecialDivisionResult DIVISOR_IS_ZERO
a/b
with b==0
leading to an arithmetic exceptionpublic static final SpecialDivisionResult DIVISOR_IS_ONE
a/b
with b==1
leading to a/1=a
public static final SpecialDivisionResult DIVISOR_IS_MINUS_ONE
a/b
with b==-1
resulting in a/-1=-a
public static final SpecialDivisionResult DIVISOR_EQUALS_DIVIDEND
a/b
with a==b
resulting in a/a=b/b=1
public static final SpecialDivisionResult DIVISOR_EQUALS_MINUS_DIVIDEND
a/b
with a==-b
resulting in a/-a=-b/b=-1
public static SpecialDivisionResult[] values()
for (SpecialDivisionResult c : SpecialDivisionResult.values()) System.out.println(c);
public static SpecialDivisionResult 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 divide(DecimalArithmetic arithmetic, long uDecimalDividend, long uDecimalDivisor)
arithmetic
- the arithmetic associated with the valuesuDecimalDividend
- the dividenduDecimalDivisor
- the divisorArithmeticException
- if this==DIVISOR_IS_ZERO
or if an overflow occurs and
the arithmetic's OverflowMode
is set to throw an
exceptionstatic final SpecialDivisionResult getFor(DecimalArithmetic arithmetic, long uDecimalDividend, long uDecimalDivisor)
arithmetic
- the arithmetic objectuDecimalDividend
- the dividenduDecimalDivisor
- the divisor