Class AbstractReferenceableAxis<T extends Comparable<? super T>>

    • Constructor Detail

      • AbstractReferenceableAxis

        protected AbstractReferenceableAxis​(String name)
        Creates an axis with the given name.
    • Method Detail

      • getFirstValue

        protected final T getFirstValue()
        Gets the value of the axis at index 0
      • getLastValue

        protected final T getLastValue()
        Gets the value of the axis at index (size - 1)
      • getMinimumValue

        protected final T getMinimumValue()
        Returns the minimum coordinate value of this axis. This will be the first coordinate value if the coordinate values are in ascending order, or the last coordinate value if the coordinate values are in descending order.
        Returns:
        the minimum coordinate value of this axis
      • getMaximumValue

        protected final T getMaximumValue()
        Returns the maximum coordinate value of this axis. This will be the last coordinate value if the coordinate values are in ascending order, or the first coordinate value if the coordinate values are in descending order.
        Returns:
        the maximum coordinate value of this axis
      • getCoordinateExtent

        public Extent<T> getCoordinateExtent()
        Description copied from interface: ReferenceableAxis
        Gets the extent encompassing all the positions on this axis. This will usually be given by the low value of the first set of coordinate bounds and the high value of the last set of coordinate bounds (but beware that values along the axis might decrease, not increase).
        Specified by:
        getCoordinateExtent in interface ReferenceableAxis<T extends Comparable<? super T>>
      • contains

        public boolean contains​(T position)
        Specified by:
        contains in interface Domain<T extends Comparable<? super T>>
        Returns:
        true if the given position is contained within this domain.
      • extendFirstValue

        protected abstract T extendFirstValue​(T firstVal,
                                              T nextVal)
        This should return the lower bound of the first value of the axis, based on the first and second values. This will generally be equivalent to:

        firstVal - (nextVal-firstVal)/2

        Parameters:
        firstVal - The first value of the axis
        nextVal - The second value of the axis
        Returns:
        The lower bound of the first axis value
      • extendLastValue

        protected abstract T extendLastValue​(T lastVal,
                                             T secondLastVal)
        This should return the upper bound of the last value of the axis, based on the last two values. This will generally be equivalent to:

        lastVal + (lastVal-secondLastVal)/2

        Parameters:
        lastVal - The last value of the axis
        secondLastVal - The next-to-last value of the axis
        Returns:
        The upper bound of the the final axis value