package io.rtron.math.range

Classes

Name Description
enum class BoundType: Enum<BoundType>

Bound types of intervals. See wikipedia article of intervals.

interface DefinableDomain<T : Comparable<*>> : Any

Classes which have definable domain. See wikipedia article on domain of a function.

class Range<T : Comparable<*>> : Any

Represents a mathematical range. See wikipedia article of interval.

class RangeSet<T : Comparable<*>> : Any

An immutable set of ranges.

interface Tolerable: Any

Classes which have a tolerance.

Fields

Name Description
val difference: Double

Difference between the upper and lower bound of the Range.

val length: /** * Absolute length between upper and lower bound. */

Absolute length between upper and lower bound.

Methods

toBoundType

fun GBoundType.toBoundType(): GBoundType

Conversion from Guava Bound Type class.

Receiver

Name Description
GBoundType

ReturnValue

Name Description
GBoundType

toBoundTypeG

fun BoundType.toBoundTypeG(): GBoundType?

Conversion to Guava Bound Type class.

Receiver

Name Description
BoundType

ReturnValue

Name Description
GBoundType?

arrange

fun Range<Double>.arrange(step: Double, includeClosedEndPoint: Boolean, tolerance: Double): DoubleArray

Arranges an array of Double with step size.

Receiver

Name Description
Range<Double>

Parameters

Name Description
step: Double

size between two values

includeClosedEndPoint: Boolean

true, if endpoint of the Range is to be included

tolerance: Double

tolerance for checking whether endpoint is already included

ReturnValue

Name Description
DoubleArray

DoubleArray of arranged values from lowerEndPoint to upperEndPoint of Range

fuzzyContains

fun Range<Double>.fuzzyContains(value: Double, tolerance: Double): Boolean

Returns true, if the value is fuzzily contained within this Range by the tolerance.

Receiver

Name Description
Range<Double>

Parameters

Name Description
value: Double

value to be checked

tolerance: Double

allowed tolerance fuzziness

ReturnValue

Name Description
Boolean

true, if value is contained

fuzzyContainsResult

fun Range<Double>.fuzzyContainsResult(value: Double, tolerance: Double): Result<Boolean, IllegalArgumentException>

Returns Result.Success, if the value is fuzzily contained within this Range by the tolerance.

Receiver

Name Description
Range<Double>

Parameters

Name Description
value: Double

value to be checked

tolerance: Double

allowed tolerance fuzziness

ReturnValue

Name Description
Result<Boolean, IllegalArgumentException>

Result.Success, if value is fuzzily contained; Result.Failure, otherwise

widened

fun Range<Double>.widened(lowerWideningValue: Double, upperWideningValue: Double): Range<Double>

Widens the lower bound of the Range by lowerWideningValue and the upper bound of the Range by upperWideningValue.

Receiver

Name Description
Range<Double>

Parameters

Name Description
lowerWideningValue: Double

the value for widening the lower bound

upperWideningValue: Double

the value for widening the upper bound

ReturnValue

Name Description
Range<Double>

widened Range

widened

fun Range<Double>.widened(wideningValue: Double): Range<Double>

Widens the Range by wideningValue on the lower and upper bound.

Receiver

Name Description
Range<Double>

Parameters

Name Description
wideningValue: Double

value for widening the lower and upper bound

ReturnValue

Name Description
Range<Double>

widened Range

fuzzyEncloses

fun Range<Double>.fuzzyEncloses(other: Range<Double>, tolerance: Double): Boolean

Returns true, if the other is fuzzily enclosed with a tolerance.

Receiver

Name Description
Range<Double>

Parameters

Name Description
other: Range<Double>

other range to be checked

tolerance: Double

allowed tolerance

ReturnValue

Name Description
Boolean

true, if other is enclosed

shift

fun Range<Double>.shift(value: Double): Range<Double>

Shifts the Range by a value.

Receiver

Name Description
Range<Double>

Parameters

Name Description
value: Double

value the Range is to be shifted by

ReturnValue

Name Description
Range<Double>

shifted Range

shiftLowerEndpointTo

fun Range<Double>.shiftLowerEndpointTo(value: Double): Range<Double>

Shift the Range so that the lower endpoint is represented by the value.

Receiver

Name Description
Range<Double>

Parameters

Name Description
value: Double

new lower endpoint after shifting Range

ReturnValue

Name Description
Range<Double>

shifted Range

toRange

fun <T : Comparable<*>> GRange<T>.toRange(): >

Conversion from Guava range class.

Receiver

Name Description
GRange<T>

ReturnValue

Name Description
>

toRangeSet

fun <T : Comparable<*>> GImmutableRangeSet<T>.toRangeSet(): >

Conversion from Guava range set class.

Receiver

Name Description
GImmutableRangeSet<T>

ReturnValue

Name Description
>

toRangeSet

fun <T : Comparable<*>> Range<T>.toRangeSet(): RangeSet<T>

Conversion to RangeSet.

Receiver

Name Description
Range<T>

Range to be converted

ReturnValue

Name Description
RangeSet<T>

intersectingRange

fun <T : Comparable<*>> Set<Range<T>>.intersectingRange(): Range<T>

Returns the intersecting Range of a provided set of ranges.

Receiver

Name Description
Set<Range<T>>

provided set of ranges for which the intersecting range shall be found

ReturnValue

Name Description
Range<T>

maximum range that intersects all ranges within the set

unionRanges

fun <T : Comparable<*>> Set<Range<T>>.unionRanges(): RangeSet<T>

Union operation of a set of Range to a RangeSet.

Receiver

Name Description
Set<Range<T>>

ReturnValue

Name Description
RangeSet<T>

containsIntersectingRanges

fun <T : Comparable<*>> Set<Range<T>>.containsIntersectingRanges(): Boolean

Returns true, if the set of ranges contains intersecting Range.

Receiver

Name Description
Set<Range<T>>

ReturnValue

Name Description
Boolean

unionRangeSets

fun <T : Comparable<*>> Set<RangeSet<T>>.unionRangeSets(): RangeSet<T>

Unions a set of RangeSet to a single RangeSet.

Receiver

Name Description
Set<RangeSet<T>>

ReturnValue

Name Description
RangeSet<T>

intersectionRangeSets

fun <T : Comparable<*>> Set<RangeSet<T>>.intersectionRangeSets(): RangeSet<T>

Returns the intersecting RangeSet.

Receiver

Name Description
Set<RangeSet<T>>

provided set of RangeSet for which the intersecting RangeSet is evaluated

ReturnValue

Name Description
RangeSet<T>

minimum intersecting range set

containsIntersectingRangeSets

fun <T : Comparable<*>> Set<RangeSet<T>>.containsIntersectingRangeSets(): Boolean

Returns true, if set of RangeSet contains intersecting RangeSet pairs.

Receiver

Name Description
Set<RangeSet<T>>

ReturnValue

Name Description
Boolean

containsConsecutivelyIntersectingRanges

fun <T : Comparable<*>> List<Range<T>>.containsConsecutivelyIntersectingRanges(): Boolean

Returns true, if the list of ranges contains consecutively following ranges that intersect.

Receiver

Name Description
List<Range<T>>

ReturnValue

Name Description
Boolean