Class SingletonAttributeMap

    • Method Detail

      • size

        public int size()
        Return the number of attributes in the map.
        Specified by:
        size in interface AttributeMap
        Returns:
        The number of attributes in the map.
      • get

        public AttributeInfo get​(NodeName name)
        Description copied from interface: AttributeMap
        Get the attribute with a given name, if it exists
        Specified by:
        get in interface AttributeMap
        Parameters:
        name - the name of the required attribute
        Returns:
        the required attribute if it exists
      • get

        public AttributeInfo get​(NamespaceUri uri,
                                 java.lang.String local)
        Description copied from interface: AttributeMap
        Get the attribute with a given name, if it exists
        Specified by:
        get in interface AttributeMap
        Parameters:
        uri - the namespace part of the name of the required attribute
        local - the local part of the name of the required attribute
        Returns:
        the required attribute if it exists
      • put

        public AttributeMap put​(AttributeInfo att)
        Description copied from interface: AttributeMap
        Replace or add an attribute, to create a new AttributeMap
        Specified by:
        put in interface AttributeMap
        Parameters:
        att - the attribute to be added or replaced
        Returns:
        the new AttributeMap
      • remove

        public AttributeMap remove​(NodeName name)
        Description copied from interface: AttributeMap
        Remove an existing attribute, to create a new AttributeMap
        Specified by:
        remove in interface AttributeMap
        Parameters:
        name - the name of the attribute to be removed (if it exists)
        Returns:
        a new attribute map in which the specified attribute is omitted. If the attribute map contains no attribute with the given name, the input attribute map (or one equivalent to it) is returned unchanged
      • iterator

        public java.util.Iterator<AttributeInfo> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<AttributeInfo>
      • apply

        public AttributeMap apply​(java.util.function.Function<AttributeInfo,​AttributeInfo> mapper)
        Description copied from interface: AttributeMap
        Apply a function to every attribute in an attribute map, returning a new attribute map
        Specified by:
        apply in interface AttributeMap
        Parameters:
        mapper - the mapping function to be applied to each attribute in the attribute map
        Returns:
        the attribute containing the attributes after the mapping function has been applied
      • asList

        public java.util.ArrayList<AttributeInfo> asList()
        Description copied from interface: AttributeMap
        Get the contents of the AttributeMap as a list of AttributeInfo objects.

        The order of the returned list must be consistent with document order, with the order of the attribute axis, and with position-based retrieval of individual AttributeInfo objects; multiple calls are not required to return the same list, but they must be consistent in their ordering.

        Modifying the returned list has no effect on the AttributeMap

        Specified by:
        asList in interface AttributeMap
        Returns:
        a list of attributes in the AttributeMap
      • itemAt

        public AttributeInfo itemAt​(int index)
        Description copied from interface: AttributeMap
        Get the AttributeInfo with a given index.
        Specified by:
        itemAt in interface AttributeMap
        Parameters:
        index - the index position, zero-based. The order of index positions of attributes in an attribute map reflects document order.
        Returns:
        the AttributeInfo at the given position. In an immutable tree the result will always be equivalent to calling asList().get(index). However, if the tree has been modified, then the index values of the attributes may not be contiguous.