]> source.dussan.org Git - jgit.git/commitdiff
Provide access to the Refs of a PlotCommit 37/2337/2
authorRoberto Tyley <roberto.tyley@guardian.co.uk>
Wed, 26 Jan 2011 13:25:10 +0000 (13:25 +0000)
committerChris Aniszczyk <caniszczyk@gmail.com>
Thu, 27 Jan 2011 04:03:41 +0000 (22:03 -0600)
This information is generally useful - have followed the
accessor pattern of 'children' and 'parents'

Change-Id: I79b3ddd6f390152aa49e6b7a4c72a4aca0d6bc72
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java

index dc9e0321f53c269d5683c52a2e4c02d86d55b612..1e22416f2429a12d5a2c4c1a4ff0e1e16bb0ba04 100644 (file)
@@ -144,6 +144,29 @@ public class PlotCommit<L extends PlotLane> extends RevCommit {
                return false;
        }
 
+       /**
+        * Get the number of refs for this commit.
+        *
+        * @return number of refs; always a positive value but can be 0.
+        */
+       public final int getRefCount() {
+               return refs.length;
+       }
+
+       /**
+        * Get the nth Ref from this commit's ref list.
+        *
+        * @param nth
+        *            ref index to obtain. Must be in the range 0 through
+        *            {@link #getRefCount()}-1.
+        * @return the specified ref.
+        * @throws ArrayIndexOutOfBoundsException
+        *             an invalid ref index was specified.
+        */
+       public final Ref getRef(final int nth) {
+               return refs[nth];
+       }
+
        /**
         * Obtain the lane this commit has been plotted into.
         *