Package net.sf.okapi.lib.xliff2.core
Class ExtElements
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.core.ExtElements
-
- All Implemented Interfaces:
Iterable<ExtElement>
public class ExtElements extends Object implements Iterable<ExtElement>
Represents a set ofExtElementobjects.
-
-
Constructor Summary
Constructors Constructor Description ExtElements()Creates an emptyExtElementsobject.ExtElements(ExtElements original)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExtElementadd(String namespaceURI, String localPart, String prefix)Adds a newExtElementobject to this set.ExtElementadd(ExtElement element)Adds an element to this set.List<ExtElement>find(String namespaceURI, String localName)Gets a list of all child elements for a given namespace and name for this element (not recursively)ExtElementget(int index)Gets the element at a given position.ExtElementgetOrCreate(String namespaceURI, String localName, String prefix)Get and if needed, create before, a given element from this set.booleanisEmpty()Indicates if this set has at least one element.Iterator<ExtElement>iterator()intsize()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
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ExtElements
public ExtElements()
Creates an emptyExtElementsobject.
-
ExtElements
public ExtElements(ExtElements original)
Copy constructor.- Parameters:
original- the original object to duplicate.
-
-
Method Detail
-
iterator
public Iterator<ExtElement> iterator()
- Specified by:
iteratorin interfaceIterable<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(String namespaceURI, String localPart, String prefix)
Adds a newExtElementobject to this set.- Parameters:
namespaceURI- the namespace URI of the element.localPart- the locale part of the element name.prefix- the prefix.- Returns:
- the element created.
-
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:
IndexOutOfBoundsException- if the position is invalid.
-
find
public List<ExtElement> find(String namespaceURI, 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(String namespaceURI, String localName, 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.
-
-