org.conqat.lib.commons.string.LineRange Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-lib-commons Show documentation
Show all versions of teamscale-lib-commons Show documentation
Provides common utility functions
The newest version!
package org.conqat.lib.commons.string;
public class LineRange {
/** The start line (1-based). */
private final int start;
/** The end line (1-based). */
private int end;
/** Constructor. */
public LineRange(int start, int end) {
this.start = start;
this.end = end;
}
/** @see #end */
public int getEnd() {
return end;
}
/** @see #end */
public void setEnd(int end) {
this.end = end;
}
/**
* Returns the line range as used in the XML report. A range is returned as e.g. 2-5 or simply 3 if
* the start and end are equal.
*/
private String toReportString() {
if (start == end) {
return String.valueOf(start);
} else {
return start + "-" + end;
}
}
@Override
public String toString() {
return toReportString();
}
}