java.lang.Object
org.rumbledb.runtime.functions.base.formatting.language.EnglishFormatter
All Implemented Interfaces:
LanguageFormatter

public class EnglishFormatter extends Object implements LanguageFormatter
  • Constructor Details

    • EnglishFormatter

      public EnglishFormatter()
  • Method Details

    • getLanguage

      public String getLanguage()
      Description copied from interface: LanguageFormatter
      Returns the language identifier handled by this formatter, for example "en".
      Specified by:
      getLanguage in interface LanguageFormatter
    • supportsOrdinalSuffix

      public boolean supportsOrdinalSuffix()
      Description copied from interface: LanguageFormatter
      Indicates whether the language supports suffix-based ordinal formatting.

      Examples: English: true Languages without productive ordinal suffixes: false

      Specified by:
      supportsOrdinalSuffix in interface LanguageFormatter
    • ordinalSuffix

      public String ordinalSuffix(BigInteger value)
      Description copied from interface: LanguageFormatter
      Returns the ordinal suffix for the given non-negative integer, if the language supports one.

      Examples in English: 1 -> "st", 2 -> "nd", 11 -> "th".

      If the language does not support ordinal suffixes, implementations may return the empty string, but callers should normally consult LanguageFormatter.supportsOrdinalSuffix() first.

      Specified by:
      ordinalSuffix in interface LanguageFormatter
    • toCardinal

      public String toCardinal(int value)
      Description copied from interface: LanguageFormatter
      Returns the cardinal word representation of a non-negative integer.

      Examples in English: 0 -> "zero", 15 -> "fifteen", 42 -> "forty-two".

      The implementation should support at least the full non-negative Java int range.

      Specified by:
      toCardinal in interface LanguageFormatter
    • toOrdinal

      public String toOrdinal(int value)
      Description copied from interface: LanguageFormatter
      Returns the ordinal word representation of a non-negative integer.

      Examples in English: 1 -> "first", 15 -> "fifteenth", 42 -> "forty-second".

      The implementation should support at least the full non-negative Java int range.

      Specified by:
      toOrdinal in interface LanguageFormatter
    • dayAbbreviation

      public String dayAbbreviation(DayOfWeek day, int maxWidth)
      Description copied from interface: LanguageFormatter
      Returns an abbreviated weekday name suitable for width-constrained rendering.

      The meaning of maxWidth is language-specific but should be interpreted as the maximum desired character width for the abbreviation when possible.

      Examples in English: Monday -> "Mon", Tuesday -> "Tue" or "Tues" depending on width.

      Specified by:
      dayAbbreviation in interface LanguageFormatter
    • monthAbbreviation

      public String monthAbbreviation(Month month)
      Description copied from interface: LanguageFormatter
      Returns an abbreviated month name.

      Examples in English: January -> "Jan", September -> "Sep".

      Specified by:
      monthAbbreviation in interface LanguageFormatter
    • dayName

      public String dayName(DayOfWeek day)
      Description copied from interface: LanguageFormatter
      Returns the full weekday name.

      Example in English: Monday -> "Monday".

      Specified by:
      dayName in interface LanguageFormatter
    • dayName

      public String dayName(DayOfWeek day, int minWidth, int maxWidth)
      Description copied from interface: LanguageFormatter
      Returns a weekday name adapted to the given width constraints.

      If no width was explicitly requested by the caller, maxWidth may be negative. In that case, implementations should generally return the default full weekday name.

      When a width constraint is present, implementations may choose either a full or abbreviated form as long as it fits the requested width in a deterministic and language-appropriate way.

      Specified by:
      dayName in interface LanguageFormatter
    • monthName

      public String monthName(Month month)
      Description copied from interface: LanguageFormatter
      Returns the full month name.

      Example in English: January -> "January".

      Specified by:
      monthName in interface LanguageFormatter
    • monthName

      public String monthName(Month month, int minWidth, int maxWidth)
      Description copied from interface: LanguageFormatter
      Returns a month name adapted to the given width constraints.

      If no width was explicitly requested by the caller, maxWidth may be negative. In that case, implementations should generally return the default full month name.

      When a width constraint is present, implementations may choose either a full or abbreviated form as long as it fits the requested width in a deterministic and language-appropriate way.

      Specified by:
      monthName in interface LanguageFormatter
    • toEnglishCardinalWords

      public static String toEnglishCardinalWords(int value)
    • toEnglishOrdinalWords

      public static String toEnglishOrdinalWords(int value)