Class Statistic

java.lang.Object
net.storm.sdk.script.paint.Statistic

public final class Statistic extends Object
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 Details

    • Statistic

      public Statistic(String key, boolean header, Supplier<String> supplier)
      Constructs a new Statistic with all parameters.
      Parameters:
      key - the key/label for this statistic
      header - whether this is a header entry
      supplier - the supplier for the statistic value
    • Statistic

      public Statistic(String key, Supplier<String> supplier)
      Constructs a new Statistic with a key and supplier.
      Parameters:
      key - the key/label for this statistic
      supplier - the supplier for the statistic value
    • Statistic

      public Statistic(String key, StopWatch timer, Supplier<Integer> rate, boolean format)
      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 statistic
      timer - the stopwatch used to calculate hourly rates
      rate - the supplier that provides the current numeric value
      format - whether to format numbers using NumericFormat
    • Statistic

      public Statistic(String key, StopWatch timer, Supplier<Integer> rate)
      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 statistic
      timer - the stopwatch used to calculate hourly rates
      rate - the supplier that provides the current numeric value
  • Method Details

    • empty

      public static Statistic 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:
      true if this is a header, false otherwise
    • getSupplier

      public Supplier<String> getSupplier()
      Gets the supplier for this statistic's value.
      Returns:
      the value supplier
    • toString

      public String toString()
      Returns the current value of this statistic as a string.
      Overrides:
      toString in class Object
      Returns:
      the current value from the supplier