Class Format

java.lang.Object
us.ajg0702.leaderboards.formatting.Format
Direct Known Subclasses:
ColonTime, Default, Time

public abstract class Format extends Object
  • Constructor Details

    • Format

      public Format()
  • Method Details

    • matches

      public abstract boolean matches(@Nullable @Nullable String output, String placeholder)
      Tests if the provided placeholder (and possibly output) is readable with this format
      Parameters:
      output - The string output from the placeholder
      placeholder - the placeholder without %
      Returns:
      True if this format supports parsing the output, false if it doesn't, or we're not sure
    • toDouble

      public abstract double toDouble(String input) throws NumberFormatException
      Converts the provided input to a double using this format
      Parameters:
      input - The string output from the placeholder
      Returns:
      A double representing the string format
      Throws:
      NumberFormatException - if the input does not match the format, or some other issue occurred with parsing
    • toFormat

      public abstract String toFormat(double input)
      Converts a double into this format
      Parameters:
      input - The provided double
      Returns:
      A string that is the provided double in this format
    • getName

      public abstract String getName()
      Returns:
      the (unique) name of this format