Package ghidra.util.datastruct

# Class Range

java.lang.Object
ghidra.util.datastruct.Range

All Implemented Interfaces:
  `Comparable<Range>`, `Iterable<Integer>`

public class Range extends Object implements Comparable<Range>, Iterable<Integer>
A class for holding a minimum and maximum signed int values that define a range.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `int`
  `max`
  The range's maximum extent (inclusive).
  `int`
  `min`
  The range's minimum extent.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Range(int min, int max)`
  Creates a range whose extent is from min to max.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(Range other)`
  `boolean`
  `contains(int value)`
  Returns true if the value is within the ranges extent.
  `boolean`
  `equals(Object obj)`
  `int`
  `hashCode()`
  `Iterator<Integer>`
  `iterator()`
  `long`
  `size()`
  Returns the range's size.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Field Details

  - ### min

    public int min
    The range's minimum extent.

  - ### max

    public int max
    The range's maximum extent (inclusive).

- ## Constructor Details

  - ### Range

    public Range(int min, int max)
    Creates a range whose extent is from min to max.
    Parameters:
      `min` - the minimum extent.
      `max` - the maximum extent (inclusive).
    Throws:
      `IllegalArgumentException` - if max is less than min.

- ## Method Details

  - ### compareTo

    public int compareTo(Range other)
    Specified by:
      `compareTo` in interface `Comparable<Range>`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### contains

    public boolean contains(int value)
    Returns true if the value is within the ranges extent.
    Parameters:
      `value` - the value to check.
    Returns:
      true if the value is within the ranges extent.

  - ### size

    public long size()
    Returns the range's size.
    Returns:
      the size

  - ### iterator

    public Iterator<Integer> iterator()
    Specified by:
      `iterator` in interface `Iterable<Integer>`