Media Authoring
with Java API

tv.amwa.maj.entity
Class Selector

java.lang.Object
  extended by tv.amwa.maj.entity.InterchangeObject
      extended by tv.amwa.maj.entity.Component
          extended by tv.amwa.maj.entity.Segment
              extended by tv.amwa.maj.entity.Selector
All Implemented Interfaces:
Serializable, Cloneable, MAJCommon, Component, InterchangeObject, Segment, Selector, XMLSerializable

@AAFClass(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.")
public class Selector
extends Segment
implements Selector, Serializable, Cloneable, MAJCommon

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.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class Selector.AlternatesXMLHandler
           
static class Selector.SelectedXMLHandler
           
static class Selector.XMLHandler
           
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.Segment
Segment.SegmentXMLHandler
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.Component
Component.ComponentAttributesXMLHandler, Component.ComponentUserCommentsXMLHandler, Component.ComponentXMLHandler, Component.KLVDataXMLHandler
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.InterchangeObject
InterchangeObject.InterchangeObjectXMLHandler
 
Field Summary
static String SELECTOR_TAG
           
 
Fields inherited from class tv.amwa.maj.entity.Component
COMPONENT_ITEM
 
Constructor Summary
Selector(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
 void appendAlternateSegment(Segment segment)
          Append the given segment to collection of alternative segments of this selector.
 void appendXMLChildren(Node parent)
          Append child elements to the given parent node to serialize the value of an object to an XML fragment.
 Selector clone()
          Creates a cloned copy of this entity.
 int countAlternateSegments()
          Returns the number of segments in the collection of alternates of this selector.
 boolean equals(Object o)
          Tests to see if the given object is equal to this interchange object.
 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.
 int hashCode()
          Returns a hash code value for this interchange object.
 void removeAlternateSegment(Segment segment)
          Removes the given segment from the collection of alternates for this selector.
 void setPropertiesFromInterface(Selector castFrom)
           
 void setSelectedSegment(Segment selectedSegment)
          Sets the selected segment of this selector.
 
Methods inherited from class tv.amwa.maj.entity.Segment
segmentOffsetToTC, segmentTCToOffset, setPropertiesFromInterface
 
Methods inherited from class tv.amwa.maj.entity.Component
appendAttribute, appendAttribute, appendComment, appendComment, appendKLVData, countAttributes, countComments, countKLVData, getAttributes, getComments, getDataDefinition, getKLVData, getLength, getLengthPresent, removeAttribute, removeComment, removeKLVData, setDataDefinition, setLength, setLengthPresent, setPropertiesFromInterface
 
Methods inherited from class tv.amwa.maj.entity.InterchangeObject
castFromInterface, countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, registerImplementation, setPropertiesFromInterface, setPropertyValue, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface tv.amwa.maj.iface.Segment
segmentOffsetToTC, segmentTCToOffset
 
Methods inherited from interface tv.amwa.maj.iface.Component
appendAttribute, appendAttribute, appendComment, appendComment, appendKLVData, countAttributes, countComments, countKLVData, getAttributes, getComments, getDataDefinition, getKLVData, getLength, removeAttribute, removeComment, removeKLVData, setDataDefinition, setLength
 
Methods inherited from interface tv.amwa.maj.iface.InterchangeObject
countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, setPropertyValue
 
Methods inherited from interface tv.amwa.maj.entity.MAJCommon
toString
 

Field Detail

SELECTOR_TAG

public static final String SELECTOR_TAG
See Also:
Constant Field Values
Constructor Detail

Selector

public Selector(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

setPropertiesFromInterface

public final void setPropertiesFromInterface(Selector castFrom)
See Also:
InterchangeObject.setPropertiesFromInterface(tv.amwa.maj.iface.InterchangeObject)

getAlternateSegments

@AAFProperty(uuid1=100729092,
             uuid2=1544,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="Alternates",
             typeName="StrongReferenceVector of Segment",
             optional=true,
             uniqueIdentifier=false,
             pid=3842)
public List<Segment> getAlternateSegments()
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.

Specified by:
getAlternateSegments in interface Selector
Returns:
Shallow copy of the collection of alternates of this selector.

appendAlternateSegment

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

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

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.

getSelectedSegment

@AAFProperty(uuid1=100729092,
             uuid2=521,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="Selected",
             typeName="StrongReference to Segment",
             optional=false,
             uniqueIdentifier=false,
             pid=3841)
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

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.

equals

public boolean equals(Object o)
Description copied from interface: MAJCommon

Tests to see if the given object is equal to this interchange object. To be equal, the given value must be not null, share the same interface to its value and each of the properties of the value must each be equal.

Specified by:
equals in interface MAJCommon
Overrides:
equals in class Component
Parameters:
o - Object to test for equality with.
Returns:
Is the given object equals to this value?
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Description copied from interface: MAJCommon

Returns a hash code value for this interchange object.

Specified by:
hashCode in interface MAJCommon
Overrides:
hashCode in class Component
Returns:
Hash code value for this interchange object.
See Also:
Object.hashCode()

clone

public Selector clone()
Description copied from interface: MAJCommon

Creates a cloned copy of this entity. The clone will be initialized to have the same value as this value but exists independently from then on. Changes to this value will not effect the clone and changes to the clone will not effect this. MAJ API clones are true deep clones with no shared references to areas of memory within the original.

This method does not throw a CloneNotSupportedException as all entity values must implement the Cloneable interface. If a cloning error does occur, a null value will be returned but this is very unlikely to happen.

Specified by:
clone in interface MAJCommon
Overrides:
clone in class Segment
Returns:
Independent clone of this value, which is a deep copy.
See Also:
Object.clone()

appendXMLChildren

public void appendXMLChildren(Node parent)
Description copied from interface: XMLSerializable

Append 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
Overrides:
appendXMLChildren in class Component
Parameters:
parent - XML parent element to append child nodes to.

Media Authoring
with Java API

(c) 2007-2008 Richard Cartwright, all rights reserved. Subject to the terms of the AAF SDK Public Source License.