Media Authoring
with Java API

tv.amwa.maj.entity
Class Sequence

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.Sequence
All Implemented Interfaces:
Serializable, Cloneable, MAJCommon, Component, InterchangeObject, Segment, Sequence, XMLSerializable

@AAFClass(uuid1=218169601,
          uuid2=257,
          uuid3=3840,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="Sequence",
          description="The Sequence class combines an ordered list of Segments and Transitions.")
public class Sequence
extends Segment
implements Sequence, Serializable, Cloneable, MAJCommon

Implements the representation of the combination of an ordered list of segments and transitions. A sequence is the mechanism for combining sections of essence to be played in a sequential manner. If a sequence object has one segment followed by another segment, after the first segment is played, the following one begins immediately.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class Sequence.ComponentsXMLHandler
           
static class Sequence.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 SEQUENCE_TAG
           
 
Fields inherited from class tv.amwa.maj.entity.Component
COMPONENT_ITEM
 
Constructor Summary
Sequence(DataDefinition dataDefinition)
          Creates and initializes a new sequence, which combines an ordered list of segments and transitions.
 
Method Summary
 void appendComponent(Component component)
          Appends the given component to this sequence.
 void appendXMLChildren(Node parent)
          Append child elements to the given parent node to serialize the value of an object to an XML fragment.
 Sequence clone()
          Creates a cloned copy of this entity.
 int countComponents()
          Returns the number of components in this sequence.
 boolean equals(Object o)
          Tests to see if the given object is equal to this interchange object.
 Component getComponentAt(int index)
          Returns the component at the given index through this sequence.
 List<Component> getComponents()
          Returns a list of all the components of this sequence.
 int hashCode()
          Returns a hash code value for this interchange object.
 void insertComponentAt(int index, Component component)
          Insert the given component into this sequence at the given index.
 void prependComponent(Component component)
          Prepends the given component to this sequence.
 void removeComponentAt(int index)
          Removes the component at the given index from this sequence.
 void setPropertiesFromInterface(Sequence castFrom)
           
 
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, toString, 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

SEQUENCE_TAG

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

Sequence

public Sequence(DataDefinition dataDefinition)
         throws NullPointerException

Creates and initializes a new sequence, which combines an ordered list of segments and transitions.

Parameters:
dataDefinition - Kind of data represented by this component.
Throws:
NullPointerException - Data definition is null.
Method Detail

setPropertiesFromInterface

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

getComponents

@AAFProperty(uuid1=100729092,
             uuid2=1545,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="Components",
             typeName="StrongReferenceVector of Component",
             optional=false,
             uniqueIdentifier=false,
             pid=4097)
public List<Component> getComponents()
Description copied from interface: Sequence

Returns a list of all the components of this sequence.

Specified by:
getComponents in interface Sequence
Returns:
Shallow copy of the list containing all of the components of the sequence.

appendComponent

public void appendComponent(Component component)
                     throws NullPointerException,
                            InvalidDataDefinitionException,
                            LeadingTransitionException,
                            EventSemanticsException,
                            BadPropertyException,
                            BadLengthException,
                            AdjacentTransitionException,
                            InsufficientTransitionMaterialException
Description copied from interface: Sequence

Appends the given component to this sequence. The length of the sequence is incremented by the size of the component or transition.

If the component is to be the first in the sequence and is a transition, the method fails with a LeadingTransitionException as it is not acceptable to have a transition as the first element of a sequence. Note that this method supports the incremental creation of sequences from start to finish and so could be used to create a sequence that ends in a transition, which is an illegal state.

The method checks that the data definition of the appended component is compatible with that of the sequence.

