java.lang.Object
org.eclipse.nebula.widgets.nattable.coordinate.Range

public class Range extends Object
Represents a consecutive range of numbers, e.g. a range of selected rows: 1 - 100. Ranges are inclusive of their start value and exclusive of their end value, i.e. start <= x < end
  • Field Details

    • start

      public int start
    • end

      public int end
  • Constructor Details

    • Range

      public Range(int start, int end)
      Create a new Range.
      Parameters:
      start - The start position inclusive.
      end - The end position exclusive.
  • Method Details

    • size

      public int size()
      Returns:
      The size of this range.
    • contains

      public boolean contains(int position)
      Check if the given position is contained in this Range.
      Parameters:
      position - the position to check.
      Returns:
      true if the range contains the given position.
    • overlap

      public boolean overlap(Range range)
      Check if the given Range overlaps this Range.
      Parameters:
      range - The Range to check.
      Returns:
      true if the given Range contains positions that are also contained in this Range.
    • getMembers

      public Set<Integer> getMembers()
      Returns:
      The values represented by this Range.
    • getMembersArray

      public int[] getMembersArray()
      Returns:
      The values represented by this Range.
      Since:
      2.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • sortByStart

      public static void sortByStart(List<Range> ranges)
      Helper method to sort a list of Range objects by their start position.
      Parameters:
      ranges - The Range list to sort.