Class ClosedInterval
java.lang.Object
ch.nolix.tech.math.bigdecimalmath.ClosedInterval
- All Implemented Interfaces:
IClosedInterval
A
ClosedInterval is not mutable.- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsValue(BigDecimal value) booleanintgetHalfs()getMax()getMin()inthashCode()booleanintersectsWithClosedInterval(IClosedInterval closedInterval) toString()withDecimalPlaceCount(int decimalPlaceCount) static ClosedIntervalwithMinAndMax(double min, double max) static ClosedIntervalwithMinAndMax(BigDecimal min, BigDecimal max) static ClosedIntervalwithMinAndMaxAndDecimalPlaceCount(double min, double max, int decimalPlaceCount) static ClosedIntervalwithMinAndMaxAndDecimalPlaceCount(BigDecimal min, BigDecimal max, int decimalPlaceCount)
-
Method Details
-
withMinAndMax
- Parameters:
min-max-- Returns:
- a new
ClosedIntervalwith the given min, max and their max decimal place count. - Throws:
RuntimeException- if the given min is null.RuntimeException- if the given max is null.
-
withMinAndMaxAndDecimalPlaceCount
public static ClosedInterval withMinAndMaxAndDecimalPlaceCount(BigDecimal min, BigDecimal max, int decimalPlaceCount) - Parameters:
min-max-decimalPlaceCount-- Returns:
- a new
ClosedIntervalwith the given min, max and decimalPlaceCount. - Throws:
RuntimeException- if the given min is null.RuntimeException- if the given max is null.RuntimeException- if the given decimalPlaceCount is not positive.
-
withMinAndMax
- Parameters:
min-max-- Returns:
- a new
ClosedIntervalwith the given min, max and their max* decimal place count.
-
withMinAndMaxAndDecimalPlaceCount
public static ClosedInterval withMinAndMaxAndDecimalPlaceCount(double min, double max, int decimalPlaceCount) - Parameters:
min-max-decimalPlaceCount-- Returns:
- a new
ClosedIntervalwith the given min, max and decimalPlaceCount. - Throws:
RuntimeException- if the given decimalPlaceCount is not positive.
-
containsValue
- Specified by:
containsValuein interfaceIClosedInterval
-
equals
-
getDecimalPlaceCount
public int getDecimalPlaceCount()- Specified by:
getDecimalPlaceCountin interfaceIClosedInterval
-
getHalfs
- Specified by:
getHalfsin interfaceIClosedInterval
-
getLength
- Specified by:
getLengthin interfaceIClosedInterval
-
getMax
- Specified by:
getMaxin interfaceIClosedInterval
-
getMidPoint
- Specified by:
getMidPointin interfaceIClosedInterval
-
getMin
- Specified by:
getMinin interfaceIClosedInterval
-
hashCode
-
intersectsWithClosedInterval
- Specified by:
intersectsWithClosedIntervalin interfaceIClosedInterval
-
toString
-
withDecimalPlaceCount
- Specified by:
withDecimalPlaceCountin interfaceIClosedInterval
-