docs(docstrings): add docstrings to public method interfaces (#25)
- Resolves #18 Reviewed-on: #25
This commit was merged in pull request #25.
This commit is contained in:
@@ -10,6 +10,11 @@ public class CommandOutput {
|
||||
private List<String> output = new ArrayList<>();
|
||||
private int exitCode;
|
||||
|
||||
/**
|
||||
* Appends a line to the captured command output.
|
||||
*
|
||||
* @param line the output line to append
|
||||
*/
|
||||
public void addLine(String line) {
|
||||
output.add(line);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,30 @@ public class ProgressTracker {
|
||||
private float progress = 0.0f;
|
||||
private boolean isComplete = false;
|
||||
|
||||
/**
|
||||
* Returns the current progress.
|
||||
*
|
||||
* @return the progress as a fraction in {@code [0, 1]}
|
||||
*/
|
||||
public synchronized float getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the tracked task has been marked complete.
|
||||
*
|
||||
* @return {@code true} if complete
|
||||
*/
|
||||
public synchronized boolean isComplete() {
|
||||
return isComplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the current progress.
|
||||
*
|
||||
* @param newProgress the progress as a fraction in {@code [0, 1]}
|
||||
* @throws IllegalArgumentException if {@code newProgress} is outside {@code [0, 1]}
|
||||
*/
|
||||
public synchronized void setProgress(float newProgress) {
|
||||
if (newProgress < 0 || newProgress > 1) {
|
||||
throw new IllegalArgumentException("Progress must be between 0 and 1");
|
||||
@@ -19,10 +35,16 @@ public class ProgressTracker {
|
||||
this.progress = newProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the tracked task as complete.
|
||||
*/
|
||||
public synchronized void markComplete() {
|
||||
this.isComplete = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets progress to zero and clears the complete flag.
|
||||
*/
|
||||
public synchronized void reset() {
|
||||
this.progress = 0.0f;
|
||||
this.isComplete = false;
|
||||
|
||||
Reference in New Issue
Block a user