public class Ranges extends Object
Constructor and Description |
---|
Ranges() |
Modifier and Type | Method and Description |
---|---|
static Range |
absRange(Range range)
Returns the range of the absolute values within the range.
|
static Range |
aggregateRange(Range dataRange,
Range aggregatedRange)
Increases the given aggregated range with the new data range.
|
static double |
overlap(Range range,
Range otherRange)
Percentage, from 0 to 1, of the first range that is contained by
the second range.
|
static Range |
range(double minValue,
double maxValue)
Range from given min and max.
|
static Range |
sum(Range range1,
Range range2)
Determines the range that can contain both ranges.
|
public static Range absRange(Range range)
If the range is all positive, it returns the same range.
range
- a rangepublic static Range range(double minValue, double maxValue)
minValue
- minimum valuemaxValue
- maximum valuepublic static Range sum(Range range1, Range range2)
range1
- a rangerange2
- another rangepublic static Range aggregateRange(Range dataRange, Range aggregatedRange)
TODO: maybe this should be re-thought: it's the same as sum with different null handling. Maybe a RangeAggregator utility class that also handles numbers?
dataRange
- the new data range; can't be nullaggregatedRange
- the old aggregated range; can be nullpublic static double overlap(Range range, Range otherRange)
range
- the range to be contained by the secondotherRange
- the range that has to contain the firstCopyright © 2015. All rights reserved.