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 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>