Media Authoring
with Java API

tv.amwa.maj.entity
Class VaryingValue

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

@AAFClass(uuid1=218169601,
          uuid2=257,
          uuid3=15872,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="VaryingValue",
          description="The VaryingValue class specifies a changing data value for an effect control value.")
public class VaryingValue
extends Parameter
implements VaryingValue, Serializable, Cloneable, MAJCommon

Implements a changing data value for an effect control value.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class VaryingValue.PointListXMLHandler
           
static class VaryingValue.XMLHandler
           
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.Parameter
Parameter.ParameterXMLHandler
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.InterchangeObject
InterchangeObject.InterchangeObjectXMLHandler
 
Constructor Summary
VaryingValue(ParameterDefinition parameterDefinition, InterpolationDefinition interpolation)
          Creates and initializes a new varying value object, which specifies a changing data value for an effect control value.
 
Method Summary
 void addControlPoint(ControlPoint controlPoint)
          Adds a control point to the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.
 void appendXMLChildren(Node parent)
          Append child elements to the given parent node to serialize the value of an object to an XML fragment.
 VaryingValue clone()
          Creates a cloned copy of this entity.
 int countControlPoints()
          Returns the number of control points in the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.
 boolean equals(Object o)
          Tests to see if the given object is equal to this interchange object.
 ControlPoint getControlPointAt(int index)
          Retrieves the input control point at the given index in the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.
 List<ControlPoint> getControlPoints()
          Returns the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.
 Object getInterpolatedValue(Rational inputValue)
          Returns the interpolated value of the varying value at a given time position, which should be a value between 0 and 1 inclusive.
 InterpolationDefinition getInterpolationDefinition()
          Returns the interpolation property of this varying value, which specifies the kind of interpolation to be used to find the value between control points.
 int hashCode()
          Returns a hash code value for this interchange object.
 void removeControlPointAt(int index)
          This function removes the input control point at the given index in the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.
 void setPropertiesFromInterface(VaryingValue castFrom)
           
 
Methods inherited from class tv.amwa.maj.entity.Parameter
getDefinitionValue, getId, getParameterDefinition, getTypeDefinition, setId, setParameterDefinition, 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.Parameter
getParameterDefinition, getTypeDefinition
 
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
 

Constructor Detail

VaryingValue

public VaryingValue(ParameterDefinition parameterDefinition,
                    InterpolationDefinition interpolation)
             throws NullPointerException

Creates and initializes a new varying value object, which specifies a changing data value for an effect control value. The value is identified with the given the given parameter definition, and requires an interpolation definition. Although the list of control points should not be empty, varying values are used to create control point. The process of setting up a varying value is as follows:

  1. Create a varying value with its parameter and interpolation definition.
  2. Use the varying value to create the control points for the varying value.
  3. Add the control points to the varying value list using addControlPoint(ControlPoint).

Parameters:
parameterDefinition - Parameter definition for the varying value, which determines the type of the varying value.
interpolation - Specifies the kind of interpolation to be used to find the value between control points.
Throws:
NullPointerException - One or more of the arguments is null and all are required.
Method Detail

setPropertiesFromInterface

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

getControlPoints

@AAFProperty(uuid1=100729092,
             uuid2=1542,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="PointList",
             typeName="StrongReferenceVector of ControlPoint",
             optional=false,
             uniqueIdentifier=false,
             pid=19970)
public List<ControlPoint> getControlPoints()
Description copied from interface: VaryingValue

Returns the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.

Specified by:
getControlPoints in interface VaryingValue
Returns:
Shallow copy of the sequence of control points of this varying value.

addControlPoint

public void addControlPoint(ControlPoint controlPoint)
                     throws NullPointerException,
                            IllegalArgumentException
Description copied from interface: VaryingValue

Adds a control point to the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined. The point will be sorted by time order, not the order that the points were added in.

Specified by:
addControlPoint in interface VaryingValue
Parameters:
controlPoint - Control point to add to the sequence of control points.
Throws:
NullPointerException - The given control point is null.
IllegalArgumentException

countControlPoints

public int countControlPoints()
Description copied from interface: VaryingValue

Returns the number of control points in the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.

Specified by:
countControlPoints in interface VaryingValue
Returns:
Number of control points in the sequence of control points of the varying value.

getControlPointAt

public ControlPoint getControlPointAt(int index)
                               throws IndexOutOfBoundsException
Description copied from interface: VaryingValue

Retrieves the input control point at the given index in the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined.

Specified by:
getControlPointAt in interface VaryingValue
Parameters:
index - 0-based index of the control point to retrieve.
Returns:
Input control point at the given index in the sequence of control points of this varying value.
Throws:
IndexOutOfBoundsException - The given index is outside the acceptable range for the current sequence of control points of this varying value.

removeControlPointAt

public void removeControlPointAt(int index)
                          throws IndexOutOfBoundsException
Description copied from interface: VaryingValue

This function removes the input control point at the given index in the sequence of control points of this varying value, each of which specifies a value and a time point at which the value is defined. Control points already existing at indices higher than the given index will be moved to the next lower index to accommodate.

Specified by:
removeControlPointAt in interface VaryingValue
Parameters:
index - Index of control point to remove from the sequence.
Throws:
IndexOutOfBoundsException - The index is outside acceptable range for the current sequence of control points of this varying value.

getInterpolatedValue

public Object getInterpolatedValue(Rational inputValue)
                            throws NullPointerException
Description copied from interface: VaryingValue

Returns the interpolated value of the varying value at a given time position, which should be a value between 0 and 1 inclusive. The data type of the value contained in the value returned will be the same as the data type of the parameter this varying value provides a value for, which is the same as the data type of all of the control points.

Specified by:
getInterpolatedValue in interface VaryingValue
Parameters:
inputValue - Time position along the operation group to find the interpolated value for.
Returns:
Buffer containing the interpolated value of the varying value at a given position.
Throws:
NullPointerException - The given input value is null.
See Also:
VaryingValue.getInterpolationDefinition(), InterpolationConstant, Parameter.getTypeDefinition(), ControlPoint.getTypeDefinition(), TypeDefinition.createValue(Object), PropertyValue.getValue()

getInterpolationDefinition

@AAFProperty(uuid1=100729092,
             uuid2=261,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="Interpolation",
             typeName="WeakReference to InterpolationDefinition",
             optional=false,
             uniqueIdentifier=false,
             pid=19969)
public InterpolationDefinition getInterpolationDefinition()
Description copied from interface: VaryingValue

Returns the interpolation property of this varying value, which specifies the kind of interpolation to be used to find the value between control points.

Specified by:
getInterpolationDefinition in interface VaryingValue
Returns:
Interpolation definition referenced by this varying value.
See Also:
VaryingValue.getInterpolatedValue(Rational), InterpolationConstant

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 Parameter
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 Parameter
Returns:
Hash code value for this interchange object.
See Also:
Object.hashCode()

clone

public VaryingValue 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 Parameter
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 Parameter
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.