org.apache.pivot.xml
Class Element.AttributeSequence

java.lang.Object
  extended by org.apache.pivot.xml.Element.AttributeSequence
All Implemented Interfaces:
Iterable<Element.Attribute>, Sequence<Element.Attribute>
Enclosing class:
Element

public class Element.AttributeSequence
extends Object
implements Sequence<Element.Attribute>, Iterable<Element.Attribute>

Sequence representing the attributes declared by this element.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
 
Method Summary
 int add(Element.Attribute attribute)
          Adds an attribute to the sequence.
 Element.Attribute get(int index)
          Returns the attribute at a given index.
 int getLength()
          Returns the number of attributes in the sequence.
 int indexOf(Element.Attribute attribute)
          Determines the index of an attribute.
 void insert(Element.Attribute attribute, int index)
          Inserts an attribute into the sequence at a specific location.
 Iterator<Element.Attribute> iterator()
          Returns an iterator over the attribute sequence.
 int remove(Element.Attribute attribute)
          Removes an attribute from the sequence.
 Sequence<Element.Attribute> remove(int index, int count)
          Removes a range of attributes from the sequence.
 Element.Attribute update(int index, Element.Attribute item)
          Updates the item at the given index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public int add(Element.Attribute attribute)
Adds an attribute to the sequence.

Specified by:
add in interface Sequence<Element.Attribute>
Parameters:
attribute -
Returns:
The index at which the item was added, or -1 if the item was not added to the sequence.

insert

public void insert(Element.Attribute attribute,
                   int index)
Inserts an attribute into the sequence at a specific location.

Specified by:
insert in interface Sequence<Element.Attribute>
Parameters:
attribute -
index -

update

public Element.Attribute update(int index,
                                Element.Attribute item)
Description copied from interface: Sequence
Updates the item at the given index.

Specified by:
update in interface Sequence<Element.Attribute>
Parameters:
index - The index of the item to update.
item - The item that will replace any existing value at the given index.
Returns:
The item that was previously stored at the given index.
Throws:
UnsupportedOperationException - This method is not supported. Use Element.Attribute.setValue(String) instead.

remove

public int remove(Element.Attribute attribute)
Removes an attribute from the sequence.

Specified by:
remove in interface Sequence<Element.Attribute>
Parameters:
attribute -
Returns:
The index of the item that was removed, or -1 if the item could not be found.
See Also:
Sequence.remove(int, int)

remove

public Sequence<Element.Attribute> remove(int index,
                                          int count)
Removes a range of attributes from the sequence.

Specified by:
remove in interface Sequence<Element.Attribute>
Parameters:
index -
count -
Returns:
A sequence containing the items that were removed.

get

public Element.Attribute get(int index)
Returns the attribute at a given index.

Specified by:
get in interface Sequence<Element.Attribute>
Parameters:
index -

indexOf

public int indexOf(Element.Attribute attribute)
Determines the index of an attribute.

Specified by:
indexOf in interface Sequence<Element.Attribute>
Parameters:
attribute -
Returns:
The index of the attribute, if found; otherwise, -1.

getLength

public int getLength()
Returns the number of attributes in the sequence.

Specified by:
getLength in interface Sequence<Element.Attribute>
Returns:
The number of items in the sequence.

iterator

public Iterator<Element.Attribute> iterator()
Returns an iterator over the attribute sequence.

Specified by:
iterator in interface Iterable<Element.Attribute>