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

tv.amwa.maj.meta

## Interface TypeDefinitionSet

- All Superinterfaces:
    MetadataObject, MetaDefinition, TypeDefinition, WeakReferenceTarget
  All Known Implementing Classes:
    TypeDefinitionSetImpl

      public interface TypeDefinitionSet
      extends TypeDefinition

  Specifies the definition of a property type that has a collection of object references to uniquely identified objects. The order of the objects has no meaning.

  Note that the element type for a set must be a reference type. For example and as a result, it is not possible to define a set of integer values.

  See Also:
    `TypeCategory.Set`, `TypeDefinitionFixedArray`, `TypeDefinitionVariableArray`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addElement(PropertyValue setPropertyValue, PropertyValue elementPropertyValue)` Adds the given element to the given set, which is represented by the given property value of this set type definition.
    `TypeDefinitionSet` | `clone()` Create a cloned copy of this set type definition.
    `boolean` | `containsElement(PropertyValue setPropertyValue, PropertyValue elementPropertyValue)` Returns `true` if the given element is contained in the given set; otherwise `false`.
    `PropertyValue` | `createEmptySet()` Create a property value with an empty set, ready to hold property values of this type definitions element type.
    `int` | `getCount(PropertyValue setPropertyValue)` Returns the number of elements in the given set, or -1 if the set is `null`.
    `Set<PropertyValue>` | `getElements(PropertyValue setPropertyValue)` Returns a copy of the set of all the elements in the given set property value.
    `TypeDefinition` | `getElementType()` Returns the type of elements referenced from the defined set.
    `void` | `removeElement(PropertyValue setPropertyValue, PropertyValue elementPropertyValue)` Removes the given element from the given set, which is represented by the given property value of this set type definition.

    - ### Methods inherited from interface tv.amwa.maj.meta.TypeDefinition

      `createFromBytes, createValue, getPropertyValue, getTypeCategory, lengthAsBytes, resolveReferences, setPropertyValue, writeAsBytes, writeAsStructuredStorageBytes`

    - ### Methods inherited from interface tv.amwa.maj.meta.MetaDefinition

      `appendMetadictXML, deepEquals, equals, getAAFNamesInUse, getAliases, getAUID, getDescription, getName, getNamespace, getPrefix, getSymbol, hashCode, setAAFNamesInUse, setDescription, setName, setNamespace, setPrefix, setSymbol, toString`

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

      `getWeakTargetReference`

- - ### Method Detail

    - #### getElementType

          TypeDefinition getElementType()

      Returns the type of elements referenced from the defined set.

      Returns:
        Type of elements referenced from the defined set.
      See Also:
        `TypeDefinitionObjectReference.getObjectType()`

    - #### addElement

          void addElement(PropertyValue setPropertyValue,
                          PropertyValue elementPropertyValue)
                   throws NullPointerException,
                          IllegalPropertyValueException,
                          BadTypeException

      Adds the given element to the given set, which is represented by the given property value of this set type definition.

      Parameters:
        `setPropertyValue` - Set to add the given element to.
        `elementPropertyValue` - Element to add to the given set.
      Throws:
        `NullPointerException` - One or both of the arguments is/are `null`.
        `IllegalPropertyValueException` - The type of the given property value does not match this set type definition.
        `BadTypeException` - The type of the given element property value does not match the element type of this set type definition.

    - #### removeElement

          void removeElement(PropertyValue setPropertyValue,
                             PropertyValue elementPropertyValue)
                      throws NullPointerException,
                             IllegalPropertyValueException,
                             BadTypeException,
                             ObjectNotFoundException

      Removes the given element from the given set, which is represented by the given property value of this set type definition.

      Parameters:
        `setPropertyValue` - Set to remove the given element from.
        `elementPropertyValue` - Element to remove from the given set.
      Throws:
        `NullPointerException` - One or both of the arguments is/are `null`.
        `IllegalPropertyValueException` - The type of the given property value does not match this set type definition.
        `BadTypeException` - The type of the given element for removal does not match the element type of this set type definition.
        `ObjectNotFoundException` - The given element to remove cannot be found in the given set property value.

    - #### containsElement

          @Bool
          boolean containsElement(PropertyValue setPropertyValue,
                                        PropertyValue elementPropertyValue)
                                 throws NullPointerException,
                                        IllegalPropertyValueException

      Returns `true` if the given element is contained in the given set; otherwise `false`. The set to test membership for is represented by the given property value of this set type definition.

      Parameters:
        `setPropertyValue` - Set to check for the given element.
        `elementPropertyValue` - Element to check for in the given set.
      Returns:
        Is the given element contained in the given set?
      Throws:
        `NullPointerException` - One or both of the arguments is/are `null`.
        `IllegalPropertyValueException` - The type of the given property value does not match this set type definition.

    - #### getCount

          @UInt32
          int getCount(PropertyValue setPropertyValue)
                        throws NullPointerException,
                               IllegalPropertyValueException

      Returns the number of elements in the given set, or -1 if the set is `null`. The set to count the members for is represented by the given property value of this set type definition.

      Parameters:
        `setPropertyValue` - Property value containing a set.
      Returns:
        Number of elements in the given set.
      Throws:
        `NullPointerException` - The given set property value is `null`.
        `IllegalPropertyValueException` - The type of the given property value does not match this set type definition.

    - #### getElements

          Set<PropertyValue> getElements(PropertyValue setPropertyValue)
                                  throws NullPointerException,
                                         IllegalPropertyValueException

      Returns a copy of the set of all the elements in the given set property value.

      Parameters:
        `setPropertyValue` - Property value to read and returns the elements for.
      Returns:
        Shallow copy of the value of the given set property value.
      Throws:
        `NullPointerException` - The given set property value is `null`.
        `IllegalPropertyValueException` - The type of the given argument does not match this set type definition.

    - #### createEmptySet

          PropertyValue createEmptySet()

      Create a property value with an empty set, ready to hold property values of this type definitions element type. Call `addElement(PropertyValue, PropertyValue)` to add elements to this set.

      Returns:
        New property value containing an empty set.

    - #### clone

          TypeDefinitionSet clone()

      Create a cloned copy of this set type definition.

      Specified by:
        `clone` in interface `MetaDefinition`
      Specified by:
        `clone` in interface `TypeDefinition`
      Returns:
        Cloned copy of this set type definition.

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