Class RootNode

java.lang.Object
com.puppycrawl.tools.checkstyle.xpath.AbstractNode
com.puppycrawl.tools.checkstyle.xpath.RootNode
All Implemented Interfaces:
Source, SourceLocator, 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

public class RootNode extends AbstractNode
Represents root node of Xpath-tree.
  • Field Details

    • ROOT_NAME

      private static final String ROOT_NAME
      Name of the root element.
      See Also:
    • EMPTY_ABSTRACT_NODE_ARRAY

      private static final AbstractNode[] EMPTY_ABSTRACT_NODE_ARRAY
      Constant for optimization.
    • detailAst

      private final DetailAST detailAst
      The ast node.
  • Constructor Details

    • RootNode

      public RootNode(DetailAST detailAst)
      Creates a new RootNode instance.
      Parameters:
      detailAst - reference to DetailAST
  • Method Details

    • compareOrder

      public int compareOrder(net.sf.saxon.om.NodeInfo nodeInfo)
      Compares current object with specified for order. Throws UnsupportedOperationException because functionality not required here.
      Parameters:
      nodeInfo - another NodeInfo object
      Returns:
      number representing order of current object to specified one
    • createChildren

      protected List<AbstractNode> createChildren()
      Iterates siblings of the current node and recursively creates new Xpath-nodes.
      Specified by:
      createChildren in class AbstractNode
      Returns:
      children list
    • hasChildNodes

      public boolean hasChildNodes()
      Determine whether the node has any children.
      Returns:
      true is the node has any children.
    • getAttributeValue

      public String getAttributeValue(String namespace, String localPart)
      Returns attribute value. Throws UnsupportedOperationException because root node has no attributes.
      Parameters:
      namespace - namespace
      localPart - actual name of the attribute
      Returns:
      attribute value
    • getLocalPart

      public String getLocalPart()
      Returns local part.
      Returns:
      local part
    • 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

      public net.sf.saxon.om.NodeInfo getRoot()
      Returns root of the tree.
      Returns:
      root of the tree
    • 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.
      Parameters:
      axisNumber - element from AxisInfo
      Returns:
      AxisIterator object
    • getLineNumber

      public int getLineNumber()
      Returns line number.
      Returns:
      line number
    • getColumnNumber

      public int getColumnNumber()
      Returns column number.
      Returns:
      column number
    • getTokenType

      public int getTokenType()
      Getter method for token type.
      Specified by:
      getTokenType in class AbstractNode
      Returns:
      token type
    • getUnderlyingNode

      public DetailAST getUnderlyingNode()
      Returns underlying node.
      Specified by:
      getUnderlyingNode in class AbstractNode
      Returns:
      underlying node
    • getDepth

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

      private static UnsupportedOperationException throwUnsupportedOperationException()
      Returns UnsupportedOperationException exception.
      Returns:
      UnsupportedOperationException exception