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

tv.amwa.maj.union.impl

## Class FadeImpl

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

- All Implemented Interfaces:
    Serializable, Cloneable, Fade

      public class FadeImpl
      extends Object
      implements Fade, Serializable, Cloneable

  Implementation of a fade that used to collect together the audio fade properties of source clip segments into a single method argument and return value. These properties describe the length and type of audio fade ins and outs for a segment.

  The `fadeInLength`, `fadeInType`, `fadeOutLength` and `fadeOutType` properties of source clip are deprecated in the AAF object specification v1.1. The preferred way of specifying an audio fade is to use a transition with an appropriate effect.

  As this class is used as a convenient means to package up related values as arguments methods of other persistent classes, it has no persistent representation of its own.

  See Also:
    `SourceClip.setFade(tv.amwa.maj.union.Fade)`, `SourceClip.getFade()`, `FadeType`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FadeImpl()` Create and initialize a fade description, which describe a fade associated with a `source clip`.
    `FadeImpl(long fadeInLength, FadeType fadeInType, long fadeOutLength, FadeType fadeOutType)` Creates a new fade value using the given parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FadeImpl` | `clone()`
    `boolean` | `equals(Object o)`
    `long` | `getFadeInLength()` Returns the fade in length of the fade.
    `FadeType` | `getFadeInType()` Returns the fade in type of the fade.
    `long` | `getFadeOutLength()` Returns the fade out length of the fade.
    `FadeType` | `getFadeOutType()` Returns the fade out type of the fade.
    `int` | `hashCode()`
    `boolean` | `isFadeInPresent()` Returns `true` if details of a fade in are present in the fade; otherwise `false`.
    `boolean` | `isFadeOutPresent()` Returns `true` if details of a fade out are present in the fade; otherwise `false`.
    `void` | `setFadeInLength(long fadeInLength)` Sets the fade in length of the fade.
    `void` | `setFadeInType(FadeType fadeInType)` Sets the fade in type of the fade.
    `void` | `setFadeOutLength(long fadeOutLength)` Sets the fade out length of the fade.
    `void` | `setFadeOutType(FadeType fadeOutType)` Sets the fade out type of the fade.
    `void` | `setPropertiesFromInterface(Fade castFrom)` Set the properties of this fade value from the given object that implements the fade interface.
    `String` | `toString()` Creates a pseudo-XML representation of this fade value, which is loosely based on the AAF XML generated for a source clip.

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

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

