Class Range


  • public class Range
    extends Object
    Class representing a cell range (no getters and setters to simplify handling)
    Author:
    Raphael Stoeckli
    • Field Detail

      • EndAddress

        public final Address EndAddress
        End address of the range
      • StartAddress

        public final Address StartAddress
        Start address of the range
    • Constructor Detail

      • Range

        public Range​(Address start,
                     Address end)
        Constructor with with addresses as arguments
        Parameters:
        start - Start address of the range
        end - End address of the range
        Throws:
        RangeException - Thrown if the end address is smaller than the start address
      • Range

        public Range​(String range)
        Constructor with a range string as argument
        Parameters:
        range - Address range (e.g. 'A1:B12')
        Throws:
        RangeException - Thrown if the end address is smaller than the start address
    • Method Detail

      • toString

        public String toString()
        Overwritten toString method
        Overrides:
        toString in class Object
        Returns:
        Returns the range (e.g. 'A1:B12')
      • equals

        public boolean equals​(Object o)
        Overwritten equals method
        Overrides:
        equals in class Object
        Parameters:
        o - Other object to compare
        Returns:
        True if this instance is equal to the other instance
      • buildRange

        public static Range buildRange​(Address startAddress,
                                       Address endAddress)
        Method to build a range object from two addresses. The appropriate start and end address will be determined automatically
        Parameters:
        startAddress - Proposed start address
        endAddress - Proposed end address
        Returns:
        Resolved Range
      • buildRange

        public static Range buildRange​(int startColumn,
                                       int startRow,
                                       int endColumn,
                                       int endRow)
        Method to build a range object from zwo column and two row numbers. The appropriate start and end address will be determined automatically
        Parameters:
        startColumn - Proposed start column
        startRow - Proposed start row
        endColumn - Proposed end column
        endRow - Proposed end row
        Returns:
        Resolved Range