Class Atts


  • public final class Atts
    extends ElementList
    Resizable-array implementation for attributes (name/value pairs).
    Author:
    BaseX Team 2005-23, BSD License, Christian Gruen
    • Constructor Summary

      Constructors 
      Constructor Description
      Atts()
      Default constructor.
      Atts​(long capacity)
      Constructor with initial capacity.
      Atts​(Atts atts)
      Constructor.
    • Constructor Detail

      • Atts

        public Atts()
        Default constructor.
      • Atts

        public Atts​(long capacity)
        Constructor with initial capacity.
        Parameters:
        capacity - array capacity
      • Atts

        public Atts​(Atts atts)
        Constructor.
        Parameters:
        atts - object to copy
    • Method Detail

      • size

        public int size()
        Description copied from class: ElementList
        Returns the number of elements.
        Overrides:
        size in class ElementList
        Returns:
        number of elements
      • size

        public void size​(int sz)
        Description copied from class: ElementList
        Enforces the number of elements.
        Overrides:
        size in class ElementList
        Parameters:
        sz - number of elements
      • add

        public Atts add​(byte[] name,
                        byte[] value)
        Adds the next name/value pair.
        Parameters:
        name - name to be added (can be null)
        value - value to be added (can be null)
        Returns:
        self reference
      • add

        public Atts add​(byte[] name,
                        byte[] value,
                        boolean stripNS)
        Adds the next name/value pair.
        Parameters:
        name - name to be added (can be null)
        value - value to be added (can be null)
        stripNS - strip namespaces
        Returns:
        self reference
      • remove

        public Atts remove​(int index)
        Removes the element at the specified position.
        Parameters:
        index - entry index
        Returns:
        self reference
      • contains

        public boolean contains​(byte[] name)
        Checks if the specified name is found.
        Parameters:
        name - name to be found
        Returns:
        result of check
      • get

        public int get​(byte[] name)
        Returns the offset to the specified name.
        Parameters:
        name - name to be found
        Returns:
        offset or -1
      • name

        public byte[] name​(int index)
        Returns the name at the specified index position.
        Parameters:
        index - index
        Returns:
        name
      • value

        public byte[] value​(int index)
        Returns the value at the specified index position.
        Parameters:
        index - index
        Returns:
        value
      • value

        public byte[] value​(byte[] name)
        Returns the value for the specified name or null.
        Parameters:
        name - name to be found
        Returns:
        offset or -1
      • optimize

        public Atts optimize()
        Optimizes the attribute list.
        Returns:
        self reference
      • equals

        public boolean equals​(Atts atts)
        Compares attributes.
        Parameters:
        atts - attributes to be compared
        Returns:
        result of check