Class Length

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    LengthVtt

    public class Length
    extends java.lang.Object
    implements java.io.Serializable
    Provides the representation of varying forms of length measure per the TTML specification.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.regex.Pattern PATTERN  
      static java.lang.String TAG  
      protected StyledElement.Unit unit  
      protected java.lang.Double value  
    • Constructor Summary

      Constructors 
      Constructor Description
      Length​(double value, StyledElement.Unit unit)
      Initializes a Length object using the given numeric value and Unit specification.
      Length​(java.lang.String expression)
      Initializes a Length object by parsing the given expression.
    • Field Detail

      • TAG

        public static final java.lang.String TAG
      • PATTERN

        public static final java.util.regex.Pattern PATTERN
      • value

        protected java.lang.Double value
    • Constructor Detail

      • Length

        public Length​(java.lang.String expression)
        Initializes a Length object by parsing the given expression. Valid expressions are those that include a decimal numeric value followed by one of the recognized unit suffixes:
        • %
        • px
        • ems
        Examples:
        • 4.5%
        • 200px
        • 22ems
        Parameters:
        expression - the string expression to parse
        See Also:
        http://www.w3.org/TR/ttaf1-dfxp/#style-value-length
      • Length

        public Length​(double value,
                      StyledElement.Unit unit)
        Initializes a Length object using the given numeric value and Unit specification.
        Parameters:
        value - the numeric value of the length
        unit - the units for the length value
    • Method Detail

      • getValue

        public double getValue()
        The numeric value of this Length.
        Returns:
        the double value
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object