public class SourceReferenceValueImpl extends Object implements SourceReferenceValue, Serializable, XMLSerializable, Cloneable
Implementation of a source reference value that targets an item of source material, defined using a package id, source track id and start time. This reference can be used as an argument to methods or as a return value. The class is used to ensure the constraint that if the source id is the zero package id then the source track id is 0 and the start time is 0 .
The interpretation of a source reference value depends on the context where it is used. The value of a source reference can be explicit or relative to its context. Source references are often used to build a chain of references that can be used to trace the original source of some material.
Three different kinds of reference can be identified from the value of the source id property of a source reference. These are defined as:
originalSource() static method.inContextReference(int) or
inContextReference(int, Long) methods.As this class is used as a convenience argument to the methods of other persistent classes, it has no persistent representation of its own.
SourceClip,
SourceReferenceSegment,
PackageID,
Serialized Form| Constructor and Description |
|---|
SourceReferenceValueImpl(PackageID sourcePackageID,
int sourceTrackID,
Long startPosition)
Create a new source reference value that contains a source package id, source track id and
start position.
|
| 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.
|
SourceReferenceValue |
clone() |
boolean |
equals(Object o) |
String |
getComment()
Include a comment when serializing a value to XML.
|
PackageID |
getSourcePackageID()
Returns the identifier of the package that is the target of the reference.
|
int |
getSourceTrackID()
|
long |
getStartPosition()
Returns the position offset from the origin of the referenced package's
track in edit units determined by the
source clip's
context.
|
int |
hashCode() |
static SourceReferenceValueImpl |
inContextReference(int sourceTrackID)
Manufactures a new source reference to static material in track within the same context
as the package in which the reference is specified.
|
static SourceReferenceValueImpl |
inContextReference(int sourceTrackID,
Long startPosition)
Manufactures a new source reference to timeline- or event-based material in
a track within the same context as the package in which the reference is specified.
|
boolean |
isContextual()
|
boolean |
isOriginalSource()
Returns
true if this source reference is to the original source material and
false if it requires further resolution. |
static SourceReferenceValueImpl |
originalSource()
Manufactures a new source reference that indicates the reference is to essence
that is the original source.
|
void |
setSourcePackageID(PackageID sourcePackageID)
Sets the identity of package that is the target of the reference.
|
void |
setSourceTrackID(int sourceTrackID)
|
void |
setStartPosition(Long startPosition)
Returns the position offset from the origin of the referenced package's
track in edit units determined by the
source clip's
context.
|
String |
toString()
Create a pseudo-XML representation of this source reference, similar to that produced
for a source clip.
|
public SourceReferenceValueImpl(@PackageIDType PackageID sourcePackageID, @TrackID int sourceTrackID, @PositionType Long startPosition) throws IllegalArgumentException
Create a new source reference value that contains a source package id, source track id and start position. If the given source package id is the zero package id, values for source track id and start position are set to zero to comply with source reference constraints.
sourcePackageID - Identifies the package that is the target
of the new reference. If the property is set to the zero package id,
it means that the package owning the source reference describes the original source. If this optional property
is omitted by setting its value to null, the given track
refers to another track within the same package as the reference.sourceTrackID - Specifies the track id of a track within the specified
package. If the source package id is the zero package id, then the source
track id shall have a 0 value.startPosition - Specifies the position offset from the origin of the referenced package's
track in edit units determined by the associated
source clip's context. If the source package id
is the zero package id, then the start position shall have a 0 value.
Set the value to null to omit this optional property in the case that the
new reference is to static material.IllegalArgumentException - The source track id cannot be set to a negative value.PackageID.isZero(),
PackageIDImpl.getZeroPackageID()public static final SourceReferenceValueImpl originalSource()
Manufactures a new source reference that indicates the reference is to essence that is the original source. The source package id will be the zero package id, the source track id will be zero and so will the start position.
SourceReferenceValue.isOriginalSource(),
PackageID.isZero()public static final SourceReferenceValueImpl inContextReference(@TrackID int sourceTrackID) throws IllegalArgumentException
Manufactures a new source reference to static material in track within the same context
as the package in which the reference is specified. This method version omits the start
position property - use inContextReference(int, Long) to set a start
position value for timeline- or event-based material.
sourceTrackID - Track to reference within the same package that this reference is defined in.IllegalArgumentException - The given source track id is a negative value.StaticTrack,
SourceReferenceValue.isContextual()public static final SourceReferenceValueImpl inContextReference(@TrackID int sourceTrackID, @PositionType Long startPosition) throws IllegalArgumentException
Manufactures a new source reference to timeline- or event-based material in
a track within the same context as the package in which the reference is specified. Use the
inContextReference(int) to create a reference to static material.
sourceTrackID - Track to reference within the same package that this reference is defined in.startPosition - Specifies the offset from the origin of the referenced package's track in edit
units determined by the associated source clip object's context.IllegalArgumentException - The source track id cannot be set to a negative value.TimelineTrack,
EventTrack,
SourceReferenceValue.isContextual()@PackageIDType public PackageID getSourcePackageID() throws PropertyNotPresentException
SourceReferenceValueReturns the identifier of the package that is the target of the reference. If the property is the zero package id, it means that the package owning this source reference describes the original source.
getSourcePackageID in interface SourceReferenceValuePropertyNotPresentException - The optional source package id property is not present in
this source reference, implying that the reference is to a track in the same
package as the reference itself.public void setSourcePackageID(@PackageIDType PackageID sourcePackageID)
SourceReferenceValueSets the identity of package that is the target of the reference. If the property is the
zero package id, it means that the
package owning this source reference describes the original source. Set the source package id to null to indicate
that the reference is to a track in the package owning this reference.
setSourcePackageID in interface SourceReferenceValuesourcePackageID - Source id component of the source reference.@TrackID public int getSourceTrackID()
SourceReferenceValueReturns the track id of a track within the referenced package. If the source package id of this value is the zero package id then the source track value shall also be set to 0.
getSourceTrackID in interface SourceReferenceValuepublic void setSourceTrackID(@TrackID int sourceTrackID) throws IllegalArgumentException
SourceReferenceValueSets the track id of the referenced track within the referenced package. If the source package id of this value is the zero package id then the source track value shall also be set to 0.
setSourceTrackID in interface SourceReferenceValuesourceTrackID - Track id part of the source reference.IllegalArgumentException - Trying to set a non-zero value when the source id is the zero package id or the
track id is negative.@PositionType public long getStartPosition() throws PropertyNotPresentException
SourceReferenceValueReturns the position offset from the origin of the referenced package's track in edit units determined by the source clip's context. If the source package id of this value is the zero package id, then the start position shall also be set to 0.
getStartPosition in interface SourceReferenceValuePropertyNotPresentException - The optional start time property is not present,
indicating that the reference is in the context of a static track
rather than a timeline or
event track.public void setStartPosition(@PositionType Long startPosition) throws IllegalArgumentException
SourceReferenceValueReturns the position offset from the origin of the referenced package's track in edit units determined by the source clip's context. If the source package id of this value is the zero package id then the start position shall be set to 0.
Set this optional property to null to omit it, indicating
that this reference is in the context of a static track
rather than a timeline or
event track.
setStartPosition in interface SourceReferenceValuestartPosition - Position offset from the origin of the referenced content.IllegalArgumentException - Trying to set a non-zero value when the source id is the zero package id.public boolean isOriginalSource()
SourceReferenceValueReturns true if this source reference is to the original source material and
false if it requires further resolution.
isOriginalSource in interface SourceReferenceValueForge.originalSource()public boolean isContextual()
SourceReferenceValueReturns true if this source reference is to another track within the context
of the same package, or false if it is a reference
to a track in another package.
isContextual in interface SourceReferenceValueSourceReferenceValue.isContextual(),
Forge.inContextReference(int),
Forge.inContextReference(int, Long)public String toString()
Create a pseudo-XML representation of this source reference, similar to that produced for a source clip. No XML schema or DTD defines this element. For example, an original source reference would create the following:
<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!--The SourceReferenceValue tag is not valid AAF XML.--> <SourceReferenceValue> <SourceID>urn:x-umid:000000000000000000000000-00-000000-00000000000000000000000000000000</SourceID> <SourceTrackID>0</SourceTrackID> <StartTime>0</StartTime> </SourceReferenceValue>
public SourceReferenceValue clone()
public void appendXMLChildren(Node parent)
XMLSerializableAppend 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.
appendXMLChildren in interface XMLSerializableparent - XML parent element to append child nodes to.public String getComment()
XMLSerializableInclude a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.
getComment in interface XMLSerializable(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.