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

tv.amwa.maj.model.impl

## Class SelectorImpl

- java.lang.Object
- - tv.amwa.maj.model.impl.InterchangeObjectImpl
  - - tv.amwa.maj.model.impl.ComponentImpl
    - - tv.amwa.maj.model.impl.SegmentImpl
      - - tv.amwa.maj.model.impl.SelectorImpl

- All Implemented Interfaces:
    Serializable, Cloneable, QComponent, QSegment, MediaEntity, MetadataObject, Component, InterchangeObject, Segment, Selector

      @MediaClass(uuid1=218169601,
                  uuid2=257,
                  uuid3=3584,
                  uuid4={6,14,43,52,2,6,1,1},
                  definedName="Selector",
                  description="The Selector class provides the value of a single Segment while preserving references to unused alternatives.",
                  symbol="Selector")
      public class SelectorImpl
      extends SegmentImpl
      implements Selector, Serializable, Cloneable

  Implements a selected value of a single segment while preserving references to unused alternatives. A selector represents an editing decision, which is in contrast with an essence group that presents a group of alternative versions of the same essence that the application can choose from, based on the most appropriate or efficient essence format among the alternatives.

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `ObjectClassPropertyID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SelectorImpl()` Default constructor is not public to avoid unset required fields.
    `SelectorImpl(Segment selected)` Creates and initializes a new selector segment, which provides the value of a single `segment` while preserving references to unused alternatives.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendAlternateSegment(Segment segment)` Append the given segment to collection of alternative segments of this selector.
    `void` | `clearAlternates()`
    `Selector` | `clone()` Works by side effect!
    `int` | `countAlternateSegments()` Returns the number of segments in the collection of alternates of this selector.
    `List<Segment>` | `getAlternateSegments()` Returns a collection of all the segments of the collection of alternates of this selector.
    `Segment` | `getSelectedSegment()` Returns the selected segment of this selector.
    `static Segment` | `initializeSelectedSegment()`
    `void` | `removeAlternateSegment(Segment segment)` Removes the given segment from the collection of alternates for this selector.
    `void` | `setSelectedSegment(Segment selectedSegment)` Sets the selected segment of this selector.

    - ### Methods inherited from class tv.amwa.maj.model.impl.SegmentImpl

      `generateSequence, getCutPoint, getKeyOffset, getPackLayerKeyIndicator, getSegmentBlob, getTrackBlob, getTrackKeyRenderSequence, getTrackName, getTrackRenderSequence, segmentOffsetToTC, segmentTCToOffset, setCutPoint, setKeyOffset, setPackLayerKeyIndicator, setSegmentBlob, setTrackBlob, setTrackKeyRenderSequence, setTrackName, setTrackRenderSequence`

    - ### Methods inherited from class tv.amwa.maj.model.impl.ComponentImpl

      `appendComponentAttribute, appendComponentAttribute, appendComponentKLVData, appendComponentUserComment, appendComponentUserComment, clearComponentAttributes, clearComponentKLVData, clearComponentUserComments, countComponentAttributes, countComponentKLVData, countComponentUserComments, getComment, getComponentAttributes, getComponentDataDefinition, getComponentKLVData, getComponentLength, getComponentUserComments, getEditName, getJupiterClipOffset, getJupiterID, getLengthPresent, initializeComponentDataDefinition, prependComponentAttribute, prependComponentKLVData, prependComponentUserComment, removeComponentAttribute, removeComponentKLVData, removeComponentUserComment, setComponentDataDefinition, setComponentLength, setComponentLengthFromStream, setEditName, setJupiterClipOffset, setJupiterID, setLengthPresent`

    - ### Methods inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `addApplicationPlugin, appendXMLChildren, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getLinkedGenerationIDString, getObjectClass, getPersistentID, getPersistentIndex, hashCode, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setLinkedGenerationIDString, setObjectClass, setPersistentID, setPersistentIndex, toString`

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

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

    - ### Methods inherited from interface tv.amwa.maj.model.Segment

      `generateSequence, segmentOffsetToTC, segmentTCToOffset`

    - ### Methods inherited from interface tv.amwa.maj.model.Component

      `appendComponentAttribute, appendComponentAttribute, appendComponentKLVData, appendComponentUserComment, appendComponentUserComment, clearComponentAttributes, clearComponentKLVData, clearComponentUserComments, countComponentAttributes, countComponentKLVData, countComponentUserComments, getComponentAttributes, getComponentDataDefinition, getComponentKLVData, getComponentLength, getComponentUserComments, getLengthPresent, removeComponentAttribute, removeComponentKLVData, removeComponentUserComment, setComponentDataDefinition, setComponentLength, setLengthPresent`

    - ### Methods inherited from interface tv.amwa.maj.model.InterchangeObject

      `addApplicationPlugin, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getObjectClass, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setObjectClass, toString`

    - ### Methods inherited from interface tv.amwa.maj.industry.MediaEntity

      `getPersistentID, setPersistentIndex`

- - ### Constructor Detail

    - #### SelectorImpl

          public SelectorImpl()

      Default constructor is not public to avoid unset required fields.

    - #### SelectorImpl

          public SelectorImpl(Segment selected)
                       throws NullPointerException,
                              BadLengthException

      Creates and initializes a new selector segment, which provides the value of a single `segment` while preserving references to unused alternatives. This list of alternatives is initialized to an empty list. The length and kind of data represented by this component is extracted from the given selected segment.

      Parameters:
        `selected` - Currently selected element.
      Throws:
        `NullPointerException` - Selected element is `null`.
        `BadLengthException` - The given selected segment has a negative length.

  - ### Method Detail

    - #### getAlternateSegments

          @MediaProperty(uuid1=100729092,
                         uuid2=1544,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="AlternateSegments",
                         aliases="Alternates",
                         typeName="SegmentStrongReferenceVector",
                         optional=true,
                         uniqueIdentifier=false,
                         pid=3842,
                         symbol="AlternateSegments")
          public List<Segment> getAlternateSegments()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                 throws PropertyNotPresentException

      Description copied from interface: `Selector`

      Returns a collection of all the segments of the collection of alternates of this selector. If the alternates property is omitted, this method returns an empty list. This is an optional property.

      Specified by:
        `getAlternateSegments` in interface `Selector`
      Returns:
        Shallow copy of the collection of alternates of this selector.
      Throws:
        `PropertyNotPresentException` - No alternates are present for this selector.
      See Also:
        `TypeDefinitions.SegmentStrongReferenceVector`

    - #### appendAlternateSegment

          @MediaListAppend(value="AlternateSegments")
          public void appendAlternateSegment(Segment segment)
                                                                                  throws NullPointerException,
                                                                                         BadLengthException,
                                                                                         InvalidDataDefinitionException

      Description copied from interface: `Selector`

      Append the given segment to collection of alternative segments of this selector. This set represents unused segment alternatives. If currently omitted, the alternates optional property is made present by this method.

      Specified by:
        `appendAlternateSegment` in interface `Selector`
      Parameters:
        `segment` - Segment to append to the collection of alternates of this selector.
      Throws:
        `NullPointerException` - The given alternate segment is `null`.
        `BadLengthException` - The given segment does not have a length that matches the length of this selector.
        `InvalidDataDefinitionException` - The given segment does not have a data definition that is compatible with the essence type of this selector.

    - #### countAlternateSegments

          @MediaPropertyCount(value="AlternateSegments")
          public int countAlternateSegments()

      Description copied from interface: `Selector`

      Returns the number of segments in the collection of alternates of this selector. If the alternates property is omitted, this method returns 0.

      Specified by:
        `countAlternateSegments` in interface `Selector`
      Returns:
        Number of segments in the collection of alternates of this selector.

    - #### removeAlternateSegment

          @MediaPropertyRemove(value="AlternateSegments")
          public void removeAlternateSegment(Segment segment)
                                                                                      throws NullPointerException,
                                                                                             SegmentNotFoundException

      Description copied from interface: `Selector`

      Removes the given segment from the collection of alternates for this selector.

      Specified by:
        `removeAlternateSegment` in interface `Selector`
      Parameters:
        `segment` - Segment to remove from the collection of alternates of this selector.
      Throws:
        `NullPointerException` - The given segment to remove from the list of alternates is `null`.
        `SegmentNotFoundException` - The given segment is not contained in the list of alternates for this selector.

    - #### clearAlternates

          @MediaPropertyClear(value="AlternateSegments")
          public void clearAlternates()

    - #### getSelectedSegment

          @MediaProperty(uuid1=100729092,
                         uuid2=521,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="SelectedSegment",
                         aliases="Selected",
                         typeName="SegmentStrongReference",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=3841,
                         symbol="SelectedSegment")
          public Segment getSelectedSegment()

      Description copied from interface: `Selector`

      Returns the selected segment of this selector.

      Specified by:
        `getSelectedSegment` in interface `Selector`
      Returns:
        Selected segment of this selector.

    - #### setSelectedSegment

          @MediaPropertySetter(value="SelectedSegment")
          public void setSelectedSegment(Segment selectedSegment)
                                                                                throws NullPointerException,
                                                                                       BadLengthException,
                                                                                       InvalidDataDefinitionException

      Description copied from interface: `Selector`

      Sets the selected segment of this selector. If the selected segment currently exists in the set of alternatives, the selected segment is removed from the set. The segment being replaced is appended to the set of alternatives.

      Specified by:
        `setSelectedSegment` in interface `Selector`
      Parameters:
        `selectedSegment` - Selected segment of this selector.
      Throws:
        `NullPointerException` - The given selected segment is `null`.
        `BadLengthException` - The given segment does not have a length that matches the length of this selector.
        `InvalidDataDefinitionException` - The given segment does not have a data definition that is compatible with the essence type of this selector.

    - #### initializeSelectedSegment

          public static final Segment initializeSelectedSegment()

    - #### clone

          public Selector clone()

      Works by side effect!

      Specified by:
        `clone` in interface `MediaEntity`
      Specified by:
        `clone` in interface `Component`
      Specified by:
        `clone` in interface `InterchangeObject`
      Specified by:
        `clone` in interface `Segment`
      Specified by:
        `clone` in interface `Selector`
      Overrides:
        `clone` in class `SegmentImpl`
      Returns:
        Cloned copy of this interchange object.
      See Also:
        `tv.amwa.maj.model.impl.ComponentImpl#getMinimumBounds(long, long, tv.amwa.maj.model.impl.PackageImpl, tv.amwa.maj.entity.Track, tv.amwa.maj.embeddable.MediaCriteria, long, tv.amwa.maj.enumeration.OperationChoice, tv.amwa.maj.model.impl.ComponentImpl, tv.amwa.maj.model.impl.ComponentImpl, tv.amwa.maj.model.impl.PackageImpl.ScopeStack, long, long, tv.amwa.maj.entity.OperationGroup, int, tv.amwa.maj.model.impl.ComponentImpl, java.lang.Boolean)`

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