Package jminusminus

Class NRange

java.lang.Object
jminusminus.NRange
All Implemented Interfaces:
Comparable<NRange>

class NRange extends Object implements Comparable<NRange>
Representation of a liveness range for an interval.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    The range's start position.
    int
    The range's stop position.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NRange(int start, int stop)
    Constructs a liveness range extending from start to stop (positions in the code).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns a comparison of this range and other by their start positions.
    boolean
    Returns true if this range overlaps with other, and false otherwise.
    splitRange(int newStart, int newStop)
    Truncates the current range to newStop and returns the remainder as a new range.
    Returns a string representation of this range.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • start

      public int start
      The range's start position.
    • stop

      public int stop
      The range's stop position.
  • Constructor Details

    • NRange

      public NRange(int start, int stop)
      Constructs a liveness range extending from start to stop (positions in the code).
      Parameters:
      start - start position.
      stop - stop position.
  • Method Details

    • splitRange

      public NRange splitRange(int newStart, int newStop)
      Truncates the current range to newStop and returns the remainder as a new range.
      Parameters:
      newStart - the new start position.
      newStop - the split position.
      Returns:
      the remainder of this range starting at newStart and ending at its old stop position.
    • rangeOverlaps

      public boolean rangeOverlaps(NRange other)
      Returns true if this range overlaps with other, and false otherwise.
      Parameters:
      other - the other range.
      Returns:
      true if this range overlaps with other, and false otherwise.
    • compareTo

      public int compareTo(NRange other)
      Returns a comparison of this range and other by their start positions.
      Specified by:
      compareTo in interface Comparable<NRange>
      Parameters:
      other - the other range.
      Returns:
      a comparison of this range and other by their start positions.
    • toString

      public String toString()
      Returns a string representation of this range.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this range.