Specified by:
appendComponent in interface Sequence
Parameters:
component - Component to append to this sequence.
Throws:
NullPointerException - The given component is null.
InvalidDataDefinitionException - The kind of data of the component is not compatible with the data definition of the sequence.
LeadingTransitionException - A transition cannot be appended to a sequence so as to become its first component.
EventSemanticsException - The given component is an event that either: does not match the other kinds of event in the sequence; does not have the contextual position property set; does not follow on from the previous event.
BadPropertyException - The given non-event component does not have a length value set.
BadLengthException - The length of the given components is negative.
AdjacentTransitionException - Appending the given transition component would result in two adjacent transitions.
InsufficientTransitionMaterialException - Appending the given component or transition will result in insufficient material for the last transition in the sequence.
See Also:
Event

countComponents

public int countComponents()
Description copied from interface: Sequence

Returns the number of components in this sequence.

Specified by:
countComponents in interface Sequence
Returns:
Number of components in this sequence.

getComponentAt

public Component getComponentAt(int index)
                         throws IndexOutOfBoundsException
Description copied from interface: Sequence

Returns the component at the given index through this sequence.

Specified by:
getComponentAt in interface Sequence
Parameters:
index - Index of component through this sequence
Returns:
Component at the given index of this sequence.
Throws:
IndexOutOfBoundsException - The index is outside the acceptable range for this sequence.

insertComponentAt

public void insertComponentAt(int index,
                              Component component)
                       throws NullPointerException,
                              IndexOutOfBoundsException,
                              InvalidDataDefinitionException,
                              LeadingTransitionException,
                              AdjacentTransitionException,
                              InsufficientTransitionMaterialException
Description copied from interface: Sequence

Insert the given component into this sequence at the given index. The length of the sequence is incremented by the size of the component, unless the component is a transition. Indices of components higher than the given index will be increased by one to accommodate the new component.

If the component is a transition, the method checks that it is not the first object in the sequence, and that it is not neighbouring another transition. It also verifies that there is enough source material on either side of the transition. Note that this method supports the incremental creation of sequences from start to finish and so could be used to create a sequence that ends in a transition, which is an illegal state.

The method checks that the data definition of the appended component is compatible with that of the sequence.

Specified by:
insertComponentAt in interface Sequence
Parameters:
index - 0-based index to insert the new component at.
component - Component to insert into the sequence.
Throws:
NullPointerException - The given component to insert is null.
IndexOutOfBoundsException - The index is outside the acceptable range for the sequence.
InvalidDataDefinitionException - The kind of data of the component is not compatible with the data definition of the sequence.
LeadingTransitionException - A transition component cannot be inserted as first element of the sequence.
AdjacentTransitionException - Inserting a transition and the given index will result in two neighbouring transitions, which is not permitted.
InsufficientTransitionMaterialException - Not enough source material exists either side of the given transition for the transition to work.

prependComponent

public void prependComponent(Component component)
                      throws NullPointerException,
                             InvalidDataDefinitionException,
                             LeadingTransitionException
Description copied from interface: Sequence

Prepends the given component to this sequence. The length of the sequence is incremented by the size of the component.

If the component is a transition, the method fails with a LeadingTransitionException as it is not acceptable to have a transition as the first element of a sequence. Use Sequence.insertComponentAt(int, Component) instead.

The method checks that the data definition of the appended component is compatible with that of the sequence.

Specified by:
prependComponent in interface Sequence
Parameters:
component - Component to prepend to this sequence.
Throws:
NullPointerException - The given component is null.
InvalidDataDefinitionException - The kind of data of the component is not compatible with the data definition of the sequence.
LeadingTransitionException - A transition cannot be appended to a sequence so as to become its first or last component.

removeComponentAt

public void removeComponentAt(int index)
                       throws IndexOutOfBoundsException
Description copied from interface: Sequence

Removes the component at the given index from this sequence. Components already existing at indices higher than the given index will be moved to the next lower index to accommodate.

Note that removal of a component from a sequence may result in the sequence being in an illegal state.

Specified by:
removeComponentAt in interface Sequence
Parameters:
index - Index of component to be removed.
Throws:
IndexOutOfBoundsException - The index is outside the acceptable range for the sequence.

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 Sequence 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:
Segment.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.