Class Element.AttributeSequence

    • 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 - New attribute to add.
        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 - The new attribute to insert.
        index - The location where it is to be inserted.
        Throws:
        java.lang.IllegalArgumentException - if the attribute is null or if the attribute already is assigned to an element, or if the attribute's name has already been added here.
      • 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 - Starting location for the attributes to remove.
        count - Number to remove.
        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 - Index of the item to retrieve.
        Returns:
        The item at that index, or null if there is no attribute at that index.
      • indexOf

        public int indexOf​(Element.Attribute attribute)
        Determines the index of an attribute.
        Specified by:
        indexOf in interface Sequence<Element.Attribute>
        Parameters:
        attribute - The attribute to look up.
        Returns:
        The index of the attribute, if found; otherwise -1.
      • getLength

        public int getLength()
        Description copied from interface: Sequence
        Returns the length of the sequence.
        Specified by:
        getLength in interface Sequence<Element.Attribute>
        Returns:
        The number of attributes in the sequence.
      • iterator

        public java.util.Iterator<Element.Attribute> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Element.Attribute>
        Returns:
        An iterator over the attribute sequence.