Class Ratio

    • Field Detail

      • numerator

        public final float numerator
      • denominator

        public final float denominator
      • PC_ROUND_DOWN_FORMAT

        public static final NumberFormat PC_ROUND_DOWN_FORMAT
      • PC_ROUND_UP_FORMAT

        public static final NumberFormat PC_ROUND_UP_FORMAT
    • Method Detail

      • toString

        public String toString()
        Gets "x/y" representation.
        Overrides:
        toString in class Object
        Returns:
        String in "x/y" format
      • getPercentage1d

        public String getPercentage1d()
        Gets the percentage in integer.
        Returns:
        String percentage
      • getPercentageStr

        public String getPercentageStr()
      • getPercentage

        public int getPercentage()
        Gets the percentage in integer.
        Returns:
        int percentage
      • getPercentageFloat

        public float getPercentageFloat()
        Gets the percentage in float.
        Returns:
        float percentage
      • hashCode

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

        public static Ratio create​(float x,
                                   float y)
        Creates a new instance of Ratio.
        Parameters:
        x - nominator
        y - denominator
        Returns:
        Ratio