net.sf.okapi.lib.xliff2.document

## Interface IWithGroupOrUnitNode

- All Known Implementing Classes:
    FileNode, GroupNode, WithGroupOrUnitNode

      public interface IWithGroupOrUnitNode

  Represents a node that holds groups or units (or both).

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `GroupNode` | `add(GroupNode node)` Adds a `GroupNode` to this object.
    `UnitNode` | `add(UnitNode node)` Adds a `UnitNode` to this object.
    `GroupNode` | `addGroupNode(java.lang.String id)` Adds a `GroupNode` to this object.
    `UnitNode` | `addUnitNode(java.lang.String id)` Adds a `UnitNode` to this object.
    `java.util.Iterator<IGroupOrUnitNode>` | `createGroupOrUnitIterator()` Creates an iterator for the group nodes and unit nodes in this object.
    `GroupNode` | `getGroupNode(java.lang.String id)` Gets a `GroupNode` for a given id.
    `UnitNode` | `getUnitNode(java.lang.String id)` Gets the `UnitNode` for a given unit id.
    `java.util.List<UnitNode>` | `getUnitNodes()` Gets all the `UnitNode` elements of this object.

- - ### Method Detail

    - #### add

          UnitNode add(UnitNode node)

      Adds a `UnitNode` to this object.
      Parameters:
        `node` - the unit node to add.
      Returns:
        the added unit node.
      See Also:
        `addUnitNode(String)`

    - #### addUnitNode

          UnitNode addUnitNode(java.lang.String id)

      Adds a `UnitNode` to this object.
      Parameters:
        `id` - the ID of the new unit.
      Returns:
        the added unit node.

    - #### add

          GroupNode add(GroupNode node)

      Adds a `GroupNode` to this object. If the group ID is null, it is automatically set to a UUID.
      Parameters:
        `node` - the group node to add.
      Returns:
        the added group node.
      See Also:
        `addGroupNode(String)`

    - #### addGroupNode

          GroupNode addGroupNode(java.lang.String id)

      Adds a `GroupNode` to this object.
      Parameters:
        `id` - the ID of the group (can be null). If the ID is null it is automatically set to a UUID.
      Returns:
        the added group node.

    - #### getUnitNodes

          java.util.List<UnitNode> getUnitNodes()

      Gets all the `UnitNode` elements of this object. All units at any level in this object are returned.
      Returns:
        all the unit nodes for the object. The list will be empty (but never null), if no unit nodes were found.

    - #### getUnitNode

          UnitNode getUnitNode(java.lang.String id)

      Gets the `UnitNode` for a given unit id. The unit can be at any level in this object.
      Parameters:
        `id` - the id to look for.
      Returns:
        the unit node for the given id, or null if none is found.

    - #### getGroupNode

          GroupNode getGroupNode(java.lang.String id)

      Gets a `GroupNode` for a given id. The group can be at any level in this object.
      Parameters:
        `id` - the id to look for.
      Returns:
        the group node for the given id, or null if none is found.

    - #### createGroupOrUnitIterator

          java.util.Iterator<IGroupOrUnitNode> createGroupOrUnitIterator()

      Creates an iterator for the group nodes and unit nodes in this object.
      Returns:
        a new iterator for the nodes in this object.