Class ProgressBar

java.lang.Object
com.helixframework.console.progress.ProgressBar

public class ProgressBar extends Object
The ProgressBar class represents a customizable textual progress bar that can be used to visually display the progress of a process or task. The progress bar supports customization options such as the length of the bar, the characters used to represent completed and incomplete portions, and an optional label. It can be updated dynamically and display progress information in real time to the console. Features: - Adjustable bar length. - Customizable characters for progress and empty spaces. - Optional label and progress text. - Real-time updates and resets. Use the nested Builder class to create and configure instances of ProgressBar.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Builder class for creating and configuring instances of ProgressBar.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new instance of the Builder class for configuring and constructing a ProgressBar instance.
    void
    Resets the progress bar to its initial state.
     
    void
    update(int progress)
    Updates the progress displayed by the progress bar to the specified value.
    void
    update(int progress, String progressText)
    Updates the progress bar with the specified progress value and optional progress text.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • builder

      public static ProgressBar.Builder builder()
      Creates a new instance of the Builder class for configuring and constructing a ProgressBar instance.
      Returns:
      a new Builder instance for creating a ProgressBar
    • update

      public void update(int progress)
      Updates the progress displayed by the progress bar to the specified value.
      Parameters:
      progress - the new progress value, typically represented as a percentage between 0 and 100.
    • update

      public void update(int progress, String progressText)
      Updates the progress bar with the specified progress value and optional progress text.
      Parameters:
      progress - the new progress value, typically represented as a percentage between 0 and 100.
      progressText - the text to display alongside the progress value, or null if no text is desired.
    • reset

      public void reset()
      Resets the progress bar to its initial state. Sets the progress value back to 0, effectively displaying an empty progress bar.
    • toString

      public String toString()
      Overrides:
      toString in class Object