Add lineMap computer to RawParseUtils to index locations of line starts
commit3eaa9f1229c45fb51ddfc8cc7c1aa97f8ccac7c0
authorShawn O. Pearce <spearce@spearce.org>
Fri, 12 Dec 2008 02:46:10 +0000 (11 18:46 -0800)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sat, 13 Dec 2008 02:13:25 +0000 (13 03:13 +0100)
treeabf4c0717018b4b2fcaa9f85c91ba6997c01f229
parent578232c90d3bce9b1bc9fdd9e4a87d6c8ecd04cf
Add lineMap computer to RawParseUtils to index locations of line starts

Some algorithms like a diff or patch require efficient lookup of lines
within a source file, using a 1 based line number.  lineMap produces a
list of offsets within the file where each line starts, providing O(1)
lookup time to locate those positions.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.test/tst/org/spearce/jgit/util/IntListTest.java
org.spearce.jgit.test/tst/org/spearce/jgit/util/RawParseUtils_LineMapTest.java [copied from org.spearce.jgit/src/org/spearce/jgit/util/IntList.java with 50% similarity]
org.spearce.jgit/src/org/spearce/jgit/util/IntList.java
org.spearce.jgit/src/org/spearce/jgit/util/RawParseUtils.java