- java.lang.Object
-
- bdv.util.BoundedIntervalDouble
-
- Direct Known Subclasses:
MinMaxGroup
public class BoundedIntervalDouble extends Object
A interval consisting ofBoundedValueDoubleminimum and maximum that can span any interval in a given range. The UI can listen to changes by adding listeners can attach to theminimum and maximumvalues and/or overriding theupdateInterval(double, double)method.- Author:
- Tobias Pietzsch
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleminIntervalSizeminimum interval size.
-
Constructor Summary
Constructors Constructor Description BoundedIntervalDouble(double rangeMin, double rangeMax, double initialMin, double initialMax, double minIntervalSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BoundedValueDoublegetMaxBoundedValue()Get the current maximum of the interval.BoundedValueDoublegetMinBoundedValue()Get the current minimum of the interval.doublegetRangeMax()Get the current maximum of the allowed range.doublegetRangeMin()Get the current minimum of the allowed range.voidsetRange(double min, double max)Set the allowed range.protected voidupdateInterval(double min, double max)
-
-
-
Constructor Detail
-
BoundedIntervalDouble
public BoundedIntervalDouble(double rangeMin, double rangeMax, double initialMin, double initialMax, double minIntervalSize)- Parameters:
rangeMin- lower bound of the allowed range. the interval minimum cannot be lower than this.rangeMax- upper bound of the allowed range. the interval maximum cannot be lower than this.initialMin- initial interval minimum.initialMax- initial interval maximum.minIntervalSize- interval is forced to have this size at least, i.e.,max - min >= minIntervalSize.
-
-
Method Detail
-
updateInterval
protected void updateInterval(double min, double max)This is called when theminormaxvalues change. The default implementation does nothing but derived classes can use it to trigger UI updates, etc.- Parameters:
min- the new minimum of the intervalmax- the new maximum of the interval
-
getMinBoundedValue
public BoundedValueDouble getMinBoundedValue()
Get the current minimum of the interval.- Returns:
- the current minimum of the interval.
-
getMaxBoundedValue
public BoundedValueDouble getMaxBoundedValue()
Get the current maximum of the interval.- Returns:
- the current maximum of the interval.
-
getRangeMin
public double getRangeMin()
Get the current minimum of the allowed range. (The interval (getMinBoundedValue(),getMaxBoundedValue()) is be a non-empty interval within the allowed range.)- Returns:
- the current minimum of the allowed range.
-
getRangeMax
public double getRangeMax()
Get the current maximum of the allowed range. (The interval (getMinBoundedValue(),getMaxBoundedValue()) is be a non-empty interval within the allowed range.)- Returns:
- the current maximum of the allowed range.
-
setRange
public void setRange(double min, double max)Set the allowed range. The interval (getMinBoundedValue(),getMaxBoundedValue()) is enforced to be a non-empty interval within the allowed range.- Parameters:
min- minimum of the allowed range.max- maximum of the allowed range.
-
-