Class MessageFmt.ChoiceArgumentSegment.Option

java.lang.Object
org.dellroad.stuff.text.MessageFmt.ChoiceArgumentSegment.Option
Enclosing class:
MessageFmt.ChoiceArgumentSegment

public static class MessageFmt.ChoiceArgumentSegment.Option extends Object
Represents one option in a MessageFmt.ChoiceArgumentSegment.

An option is chosen if the number to be formatted is no less than getLimit() and also strictly less than the next option's limit (if any).

  • Constructor Details

    • Option

      public Option()
    • Option

      public Option(double limit, MessageFmt format)
  • Method Details

    • getLimit

      public double getLimit()
      Get the limit for this MessageFmt.ChoiceArgumentSegment option.
      Returns:
      argument upper bound (inclusive) for this option
    • setLimit

      public void setLimit(double limit)
    • getLimitDescription

      public String getLimitDescription()
      Get the limit for this MessageFmt.ChoiceArgumentSegment option in string form.

      This property is just an alternative view of getLimit() that uses the ChoiceFormat string syntax, which includes a trailing "<" or "#" character.

      For example, a limit of 1.0 is described as "1.0#" while a limit of ChoiceFormat.nextDouble(1.0) is described as "1.0<".

      Returns:
      argument upper bound (inclusive) for this option
    • setLimitDescription

      public void setLimitDescription(String limitDescription)
      Set the limit for this MessageFmt.ChoiceArgumentSegment option in string form.

      If there is no trailing "<" or "#" character, then "#" is assumed.

      Parameters:
      limitDescription - string description of limit
    • getFormat

      @NotNull @Valid public @NotNull @Valid MessageFmt getFormat()
      Get the MessageFmt for this MessageFmt.ChoiceArgumentSegment option.

      Note: whereas the options in a ChoiceFormat are format strings, in the context of a MessageFormat a choice-formatted argument format string is interpreted as a nested MessageFormat pattern, therefore this property has type MessageFmt instead of String.

      Returns:
      the MessageFmt for this option
    • setFormat

      public void setFormat(MessageFmt format)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object