From a79c2b225bb51a8653429b177ee94c0a9c592a76 Mon Sep 17 00:00:00 2001 From: Georg Seibt <seibt@fim.uni-passau.de> Date: Tue, 12 Apr 2016 15:54:19 +0200 Subject: [PATCH] doc --- .../fim/seibt/gitwrapper/repo/Commit.java | 21 +++++++++++++++++++ .../fim/seibt/gitwrapper/repo/Repository.java | 15 +++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java index d60edd2..166e9c8 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java @@ -11,6 +11,9 @@ import java.util.stream.Collectors; import de.uni_passau.fim.seibt.gitwrapper.repo.GitWrapper.ExecRes; +/** + * A {@link Commit} made in a {@link Repository}. + */ public class Commit { private static final Logger LOG = Logger.getLogger(Commit.class.getCanonicalName()); @@ -20,12 +23,25 @@ public class Commit { private String id; + /** + * Constructs a new {@link Commit} with the given <code>id</code> made in the <code>repo</code>. + * + * @param repo + * the {@link Repository} the {@link Commit} was made in + * @param id + * the ID of the {@link Commit} + */ Commit(Repository repo, String id) { this.git = repo.getGit(); this.repo = repo; this.id = id; } + /** + * Returns the parents of this {@link Commit}. + * + * @return the parent {@link Commit} objects + */ public List<Commit> getParents() { Optional<ExecRes> revList = git.exec(repo.getDir(), "rev-list", "--parents", "-n", "1", id); Function<ExecRes, List<Commit>> toParentsList = res -> { @@ -39,6 +55,11 @@ public class Commit { return revList.map(toParentsList).orElse(Collections.emptyList()); } + /** + * Returns the ID of this commit. + * + * @return the ID + */ public String getId() { return id; } diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java index c80fe49..0024c92 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java @@ -83,14 +83,29 @@ public class Repository { return commits.computeIfAbsent(id, theID -> new Commit(this, theID)); } + /** + * Returns the {@link GitWrapper} used by this {@link Repository}. + * + * @return the {@link GitWrapper} + */ public GitWrapper getGit() { return git; } + /** + * Returns the URL this {@link Repository} was cloned from. + * + * @return the URL + */ public String getUrl() { return url; } + /** + * Returns the directory containing this {@link Repository}. + * + * @return the repository directory + */ public File getDir() { return dir; } -- GitLab