Class AbstractElementNode

java.lang.Object
com.puppycrawl.tools.checkstyle.xpath.AbstractNode
com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode
All Implemented Interfaces:
Source, SourceLocator, net.sf.saxon.lib.ActiveSource, net.sf.saxon.om.GroundedValue, net.sf.saxon.om.Item, net.sf.saxon.om.NodeInfo, net.sf.saxon.om.Sequence, net.sf.saxon.s9api.Location, Locator
Direct Known Subclasses:
ElementNode

public abstract class AbstractElementNode extends AbstractNode
Represents element node of Xpath-tree.
  • Field Details

  • Constructor Details

    • AbstractElementNode

      protected AbstractElementNode(AbstractNode root, AbstractNode parent, int depth, int indexAmongSiblings)
      Creates a new AbstractElementNode instance.
      Parameters:
      root - Node root of the tree
      parent - Node parent of the current node
      depth - the current node depth in the hierarchy
      indexAmongSiblings - the current node index among the parent children nodes
  • Method Details

    • createAttributeNode

      protected abstract AttributeNode createAttributeNode()
      Creates AttributeNode object and returns it.
      Returns:
      attribute node if possible, otherwise the null value
    • compareOrder

      public int compareOrder(net.sf.saxon.om.NodeInfo other)
      Compares current object with specified for order.
      Parameters:
      other - another NodeInfo object
      Returns:
      number representing order of current object to specified one
    • compareCommonAncestorChildrenOrder

      private static int compareCommonAncestorChildrenOrder(net.sf.saxon.om.NodeInfo first, net.sf.saxon.om.NodeInfo second)
      Walks up the hierarchy until a common ancestor is found. Then compares topmost sibling nodes.
      Parameters:
      first - NodeInfo to compare
      second - NodeInfo to compare
      Returns:
      the value 0 if first == second; a value less than 0 if first should be first; a value greater than 0 if second should be first.
    • getDepth

      public int getDepth()
      Getter method for node depth.
      Specified by:
      getDepth in class AbstractNode
      Returns:
      depth
    • getAttributeValue

      public String getAttributeValue(net.sf.saxon.om.NamespaceUri namespace, String localPart)
      Returns attribute value.
      Parameters:
      namespace - namespace
      localPart - actual name of the attribute
      Returns:
      attribute value or null if the attribute was not found
    • getNodeKind

      public int getNodeKind()
      Returns type of the node.
      Returns:
      node kind
    • getParent

      public net.sf.saxon.om.NodeInfo getParent()
      Returns parent.
      Returns:
      parent
    • getRoot

      Returns root.
      Returns:
      root
    • iterateAxis

      public net.sf.saxon.tree.iter.AxisIterator iterateAxis(int axisNumber)
      Determines axis iteration algorithm. Throws UnsupportedOperationException in case, when there is no axis iterator for given axisNumber.

      Reason of suppression for resource, IOResourceOpenedButNotSafelyClosed: AxisIterator implements Closeable interface, but none of the subclasses of the AxisIterator class has non-empty close() method.

      Parameters:
      axisNumber - element from AxisInfo
      Returns:
      AxisIterator object
    • getPrecedingSiblingsIterator

      private net.sf.saxon.tree.iter.AxisIterator getPrecedingSiblingsIterator()
      Returns preceding sibling axis iterator.

      Reason of suppression for resource, IOResourceOpenedButNotSafelyClosed: AxisIterator implements Closeable interface, but none of the subclasses of the AxisIterator class has non-empty close() method.

      Returns:
      iterator
    • getFollowingSiblingsIterator

      private net.sf.saxon.tree.iter.AxisIterator getFollowingSiblingsIterator()
      Returns following sibling axis iterator.

      Reason of suppression for resource, IOResourceOpenedButNotSafelyClosed: AxisIterator implements Closeable interface, but none of the subclasses of the AxisIterator class has non-empty close() method.

      Returns:
      iterator
    • getFollowingSiblings

      Returns following siblings of the current node.
      Returns:
      siblings
    • getPrecedingSiblings

      Returns preceding siblings of the current node.
      Returns:
      siblings
    • getAttributeNode

      Checks if token type supports @text attribute, extracts its value, creates AttributeNode object and returns it. Value can be accessed using @text attribute.
      Returns:
      attribute node if possible, otherwise the null value
    • throwUnsupportedOperationException

      Returns UnsupportedOperationException exception.
      Returns:
      UnsupportedOperationException exception