Class DetectedLanguage

  • All Implemented Interfaces:
    java.lang.Comparable<DetectedLanguage>

    public class DetectedLanguage
    extends java.lang.Object
    implements java.lang.Comparable<DetectedLanguage>
    Holds information about a detected language: the locale (language) and the probability.

    Comparable: the "better" one comes before the worse. First order by probability descending (1 to 0). Then order by language ascending (a to z).

    This class is immutable.

    • Field Detail

      • locale

        @NotNull
        private final @NotNull LdLocale locale
      • probability

        private final double probability
    • Constructor Detail

      • DetectedLanguage

        public DetectedLanguage​(@NotNull
                                @NotNull LdLocale locale,
                                double probability)
        Parameters:
        locale -
        probability - 0-1
    • Method Detail

      • getLocale

        @NotNull
        public @NotNull LdLocale getLocale()
      • getProbability

        public double getProbability()
        Returns:
        0-1, the higher the better.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object