- - ### Constructor Detail

    - #### FadeImpl

          public FadeImpl()

      Create and initialize a fade description, which describe a fade associated with a `source clip`. The class is initialized with no fade in or fade out present and fade lengths set to 0.

    - #### FadeImpl

          public FadeImpl(@LengthType
                          long fadeInLength,
                          FadeType fadeInType,
                          @LengthType
                          long fadeOutLength,
                          FadeType fadeOutType)
                   throws BadLengthException

      Creates a new fade value using the given parameters.

      Fade in and out lengths must be non-negative values, otherwise an bad length exception will be thrown.

      If fade in or out types are set to `null` then the fade in and out properties will be set to not present respectively. For all non-`null` values for fade in and out types, the properties will be set to present.

      Parameters:
        `fadeInLength` - Fade in length for this new fade.
        `fadeInType` - Fade in type for this new fade.
        `fadeOutLength` - Fade out length for this new fade.
        `fadeOutType` - Fade out type for this new fade.
      Throws:
        `BadLengthException` - One or both of the given length values are negative.

  - ### Method Detail

    - #### setPropertiesFromInterface

          public final void setPropertiesFromInterface(Fade castFrom)

      Set the properties of this fade value from the given object that implements the fade interface.

      Parameters:
        `castFrom` - Object implementing the fade interface to cast a value from.

    - #### getFadeInLength

          @LengthType
          public long getFadeInLength()
                                           throws PropertyNotPresentException

      Description copied from interface: `Fade`

      Returns the fade in length of the fade. This is an optional property.

      Specified by:
        `getFadeInLength` in interface `Fade`
      Returns:
        Fade in length of the fade.
      Throws:
        `PropertyNotPresentException` - This optional property is not present in the fade.

    - #### getFadeInType

          public FadeType getFadeInType()
                                 throws PropertyNotPresentException

      Description copied from interface: `Fade`

      Returns the fade in type of the fade. This is an optional property.

      Specified by:
        `getFadeInType` in interface `Fade`
      Returns:
        Fade in type of the fade.
      Throws:
        `PropertyNotPresentException` - This optional property is not present in the fade.

    - #### getFadeOutLength

          @LengthType
          public long getFadeOutLength()
                                            throws PropertyNotPresentException

      Description copied from interface: `Fade`

      Returns the fade out length of the fade. This is an optional property.

      Specified by:
        `getFadeOutLength` in interface `Fade`
      Returns:
        Fade out length of the fade.
      Throws:
        `PropertyNotPresentException` - This optional property is not present in the fade.

    - #### getFadeOutType

          public FadeType getFadeOutType()
                                  throws PropertyNotPresentException

      Description copied from interface: `Fade`

      Returns the fade out type of the fade. This is an optional property.

      Specified by:
        `getFadeOutType` in interface `Fade`
      Returns:
        Fade out type for the fade.
      Throws:
        `PropertyNotPresentException` - This optional property is not present in the fade.

    - #### isFadeInPresent

          public boolean isFadeInPresent()

      Description copied from interface: `Fade`

      Returns `true` if details of a fade in are present in the fade; otherwise `false`.

      Specified by:
        `isFadeInPresent` in interface `Fade`
      Returns:
        Are details of a fade in present in the fade?

    - #### isFadeOutPresent

          public boolean isFadeOutPresent()

      Description copied from interface: `Fade`

      Returns `true` if details of a fade out are present in the fade; otherwise `false`.

      Specified by:
        `isFadeOutPresent` in interface `Fade`
      Returns:
        Are details of the fade out present in the fade?

    - #### setFadeInLength

          public void setFadeInLength(@LengthType
                                      long fadeInLength)
                               throws BadLengthException

      Description copied from interface: `Fade`

      Sets the fade in length of the fade. This is an optional property that can be omitted by calling `setFadeInType(null)`.

      Specified by:
        `setFadeInLength` in interface `Fade`
      Parameters:
        `fadeInLength` - Fade in length of the fade.
      Throws:
        `BadLengthException` - Cannot set the fade in length to a negative value.

    - #### setFadeInType

          public void setFadeInType(FadeType fadeInType)

      Description copied from interface: `Fade`

      Sets the fade in type of the fade. Set to `null` to omit both this optional property and the associated fade in length property.

      Specified by:
        `setFadeInType` in interface `Fade`
      Parameters:
        `fadeInType` - Fade in type of the fade.

    - #### setFadeOutLength

          public void setFadeOutLength(@LengthType
                                       long fadeOutLength)
                                throws BadLengthException

      Description copied from interface: `Fade`

      Sets the fade out length of the fade. This is an optional property that can be omitted by calling `setFadeOutType(null)`.

      Specified by:
        `setFadeOutLength` in interface `Fade`
      Parameters:
        `fadeOutLength` - Fade out length of the fade.
      Throws:
        `BadLengthException` - Cannot set the fade out length to a negative value.

    - #### setFadeOutType

          public void setFadeOutType(FadeType fadeOutType)

      Description copied from interface: `Fade`

      Sets the fade out type of the fade. Set to `null` to omit both this optional property and the associated fade out length property.

      Specified by:
        `setFadeOutType` in interface `Fade`
      Parameters:
        `fadeOutType` - Fade out type of the fade.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### clone

          public FadeImpl clone()

      Overrides:
        `clone` in class `Object`

    - #### toString

          public String toString()

      Creates a pseudo-XML representation of this fade value, which is loosely based on the AAF XML generated for a source clip. No XML schema or DTD is defined. For example:

           <Fade>
             <FadeInLength>34</FadeInLength>
             <FadeInType>LinearAmp</FadeInType>
           </Fade>

      Overrides:
        `toString` in class `Object`
      Returns:
        Pseudo-XML representation of this fade value.
      See Also:
        `InterchangeObjectImpl.toString()`

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