net.sf.okapi.lib.xliff2.core

## Class ExtElements

- java.lang.Object
- - net.sf.okapi.lib.xliff2.core.ExtElements

- All Implemented Interfaces:
    java.lang.Iterable<ExtElement>

      public class ExtElements
      extends java.lang.Object
      implements java.lang.Iterable<ExtElement>

  Represents a set of `ExtElement` objects.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExtElements()` Creates an empty `ExtElements` object.
    `ExtElements(ExtElements original)` Copy constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ExtElement` | `add(ExtElement element)` Adds an element to this set.
    `ExtElement` | `add(java.lang.String namespaceURI, java.lang.String localPart, java.lang.String prefix)` Adds a new `ExtElement` object to this set.
    `java.util.List<ExtElement>` | `find(java.lang.String namespaceURI, java.lang.String localName)` Gets a list of all child elements for a given namespace and name for this element (not recursively)
    `ExtElement` | `get(int index)` Gets the element at a given position.
    `ExtElement` | `getOrCreate(java.lang.String namespaceURI, java.lang.String localName, java.lang.String prefix)` Get and if needed, create before, a given element from this set.
    `boolean` | `isEmpty()` Indicates if this set has at least one element.
    `java.util.Iterator<ExtElement>` | `iterator()`
    `int` | `size()` Gets the number of elements in this set.

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

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

- - ### Constructor Detail

    - #### ExtElements

          public ExtElements()

      Creates an empty `ExtElements` object.

    - #### ExtElements

          public ExtElements(ExtElements original)

      Copy constructor.
      Parameters:
        `original` - the original object to duplicate.

  - ### Method Detail

    - #### iterator

          public java.util.Iterator<ExtElement> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<ExtElement>`

    - #### add

          public ExtElement add(ExtElement element)

      Adds an element to this set.
      Parameters:
        `element` - the element to add.
      Returns:
        the added element (same as the parameter).

    - #### add

          public ExtElement add(java.lang.String namespaceURI,
                       java.lang.String localPart,
                       java.lang.String prefix)

      Adds a new `ExtElement` object to this set.
      Parameters:
        `namespaceURI` - the namespace URI of the element.
        `localPart` - the locale part of the element name.
        `prefix` - the prefix.

    - #### size

          public int size()

      Gets the number of elements in this set.
      Returns:
        the number of elements in this set.

    - #### isEmpty

          public boolean isEmpty()

      Indicates if this set has at least one element.
      Returns:
        true if this set as at least one element, false if it has none.

    - #### get

          public ExtElement get(int index)

      Gets the element at a given position.
      Parameters:
        `index` - the position of the element to retrieve.
      Returns:
        the element at the given position.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the position is invalid.

    - #### find

          public java.util.List<ExtElement> find(java.lang.String namespaceURI,
                                        java.lang.String localName)

      Gets a list of all child elements for a given namespace and name for this element (not recursively)
      Parameters:
        `namespaceURI` - the namespace of the elements to list.
        `localName` - the name of the elements to list.
      Returns:
        the list (it may be empty, but never null)

    - #### getOrCreate

          public ExtElement getOrCreate(java.lang.String namespaceURI,
                               java.lang.String localName,
                               java.lang.String prefix)

      Get and if needed, create before, a given element from this set.
      Parameters:
        `namespaceURI` - the namespace of the element.
        `localName` - the name of the element.
        `prefix` - the prefix to use if it needs to be created.
      Returns:
        the element searched for: the first existing one, or one just created.