Package org.yamcs.studio.data.formula
Class Ranges
java.lang.Object
org.yamcs.studio.data.formula.Ranges
Utility classes to compute ranges.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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
Determines the range that can contain both ranges.
-
Constructor Details
-
Ranges
public Ranges()
-
-
Method Details
-
absRange
Returns the range of the absolute values within the range.If the range is all positive, it returns the same range.
- Parameters:
range
- a range- Returns:
- the range of the absolute values
-
range
Range from given min and max.- Parameters:
minValue
- minimum valuemaxValue
- maximum value- Returns:
- the range
-
sum
Determines the range that can contain both ranges. If one of the ranges in contained in the other, the bigger range is returned.- Parameters:
range1
- a rangerange2
- another range- Returns:
- the bigger range
-
aggregateRange
Increases the given aggregated range with the new data range.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?
- Parameters:
dataRange
- the new data range; can't be nullaggregatedRange
- the old aggregated range; can be null- Returns:
- a range big enough to contain both ranges
-
overlap
Percentage, from 0 to 1, of the first range that is contained by the second range.- Parameters:
range
- the range to be contained by the secondotherRange
- the range that has to contain the first- Returns:
- from 0 (if there is no intersection) to 1 (if the ranges are the same)
-