Package net.storm.sdk.script.paint
Class Statistic
java.lang.Object
net.storm.sdk.script.paint.Statistic
Represents a single statistic entry for display in
DefaultPaint.
A statistic consists of a key (label) and a supplier that provides the current value. Statistics can be:
- Simple key-value pairs with a string supplier
- Rate-based statistics that show value and hourly rate
- Headers for organizing groups of statistics
- Empty separators for visual spacing
Rate-based statistics automatically format values using NumericFormat
and calculate hourly rates using a StopWatch.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Statistic with all parameters.Constructs a new Statistic with a key and supplier.Constructs a rate-based Statistic with automatic number formatting.Constructs a rate-based Statistic that displays value and hourly rate. -
Method Summary
-
Constructor Details
-
Statistic
Constructs a new Statistic with all parameters.- Parameters:
key- the key/label for this statisticheader- whether this is a header entrysupplier- the supplier for the statistic value
-
Statistic
Constructs a new Statistic with a key and supplier.- Parameters:
key- the key/label for this statisticsupplier- the supplier for the statistic value
-
Statistic
Constructs a rate-based Statistic that displays value and hourly rate.The display format is: "value (hourlyRate / hr)"
- Parameters:
key- the key/label for this statistictimer- the stopwatch used to calculate hourly ratesrate- the supplier that provides the current numeric valueformat- whether to format numbers usingNumericFormat
-
Statistic
Constructs a rate-based Statistic with automatic number formatting.The display format is: "value (hourlyRate / hr)" with formatted numbers.
- Parameters:
key- the key/label for this statistictimer- the stopwatch used to calculate hourly ratesrate- the supplier that provides the current numeric value
-
-
Method Details
-
empty
Creates an empty separator statistic.Empty statistics are rendered as blank rows for visual spacing.
- Returns:
- a new empty Statistic instance
-
isHeader
public boolean isHeader()Checks whether this statistic is a header entry.- Returns:
trueif this is a header,falseotherwise
-
getSupplier
Gets the supplier for this statistic's value.- Returns:
- the value supplier
-
toString
Returns the current value of this statistic as a string.
-