Package bdv.util

Class BoundedInterval


  • public class BoundedInterval
    extends Object
    A interval consisting of BoundedValue minimum and maximum that can span any interval in a given range. The UI can listen to changes by adding listeners can attach to the minimum and maximum values and/or overriding the updateInterval(int, int) method.
    Author:
    Tobias Pietzsch
    • Field Detail

      • minIntervalSize

        protected final int minIntervalSize
        minimum interval size. max - min >= minIntervalSize.
    • Constructor Detail

      • BoundedInterval

        public BoundedInterval​(int rangeMin,
                               int rangeMax,
                               int initialMin,
                               int initialMax,
                               int 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​(int min,
                                      int max)
        This is called when the min or max values change. The default implementation does nothing but derived classes can use it to trigger UI updates, etc.
        Parameters:
        min - the new minimum of the interval
        max - the new maximum of the interval
      • getMinBoundedValue

        public BoundedValue getMinBoundedValue()
        Get the current minimum of the interval.
        Returns:
        the current minimum of the interval.
      • getMaxBoundedValue

        public BoundedValue getMaxBoundedValue()
        Get the current maximum of the interval.
        Returns:
        the current maximum of the interval.
      • getRangeMin

        public int 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 int 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​(int min,
                             int 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.