/** * Adds a line index to the end of <code>linesArray</code>. Increases the * size of the array if necessary and returns a new array. * <p> * * @param start * the start of the line * @param length * the length of the line * @param linesArray * the array to which to add the line index * @param count * the position at which to add the line * @return a new array of line indexes */ int[][] addLineIndex(int start, int length, int[][] linesArray, int count) { int size = linesArray.length; int[][] newLines = linesArray; if (count == size) { newLines = new int[size + Compatibility.pow2(this.replaceExpandExp)][2]; this.replaceExpandExp++; System.arraycopy(linesArray, 0, newLines, 0, size); } int[] range = new int[] { start, length }; newLines[count] = range; return newLines; }
/** * Adds a line to the end of the line indexes array. Increases the size of * the array if necessary. <code>lineCount</code> is updated to reflect the * new entry. * <p> * * @param start * the start of the line * @param length * the length of the line */ void addLineIndex(int start, int length) { int size = this.lines.length; if (this.lineCount == size) { // expand the lines by powers of 2 int[][] newLines = new int[size + Compatibility.pow2(this.expandExp)][2]; System.arraycopy(this.lines, 0, newLines, 0, size); this.lines = newLines; this.expandExp++; } int[] range = new int[] { start, length }; this.lines[this.lineCount] = range; this.lineCount++; }
/** * Adds a line to the end of the line indexes array. Increases the size of * the array if necessary. <code>lineCount</code> is updated to reflect the * new entry. * <p> * * @param start * the start of the line * @param length * the length of the line */ void addLineIndex(int start, int length) { int size = this.lines.length; if (this.lineCount == size) { // expand the lines by powers of 2 int[][] newLines = new int[size + Compatibility.pow2(this.expandExp)][2]; System.arraycopy(this.lines, 0, newLines, 0, size); this.lines = newLines; this.expandExp++; } int[] range = new int[] { start, length }; this.lines[this.lineCount] = range; this.lineCount++; }
/** * Adds a line index to the end of <code>linesArray</code>. Increases the * size of the array if necessary and returns a new array. * <p> * * @param start * the start of the line * @param length * the length of the line * @param linesArray * the array to which to add the line index * @param count * the position at which to add the line * @return a new array of line indexes */ int[][] addLineIndex(int start, int length, int[][] linesArray, int count) { int size = linesArray.length; int[][] newLines = linesArray; if (count == size) { newLines = new int[size + Compatibility.pow2(this.replaceExpandExp)][2]; this.replaceExpandExp++; System.arraycopy(linesArray, 0, newLines, 0, size); } int[] range = new int[] { start, length }; newLines[count] = range; return newLines; }