/** * Sets the end of this range, keeping {@link #start()} constant. * * @param end the new end, must be > {@link #start()} * @throws LineIndexOutOfBoundsException if <code>end</code> <= {@link #start()} */ public void setEnd(int end) throws LineIndexOutOfBoundsException { setLength(end - start()); }
/** * Resizes the range by <code>delta</code> lines, keeping {@link #start()} constant. * * @param delta the number of lines to resize the range * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} */ public void resizeBy(int delta) throws LineIndexOutOfBoundsException { setLength(length() + delta); }
/** * Resizes the range by <code>delta</code> lines, keeping {@link #start()} constant. * * @param delta the number of lines to resize the range * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} */ public void resizeBy(int delta) throws LineIndexOutOfBoundsException { setLength(length() + delta); }
/** * Sets the end of this range, keeping {@link #start()} constant. * * @param end the new end, must be > {@link #start()} * @throws LineIndexOutOfBoundsException if <code>end</code> <= {@link #start()} */ public void setEnd(int end) throws LineIndexOutOfBoundsException { setLength(end - start()); }
private Range(int start, int length) { moveTo(start); setLength(length); }
private Range(int start, int length) { moveTo(start); setLength(length); }
/** * Splits a range off the end of the receiver. The receiver is shortened to only include * <code>remaining</code> lines after the split. * * @param remaining the number of lines to remain in the receiver, must be in [1, {@link #length() length}) * @return the split off range * @throws LineIndexOutOfBoundsException if <code>remaining</code>>= {@link #length()} or <code>remaining</code><t;= 0 */ public Range split(int remaining) throws LineIndexOutOfBoundsException { if (!(remaining < length())) // assert before modification throw new LineIndexOutOfBoundsException("Remaining must be less than length: " + length()); //$NON-NLS-1$ int splitLength= length() - remaining; setLength(remaining); return new Range(end(), splitLength); }
/** * Splits a range off the end of the receiver. The receiver is shortened to only include * <code>remaining</code> lines after the split. * * @param remaining the number of lines to remain in the receiver, must be in [1, {@link #length() length}) * @return the split off range * @throws LineIndexOutOfBoundsException if <code>remaining</code>>= {@link #length()} or <code>remaining</code><t;= 0 */ public Range split(int remaining) throws LineIndexOutOfBoundsException { if (!(remaining < length())) // assert before modification throw new LineIndexOutOfBoundsException("Remaining must be less than length: " + length()); //$NON-NLS-1$ int splitLength= length() - remaining; setLength(remaining); return new Range(end(), splitLength); }