diff options
author | Shawn O. Pearce <sop@google.com> | 2009-06-16 08:07:29 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-06-16 08:07:29 -0700 |
commit | 528ca23dd3c2bb5338d5d64fd53c50e19acb2775 (patch) | |
tree | 3b1ecb1d7c4810490f47993ed1d684a25887693f | |
parent | 93599bb8be7f2da9c8db562eea4083cc0ffa5aea (diff) |
Add toString debugging aids to SparseFileContent
These methods help inspect the object state from within an IDE debugger,
as its shows the more interesting portion, which is the range of lines
the content object covers.
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | src/main/java/com/google/gerrit/client/data/SparseFileContent.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/google/gerrit/client/data/SparseFileContent.java b/src/main/java/com/google/gerrit/client/data/SparseFileContent.java index 2f0974f455..d226127442 100644 --- a/src/main/java/com/google/gerrit/client/data/SparseFileContent.java +++ b/src/main/java/com/google/gerrit/client/data/SparseFileContent.java @@ -108,6 +108,19 @@ public class SparseFileContent { return ranges.get(ranges.size() - 1); } + @Override + public String toString() { + final StringBuilder b = new StringBuilder(); + b.append("SparseFileContent[\n"); + for (Range r : ranges) { + b.append(" "); + b.append(r.toString()); + b.append('\n'); + } + b.append("]"); + return b.toString(); + } + static class Range { protected int base; protected List<String> lines; @@ -131,5 +144,10 @@ public class SparseFileContent { private boolean contains(final int i) { return base <= i && i < end(); } + + @Override + public String toString() { + return "Range[" + base + "," + end() + ")"; + } } } |