Package jminusminus
Class NRange
java.lang.Object
jminusminus.NRange
- All Implemented Interfaces:
Comparable<NRange>
Representation of a liveness range for an interval.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionNRange
(int start, int stop) Constructs a liveness range extending from start to stop (positions in the code). -
Method Summary
Modifier and TypeMethodDescriptionint
Returns a comparison of this range and other by their start positions.boolean
rangeOverlaps
(NRange other) 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.toString()
Returns a string representation of this range.
-
Field Details
-
start
public int startThe range's start position. -
stop
public int stopThe 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
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
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
Returns a comparison of this range and other by their start positions.- Specified by:
compareTo
in interfaceComparable<NRange>
- Parameters:
other
- the other range.- Returns:
- a comparison of this range and other by their start positions.
-
toString
Returns a string representation of this range.
-