com.brightcove.player.model

## Class Length

- java.lang.Object
- - com.brightcove.player.model.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 and 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 and 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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)`
    `StyledElement.Unit` | `getUnit()` The `StyledElement.Unit` of this Length.
    `double` | `getValue()` The numeric value of this Length.
    `int` | `hashCode()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

    - #### unit

          protected StyledElement.Unit unit

  - ### 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

    - #### getUnit

          public StyledElement.Unit getUnit()

      The `StyledElement.Unit` of this Length.
      Returns:
        the unit

    - #### 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`