com.groupdocs.editor.htmlcss.css.datatypes

Class Ratio

  • java.lang.Object
    • com.aspose.ms.System.ValueType<T>
      • com.aspose.ms.lang.Struct<Ratio>
        • com.groupdocs.editor.htmlcss.css.datatypes.Ratio
  • All Implemented Interfaces:
    com.aspose.ms.System.ICloneable, com.aspose.ms.System.IEquatable<com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType>, com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType


    public class Ratio
    extends com.aspose.ms.lang.Struct<Ratio>
    implements com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType, com.aspose.ms.System.ICloneable

    Represents a "ratio" CSS data type, which is used for describing aspect ratios in media queries and for raster images by denoting the proportion between two unitless values called "numerator" and "denominator". Immutable struct.


    https://developer.mozilla.org/en-US/docs/Web/CSS/ratio

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static Ratio SINGLE
      Single default ratio 1/1
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      double calculate()
      Calculates and returns this ratio as a single floating point number
      static Ratio create(int numerator, int denominator)
      Creates and returns one Ratio instance from specified numerator and denominator
      Ratio deepClone()
      Returns a full copy of this ratio
      boolean equals(com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType other) 
      boolean equals(Object other)
      Determines whether this instance is equal with specified uncasted object, which presumably is another "Ratio" instance
      boolean equals(Ratio other)
      Determines whether this instance is equal with specified "Ratio" instance
      int getDenominator()
      Returns a denominator of this ratio
      Ratio getInverseRatio()
      Generates and returns an inversed (reciprocal) ratio for this ratio
      int getNumerator()
      Returns a numerator of this ratio
      int hashCode()
      Returns a hashcode for this instance, which cannot be changed during its lifetime
      boolean isDefault()
      Determines whether this ratio has default value or is a "1/1" (Single)
      static boolean op_Equality(Ratio left, Ratio right)
      Compares two ratios and returns a boolean indicating if the two do match.
      static boolean op_Inequality(Ratio left, Ratio right)
      Compares two ratios and returns a boolean indicating if the two do not match.
      String serializeDefault()
      Serializes this ratio to the string and returns it
      String toString()
      Returns a string representation of this ratio; same as "SerializeDefault()"
      • Methods inherited from class com.aspose.ms.System.ValueType

        Clone, CloneTo
    • Field Detail

      • SINGLE

        public static final Ratio SINGLE

        Single default ratio 1/1

    • Method Detail

      • calculate

        public double calculate()

        Calculates and returns this ratio as a single floating point number

        Returns:
      • create

        public static Ratio create(int numerator,
                   int denominator)

        Creates and returns one Ratio instance from specified numerator and denominator

        Parameters:
        numerator - Numerator for the ratio. Should be a strictly positive integer number.
        denominator - Denominator for the ratio. Should be a strictly positive integer number.
        Returns:
      • deepClone

        public Ratio deepClone()

        Returns a full copy of this ratio

        Specified by:
        deepClone in interface com.aspose.ms.System.ICloneable
        Returns:
      • equals

        public boolean equals(com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType other)
      • equals

        public boolean equals(Object other)

        Determines whether this instance is equal with specified uncasted object, which presumably is another "Ratio" instance

        Specified by:
        equals in interface com.aspose.ms.System.IEquatable<com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType>
        Overrides:
        equals in class Object
        Parameters:
        other - Object
      • equals

        public boolean equals(Ratio other)

        Determines whether this instance is equal with specified "Ratio" instance

        Parameters:
        other - Ratio
      • getDenominator

        public int getDenominator()

        Returns a denominator of this ratio

      • getInverseRatio

        public Ratio getInverseRatio()

        Generates and returns an inversed (reciprocal) ratio for this ratio

        Returns:
      • getNumerator

        public int getNumerator()

        Returns a numerator of this ratio

      • hashCode

        public int hashCode()

        Returns a hashcode for this instance, which cannot be changed during its lifetime

        Overrides:
        hashCode in class Object
        Returns:
      • isDefault

        public boolean isDefault()

        Determines whether this ratio has default value or is a "1/1" (Single)

        Specified by:
        isDefault in interface com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType
      • op_Equality

        public static boolean op_Equality(Ratio left,
                          Ratio right)

        Compares two ratios and returns a boolean indicating if the two do match.

        Parameters:
        left - The first ratio to use.
        right - The second ratio to use.
        Returns:
        True if both ratios are equal, otherwise false.
      • op_Inequality

        public static boolean op_Inequality(Ratio left,
                            Ratio right)

        Compares two ratios and returns a boolean indicating if the two do not match.

        Parameters:
        left - The first ratio to use.
        right - The second ratio to use.
        Returns:
        True if both ratios are not equal, otherwise false.
      • serializeDefault

        public String serializeDefault()

        Serializes this ratio to the string and returns it

        Specified by:
        serializeDefault in interface com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType
        Returns:
      • toString

        public String toString()

        Returns a string representation of this ratio; same as "SerializeDefault()"

        Overrides:
        toString in class Object
        Returns: