Package me.datafox.dfxengine.math.utils
Class Range
java.lang.Object
me.datafox.dfxengine.math.utils.Range
Various math operations for checking the ranges of
Numerals.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BigDecimalBigDecimalrepresentation ofDouble.MAX_VALUE.static final BigDecimalBigDecimalrepresentation ofFloat.MAX_VALUE.static final BigDecimalBigDecimalrepresentation ofInteger.MAX_VALUE.static final BigDecimalBigDecimalrepresentation ofLong.MAX_VALUE.static final BigDecimalBigDecimalrepresentation of-Double.MAX_VALUE.static final BigDecimalBigDecimalrepresentation of-Float.MAX_VALUE.static final BigDecimalBigDecimalrepresentation ofInteger.MIN_VALUE.static final BigDecimalBigDecimalrepresentation ofLong.MIN_VALUE.static final BigIntegerBigIntegerrepresentation ofDouble.MAX_VALUE.static final BigIntegerBigIntegerrepresentation ofFloat.MAX_VALUE.static final BigIntegerBigIntegerrepresentation ofInteger.MAX_VALUE.static final BigIntegerBigIntegerrepresentation ofLong.MAX_VALUE.static final BigIntegerBigIntegerrepresentation of-Double.MAX_VALUE.static final BigIntegerBigIntegerrepresentation of-Float.MAX_VALUE.static final BigIntegerBigIntegerrepresentation ofInteger.MIN_VALUE.static final BigIntegerBigIntegerrepresentation ofLong.MIN_VALUE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanstatic booleanisOutOfDoubleRange(Numeral numeral) static booleanisOutOfFloatRange(double d) static booleanstatic booleanstatic booleanisOutOfFloatRange(Numeral numeral) static booleanisOutOfIntRange(double d) static booleanisOutOfIntRange(float f) static booleanisOutOfIntRange(long l) static booleanstatic booleanstatic booleanisOutOfIntRange(Numeral numeral) static booleanisOutOfLongRange(double d) static booleanisOutOfLongRange(float f) static booleanstatic booleanstatic booleanisOutOfLongRange(Numeral numeral) static booleanisOutOfRange(Numeral numeral, NumeralType type)
-
Field Details
-
INT_MIN_INT
BigIntegerrepresentation ofInteger.MIN_VALUE. -
INT_MAX_INT
BigIntegerrepresentation ofInteger.MAX_VALUE. -
INT_MIN_LONG
BigIntegerrepresentation ofLong.MIN_VALUE. -
INT_MAX_LONG
BigIntegerrepresentation ofLong.MAX_VALUE. -
DEC_MIN_INT
BigDecimalrepresentation ofInteger.MIN_VALUE. -
DEC_MAX_INT
BigDecimalrepresentation ofInteger.MAX_VALUE. -
DEC_MIN_LONG
BigDecimalrepresentation ofLong.MIN_VALUE. -
DEC_MAX_LONG
BigDecimalrepresentation ofLong.MAX_VALUE. -
DEC_MIN_FLOAT
BigDecimalrepresentation of-Float.MAX_VALUE. -
DEC_MAX_FLOAT
BigDecimalrepresentation ofFloat.MAX_VALUE. -
DEC_MIN_DOUBLE
BigDecimalrepresentation of-Double.MAX_VALUE. -
DEC_MAX_DOUBLE
BigDecimalrepresentation ofDouble.MAX_VALUE. -
INT_MIN_FLOAT
BigIntegerrepresentation of-Float.MAX_VALUE. -
INT_MAX_FLOAT
BigIntegerrepresentation ofFloat.MAX_VALUE. -
INT_MIN_DOUBLE
BigIntegerrepresentation of-Double.MAX_VALUE. -
INT_MAX_DOUBLE
BigIntegerrepresentation ofDouble.MAX_VALUE.
-
-
Constructor Details
-
Range
public Range()
-
-
Method Details
-
isOutOfRange
- Parameters:
numeral-Numeralto be checkedtype- type to be checked- Returns:
trueif the specifiedNumeralis outside the allowed range of the type- Throws:
NullPointerException- if the specified type isnullor if theNumeralreturnsnullforNumeral.getType()IllegalArgumentException- if the specified type is notnullor if theNumeraldoes not returnnullforNumeral.getType(), but the value is not recognised as any of the elements ofNumeralType. This should never happen
-
isOutOfIntRange
- Parameters:
numeral-Numeralto be checked- Returns:
trueif the specifiedNumeralis smaller thanInteger.MIN_VALUEor greater thanInteger.MAX_VALUE- Throws:
NullPointerException- if theNumeralreturnsnullforNumeral.getType()IllegalArgumentException- if theNumeraldoes not returnnullforNumeral.getType(), but the value is not recognised as any of the elements ofNumeralType. This should never happen
-
isOutOfLongRange
- Parameters:
numeral-Numeralto be checked- Returns:
trueif the specifiedNumeralis smaller thanLong.MIN_VALUEor greater thanLong.MAX_VALUE- Throws:
NullPointerException- if theNumeralreturnsnullforNumeral.getType()IllegalArgumentException- if theNumeraldoes not returnnullforNumeral.getType(), but the value is not recognised as any of the elements ofNumeralType. This should never happen
-
isOutOfFloatRange
- Parameters:
numeral-Numeralto be checked- Returns:
trueif the specifiedNumeralis smaller than-Float.MAX_VALUEor greater thanFloat.MAX_VALUE- Throws:
NullPointerException- if theNumeralreturnsnullforNumeral.getType()IllegalArgumentException- if theNumeraldoes not returnnullforNumeral.getType(), but the value is not recognised as any of the elements ofNumeralType. This should never happen
-
isOutOfDoubleRange
- Parameters:
numeral-Numeralto be checked- Returns:
trueif the specifiedNumeralis smaller than-Double.MAX_VALUEor greater thanDouble.MAX_VALUE- Throws:
NullPointerException- if theNumeralreturnsnullforNumeral.getType()IllegalArgumentException- if theNumeraldoes not returnnullforNumeral.getType(), but the value is not recognised as any of the elements ofNumeralType. This should never happen
-
isOutOfIntRange
public static boolean isOutOfIntRange(long l) - Parameters:
l-longto be checked- Returns:
trueif thelongis smaller thanInteger.MIN_VALUEor greater thanInteger.MAX_VALUE
-
isOutOfIntRange
- Parameters:
bi-BigIntegerto be checked- Returns:
trueif theBigIntegeris smaller thanInteger.MIN_VALUEor greater thanInteger.MAX_VALUE
-
isOutOfIntRange
public static boolean isOutOfIntRange(float f) - Parameters:
f-floatto be checked- Returns:
trueif thefloatis smaller thanInteger.MIN_VALUEor greater thanInteger.MAX_VALUE
-
isOutOfIntRange
public static boolean isOutOfIntRange(double d) - Parameters:
d-doubleto be checked- Returns:
trueif thedoubleis smaller thanInteger.MIN_VALUEor greater thanInteger.MAX_VALUE
-
isOutOfIntRange
- Parameters:
bd-BigDecimalto be checked- Returns:
trueif theBigDecimalis smaller thanInteger.MIN_VALUEor greater thanInteger.MAX_VALUE
-
isOutOfLongRange
- Parameters:
bi-BigIntegerto be checked- Returns:
trueif theBigIntegeris smaller thanLong.MIN_VALUEor greater thanLong.MAX_VALUE
-
isOutOfLongRange
public static boolean isOutOfLongRange(float f) - Parameters:
f-floatto be checked- Returns:
trueif thefloatis smaller thanLong.MIN_VALUEor greater thanLong.MAX_VALUE
-
isOutOfLongRange
public static boolean isOutOfLongRange(double d) - Parameters:
d-doubleto be checked- Returns:
trueif thedoubleis smaller thanLong.MIN_VALUEor greater thanLong.MAX_VALUE
-
isOutOfLongRange
- Parameters:
bd-BigDecimalto be checked- Returns:
trueif theBigDecimalis smaller thanLong.MIN_VALUEor greater thanLong.MAX_VALUE
-
isOutOfFloatRange
- Parameters:
bi-BigIntegerto be checked- Returns:
trueif theBigIntegeris smaller than-Float.MAX_VALUEor greater thanFloat.MAX_VALUE
-
isOutOfFloatRange
public static boolean isOutOfFloatRange(double d) - Parameters:
d-doubleto be checked- Returns:
trueif thedoubleis smaller than-Float.MAX_VALUEor greater thanFloat.MAX_VALUE
-
isOutOfFloatRange
- Parameters:
bd-BigDecimalto be checked- Returns:
trueif theBigDecimalis smaller than-Float.MAX_VALUEor greater thanFloat.MAX_VALUE
-
isOutOfDoubleRange
- Parameters:
bi-BigIntegerto be checked- Returns:
trueif theBigIntegeris smaller than-Double.MAX_VALUEor greater thanDouble.MAX_VALUE
-
isOutOfDoubleRange
- Parameters:
bd-BigDecimalto be checked- Returns:
trueif theBigDecimalis smaller than-Double.MAX_VALUEor greater thanDouble.MAX_VALUE
-