public class ProgressBar
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.time.ZonedDateTime |
creationTime |
protected double |
currentRecord |
protected java.time.ZonedDateTime |
lastUpdate |
protected double |
progress |
protected java.util.List<ProgressBar> |
progressBars |
protected ScrapingSession |
session |
protected double |
totalRecords |
Constructor and Description |
---|
ProgressBar(java.util.List<ProgressBar> progressBarList,
ScrapingSession session)
Perform the basic initialization.
|
ProgressBar(java.lang.String title,
java.util.List<ProgressBar> progressBarList,
ScrapingSession session)
Perform the basic initialization
|
Modifier and Type | Method and Description |
---|---|
void |
add(double amount)
Adds the amount specified to the current progress number
|
java.time.ZonedDateTime |
getCreationTime()
Returns the time, in milliseconds, this progress bar was created
|
double |
getCurrent()
Gets the current progress number
|
int |
getIndex()
Returns the index of this progress bar in the list of progress bars
|
java.lang.String[] |
getLogDisplay()
Gets Strings to output to the log to show the progress of this progress bar
|
double |
getPercent()
Returns the current percentage completion of this progress bar
|
long |
getRemainingTime()
Estimates the remaining time in nanoseconds until this progress bar reaches completion.
|
java.lang.String |
getTitle()
Returns the current title of the progress bar
|
double |
getTotal()
Gets the total progress number
|
java.lang.String |
getWebDisplay()
Gets the HTML required to display this progress bar
|
void |
setCreationTime(java.time.ZonedDateTime timestamp)
Sets the creation time (so a progress bar can be adjusted in expected duration)
|
void |
setCurrent(double current)
Sets the current number in the progress
|
void |
setCurrent(java.lang.String current)
Sets the current number in the progress
|
void |
setPercent(double percent)
Sets the progress of the scrape as a percentage.
|
void |
setProgress(double current)
Sets the current number in the progress
|
void |
setProgress(double current,
double total)
Sets the current progress and total counts
|
void |
setTitle(java.lang.String titleString)
Sets the title of this progress bar
|
void |
setTotal(double total)
Sets the total for this progress bar
|
void |
setTotal(java.lang.String total)
Sets the total for this progress bar
|
void |
updateProgress()
Updates the current progress of this bar and all it's parents (since progress on a parent is affected by it's children).
|
@NotNull protected java.time.ZonedDateTime creationTime
protected double progress
protected double currentRecord
protected double totalRecords
protected java.time.ZonedDateTime lastUpdate
@Nullable protected java.util.List<ProgressBar> progressBars
@Nullable protected final ScrapingSession session
public ProgressBar(java.util.List<ProgressBar> progressBarList, @Nullable ScrapingSession session)
progressBarList
- The list of progress bars this belongs tosession
- The scraping session the progress bar is a part of, or null for none/unknownpublic ProgressBar(@Nullable java.lang.String title, @Nullable java.util.List<ProgressBar> progressBarList, @Nullable ScrapingSession session)
title
- The Title of the progress barprogressBarList
- The list of progress bars this belongs tosession
- The scraping session the progress bar is a part of, or null for none/unknownpublic void setCreationTime(@NotNull java.time.ZonedDateTime timestamp)
timestamp
- The timestamp to use as the creation timepublic void setTotal(@NotNull java.lang.String total) throws java.lang.NumberFormatException
total
- Number at which this bar should indicate 100 percent completionjava.lang.NumberFormatException
- The string wasn't parseable as a numberpublic void setTotal(double total)
total
- Number at which this bar should indicate 100 percent completionpublic void setPercent(double percent)
percent
- The percent, as a number from 0 to 100public void setCurrent(@NotNull java.lang.String current) throws java.lang.NumberFormatException
current
- The current numberjava.lang.NumberFormatException
- If the string wasn't parseable as an integerpublic void setCurrent(double current)
current
- The current numberpublic void setProgress(double current)
current
- The current numberpublic void setProgress(double current, double total)
current
- The current numbertotal
- The total numberpublic void add(double amount)
amount
- Amount to add to the current progresspublic double getPercent()
public void setTitle(@Nullable java.lang.String titleString)
titleString
- The new title for the progress bar@Nullable public java.lang.String getTitle()
public double getCurrent()
public double getTotal()
public void updateProgress()
public int getIndex()
public long getRemainingTime()
@NotNull public java.time.ZonedDateTime getCreationTime()
public java.lang.String getWebDisplay()
public java.lang.String[] getLogDisplay()