comparison src/org/tmatesoft/hg/internal/RevisionDescendants.java @ 472:2a0b09eec376

Tests for issue 31
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 11 Jul 2012 21:46:28 +0200
parents 7bcfbc255f48
children 6526d8adbc0f
comparison
equal deleted inserted replaced
471:7bcfbc255f48 472:2a0b09eec376
93 public boolean hasDescendants() { // isEmpty is better name? 93 public boolean hasDescendants() { // isEmpty is better name?
94 // bit at rootRevIndex is always set 94 // bit at rootRevIndex is always set
95 return descendants.nextSetBit(rootRevIndex+1) != -1; 95 return descendants.nextSetBit(rootRevIndex+1) != -1;
96 } 96 }
97 97
98 /**
99 * Tells whether specified revision is on a descent line from the root revision.
100 * <p>NOTE, root revision itself is considered to be its own descendant.
101 *
102 * @param revisionIndex revision index to check, shall pass {@link #isCandidate(int)}
103 * @return <code>true</code> if revision is descendant of or is the same as root revision
104 */
98 public boolean isDescendant(int revisionIndex) { 105 public boolean isDescendant(int revisionIndex) {
99 assert isCandidate(revisionIndex); 106 assert isCandidate(revisionIndex);
100 int ix = revisionIndex - rootRevIndex; 107 int ix = revisionIndex - rootRevIndex;
101 assert ix < descendants.size(); 108 assert ix < descendants.size();
102 return descendants.get(ix); 109 return descendants.get(ix);