((LineMapImpl) cu.getLineMap()).build(chars, chars.length); LOGGER.log(Level.FINER, "Rebuilding LineMap took: {0}", System.currentTimeMillis() - startM);
protected void build(char[] src, int max) { int c = 0; int i = 0; int[] linebuf = new int[max]; while (i < max) { linebuf[c++] = i; do { char ch = src[i]; if (ch == '\r' || ch == '\n') { if (ch == '\r' && (i+1) < max && src[i+1] == '\n') i += 2; else ++i; break; } else if (ch == '\t') setTabPosition(i); } while (++i < max); } this.startPosition = new int[c]; System.arraycopy(linebuf, 0, startPosition, 0, c); }
protected void build(char[] src, int max) { int c = 0; int i = 0; int[] linebuf = new int[max]; while (i < max) { linebuf[c++] = i; do { char ch = src[i]; if (ch == '\r' || ch == '\n') { if (ch == '\r' && (i+1) < max && src[i+1] == '\n') i += 2; else ++i; break; } else if (ch == '\t') setTabPosition(i); } while (++i < max); } this.startPosition = new int[c]; System.arraycopy(linebuf, 0, startPosition, 0, c); }
protected void build(char[] src, int max) { int c = 0; int i = 0; int[] linebuf = new int[max]; while (i < max) { linebuf[c++] = i; do { char ch = src[i]; if (ch == '\r' || ch == '\n') { if (ch == '\r' && (i+1) < max && src[i+1] == '\n') i += 2; else ++i; break; } else if (ch == '\t') setTabPosition(i); } while (++i < max); } this.startPosition = new int[c]; System.arraycopy(linebuf, 0, startPosition, 0, c); }
protected void build(char[] src, int max) { int c = 0; int i = 0; int[] linebuf = new int[max]; while (i < max) { linebuf[c++] = i; do { char ch = src[i]; if (ch == '\r' || ch == '\n') { if (ch == '\r' && (i+1) < max && src[i+1] == '\n') i += 2; else ++i; break; } else if (ch == '\t') setTabPosition(i); } while (++i < max); } this.startPosition = new int[c]; System.arraycopy(linebuf, 0, startPosition, 0, c); }
/** A two-way map between line/column numbers and positions, * derived from a scan done at creation time. Tab expansion is * optionally supported via a character map. Text content * is not retained. *<p> * Notes: The first character position FIRSTPOS is at * (FIRSTLINE,FIRSTCOLUMN). No account is taken of Unicode escapes. * * @param src Source characters * @param max Number of characters to read * @param expandTabs If true, expand tabs when calculating columns */ public static LineMap makeLineMap(char[] src, int max, boolean expandTabs) { LineMapImpl lineMap = expandTabs ? new LineTabMapImpl(max) : new LineMapImpl(); lineMap.build(src, max); return lineMap; }
/** A two-way map between line/column numbers and positions, * derived from a scan done at creation time. Tab expansion is * optionally supported via a character map. Text content * is not retained. *<p> * Notes: The first character position FIRSTPOS is at * (FIRSTLINE,FIRSTCOLUMN). No account is taken of Unicode escapes. * * @param src Source characters * @param max Number of characters to read * @param expandTabs If true, expand tabs when calculating columns */ public static LineMap makeLineMap(char[] src, int max, boolean expandTabs) { LineMapImpl lineMap = expandTabs ? new LineTabMapImpl(max) : new LineMapImpl(); lineMap.build(src, max); return lineMap; }
/** A two-way map between line/column numbers and positions, * derived from a scan done at creation time. Tab expansion is * optionally supported via a character map. Text content * is not retained. *<p> * Notes: The first character position FIRSTPOS is at * (FIRSTLINE,FIRSTCOLUMN). No account is taken of Unicode escapes. * * @param src Source characters * @param max Number of characters to read * @param expandTabs If true, expand tabs when calculating columns */ public static LineMap makeLineMap(char[] src, int max, boolean expandTabs) { LineMapImpl lineMap = expandTabs ? new LineTabMapImpl(max) : new LineMapImpl(); lineMap.build(src, max); return lineMap; }
/** A two-way map between line/column numbers and positions, * derived from a scan done at creation time. Tab expansion is * optionally supported via a character map. Text content * is not retained. *<p> * Notes: The first character position FIRSTPOS is at * (FIRSTLINE,FIRSTCOLUMN). No account is taken of Unicode escapes. * * @param src Source characters * @param max Number of characters to read * @param expandTabs If true, expand tabs when calculating columns */ public static LineMap makeLineMap(char[] src, int max, boolean expandTabs) { LineMapImpl lineMap = expandTabs ? new LineTabMapImpl(max) : new LineMapImpl(); lineMap.build(src, max); return lineMap; }
public long getStartPosition(long line) { return getStartPosition(longToInt(line)); }
public long getPosition(long line, long column) { return getPosition(longToInt(line), longToInt(column)); }
public int getColumnNumber(int pos) { return pos - startPosition[getLineNumber(pos) - FIRSTLINE] + FIRSTCOLUMN; }
public int getColumnNumber(int pos) { return pos - startPosition[getLineNumber(pos) - FIRSTLINE] + FIRSTCOLUMN; }
public long getColumnNumber(long pos) { return getColumnNumber(longToInt(pos)); }
public long getPosition(long line, long column) { return getPosition(longToInt(line), longToInt(column)); }
public long getPosition(long line, long column) { return getPosition(longToInt(line), longToInt(column)); }
public long getStartPosition(long line) { return getStartPosition(longToInt(line)); }
public long getColumnNumber(long pos) { return getColumnNumber(longToInt(pos)); }
public long getLineNumber(long pos) { return getLineNumber(longToInt(pos)); }
public long getPosition(long line, long column) { return getPosition(longToInt(line), longToInt(column)); }