net.sf.okapi.lib.xliff2.document

## Class GroupNode

- java.lang.Object
- - net.sf.okapi.lib.xliff2.document.GroupOrUnitNode
  - - net.sf.okapi.lib.xliff2.document.GroupNode

-     public class GroupNode
      extends GroupOrUnitNode

  Represents a group node.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GroupNode(GroupNode parent, StartGroupData data)` Creates a new `GroupNode` object with a given `StartGroupData` resource and parent.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `GroupNode` | `add(GroupNode node)` Adds a `GroupNode` to this group node.
    `void` | `add(InsingnificantPartData data, boolean placeBefore)`
    `UnitNode` | `add(UnitNode node)` Adds a `UnitNode` to this group node.
    `java.util.Iterator<Event>` | `createEventIterator(java.util.Stack<URIContext> uriContext)` Creates an iterator for the events in this group node.
    `java.util.Iterator<GroupOrUnitNode>` | `createGroupOrUnitIterator()` Creates an iterator for the group nodes and unit nodes in this group node.
    `StartGroupData` | `get()` Gets the `StartGroupData` resource for this group node.
    `GroupNode` | `getGroupNode(java.lang.String id)` Gets a `GroupNode` for a given id.
    `GroupNode` | `getParent()` Gets the parent for this group node.
    `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 group node.
    `boolean` | `isUnit()` Indicates if this node is a UnitNode.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GroupNode

          public GroupNode(GroupNode parent,
                   StartGroupData data)

      Creates a new `GroupNode` object with a given `StartGroupData` resource and parent.
      Parameters:
        `parent` - the parent of this new group node (use null for top-level groups).
        `data` - the data for this new group node.

  - ### Method Detail

    - #### get

          public StartGroupData get()

      Gets the `StartGroupData` resource for this group node.
      Returns:
        the resource for this group node.

    - #### isUnit

          public boolean isUnit()

      Description copied from class: `GroupOrUnitNode`
      Indicates if this node is a UnitNode.
      Overrides:
        `isUnit` in class `GroupOrUnitNode`
      Returns:
        true if it is a UnitNode, false if it is a GroupNode.

    - #### add

          public UnitNode add(UnitNode node)

      Adds a `UnitNode` to this group node.
      Parameters:
        `node` - the unit node to add.
      Returns:
        the added unit node.

    - #### add

          public GroupNode add(GroupNode node)

      Adds a `GroupNode` to this group node.
      Parameters:
        `node` - the group node to add.
      Returns:
        the added group node.

    - #### getParent

          public GroupNode getParent()

      Gets the parent for this group node.
      Returns:
        the parent for this group node, or null for a top-level group.

    - #### getUnitNode

          public UnitNode getUnitNode(java.lang.String id)

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

    - #### getGroupNode

          public GroupNode getGroupNode(java.lang.String id)

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

    - #### createGroupOrUnitIterator

          public java.util.Iterator<GroupOrUnitNode> createGroupOrUnitIterator()

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

    - #### createEventIterator

          public java.util.Iterator<Event> createEventIterator(java.util.Stack<URIContext> uriContext)

      Creates an iterator for the events in this group node.
      Parameters:
        `uriContext` - the URI context.
      Returns:
        a new iterator for the events in this group node.

    - #### getUnitNodes

          public java.util.List<UnitNode> getUnitNodes()

      Gets all the `UnitNode` elements of this group node. All units at any level (including nested groups) in this group node are returned.
      Returns:
        all the unit nodes for the group node. The list will be empty (but never NULL) if no unit nodes were found.

    - #### add

          public void add(InsingnificantPartData data,
                 boolean placeBefore)