DefaultFadeImpl (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.union.impl

## Class DefaultFadeImpl

- java.lang.Object
- - tv.amwa.maj.union.impl.DefaultFadeImpl

- All Implemented Interfaces:
    Serializable, Cloneable, XMLSerializable, DefaultFade

      public class DefaultFadeImpl
      extends Object
      implements DefaultFade, XMLSerializable, Serializable, Cloneable

  Implementation of a default fade to be applied to source clips in a composition package that do not specify their own fade properties. The structure consists of the fade length, edit units to which the fade is specified and the fade type.

  It is useful to manage default fade properties together as they are either all present or all omitted from a CompositionPackage (conditional rule 1).

  See Also:
    `CompositionPackage.getDefaultFade()`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultFadeImpl()` Create a default fade value with its parameters initialised to basic values.
    `DefaultFadeImpl(long fadeLength, FadeType fadeType, Rational fadeEditUnit)` Create a default fade description.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendXMLChildren(Node parent)` Append extra child elements to the given parent node to serialize the value of an object to an XML fragment.
    `DefaultFade` | `clone()` Create a cloned copy of this default fade value.
    `boolean` | `equals(Object o)`
    `String` | `getComment()` Include a comment when serializing a value to XML.
    `Rational` | `getFadeEditUnit()` Returns the edit units used to specify the default fade length.
    `long` | `getFadeLength()` Returns the length of this default audio fade, measured in this fade's edit units.
    `FadeType` | `getFadeType()` Returns the type of this default audio fade.
    `int` | `hashCode()`
    `void` | `setFadeEditUnit(Rational fadeEditUnit)` Sets the edit units used to specify the default fade length
    `void` | `setFadeLength(long fadeLength)` Sets the length of this default audio fade, measured in this fade's edit unit.
    `void` | `setFadeType(FadeType fadeType)` Sets the type of this default audio fade.
    `String` | `toString()` Creates a pseudo-XML representation of this default fade value.

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultFadeImpl

          public DefaultFadeImpl(@LengthType
                                 long fadeLength,
                                 FadeType fadeType,
                                 Rational fadeEditUnit)
                          throws NullPointerException,
                                 BadLengthException

      Create a default fade description.

      Parameters:
        `fadeLength` - Specifies the default length of the audio fade-in and fade-out.
        `fadeType` - Specifies the default type of audio fade.
        `fadeEditUnit` - Specifies the edit units in which the default fade length is specified.
      Throws:
        `NullPointerException` - One or both of the given fade type and/or fade edit unit values is `null`.
        `BadLengthException` - The default fade length is negative.

    - #### DefaultFadeImpl

          public DefaultFadeImpl()

      Create a default fade value with its parameters initialised to basic values. These are a fade length of `0`, a fade type of FadeType.None and a fade edit unit of `0/1`.

  - ### Method Detail

    - #### getFadeEditUnit

          public Rational getFadeEditUnit()

      Description copied from interface: `DefaultFade`

      Returns the edit units used to specify the default fade length.

      Specified by:
        `getFadeEditUnit` in interface `DefaultFade`
      Returns:
        Edit units used to specify the fade length.

    - #### setFadeEditUnit

          public void setFadeEditUnit(Rational fadeEditUnit)
                               throws NullPointerException

      Description copied from interface: `DefaultFade`

      Sets the edit units used to specify the default fade length

      Specified by:
        `setFadeEditUnit` in interface `DefaultFade`
      Parameters:
        `fadeEditUnit` - Edit units used to specify the fade length.
      Throws:
        `NullPointerException` - The given edit units for the default fade length are `null`.

    - #### getFadeLength

          @LengthType
          public long getFadeLength()

      Description copied from interface: `DefaultFade`

      Returns the length of this default audio fade, measured in this fade's edit units.

      Specified by:
        `getFadeLength` in interface `DefaultFade`
      Returns:
        Length of the default audio fade.
      See Also:
        `DefaultFade.getFadeEditUnit()`

    - #### setFadeLength

          public void setFadeLength(@LengthType
                                    long fadeLength)
                             throws BadLengthException

      Description copied from interface: `DefaultFade`

      Sets the length of this default audio fade, measured in this fade's edit unit.

      Specified by:
        `setFadeLength` in interface `DefaultFade`
      Parameters:
        `fadeLength` - Length of the default audio fade.
      Throws:
        `BadLengthException` - Length of the default fade is negative.
      See Also:
        `DefaultFade.getFadeEditUnit()`, `DefaultFade.setFadeEditUnit(Rational)`

    - #### getFadeType

          public FadeType getFadeType()

      Description copied from interface: `DefaultFade`

      Returns the type of this default audio fade.

      Specified by:
        `getFadeType` in interface `DefaultFade`
      Returns:
        Type of this default audio fade.

    - #### setFadeType

          public void setFadeType(FadeType fadeType)
                           throws NullPointerException

      Description copied from interface: `DefaultFade`

      Sets the type of this default audio fade.

      Specified by:
        `setFadeType` in interface `DefaultFade`
      Parameters:
        `fadeType` - Type of this default audio fade.
      Throws:
        `NullPointerException` - The given fade type for the default fade is `null`.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### appendXMLChildren

          public void appendXMLChildren(Node parent)

      Description copied from interface: `XMLSerializable`

      Append extra child elements to the given parent node to serialize the value of an object to an XML fragment. Methods of the `XMLBuilder` class are provided to help with this process.

      Specified by:
        `appendXMLChildren` in interface `XMLSerializable`
      Parameters:
        `parent` - XML parent element to append child nodes to.

    - #### getComment

          public String getComment()

      Description copied from interface: `XMLSerializable`

      Include a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.

      Specified by:
        `getComment` in interface `XMLSerializable`
      Returns:
        Comment to add as the first child node of the element representing this class.

    - #### toString

          public String toString()

      Creates a pseudo-XML representation of this default fade value. The format is loosely based on the XML element representing a composition package but is not itself defined by an XML schema or DTD. For example:

           <DefaultFade>
             <DefaultFadeLength>1000</DefaultFadeLength>
             <DefaultFadeType>FadeLinearAmp</DefFadeType>
             <DefaultFadeEditUnit>25/1</DefFadeEditUnit>
           </DefaultFade>

      Overrides:
        `toString` in class `Object`
      Returns:
        XML representation of this default fade value.

    - #### clone

          public DefaultFade clone()

      Description copied from interface: `DefaultFade`

      Create a cloned copy of this default fade value.

      Specified by:
        `clone` in interface `DefaultFade`
      Overrides:
        `clone` in class `Object`
      Returns:
        Cloned copy of this default fade value.

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.