[]
        
(Showing Draft Content)

NonTerminalNode

Class NonTerminalNode

java.lang.Object
com.grapecity.documents.excel.expressions.SyntaxNode
com.grapecity.documents.excel.expressions.NonTerminalNode
Direct Known Subclasses:
FunctionNode, OperatorNode, ParenthesisNode

public abstract class NonTerminalNode extends SyntaxNode
Represents a non-terminal node in a formula syntax tree.

A NonTerminalNode is a SyntaxNode that can contain one or more child nodes. It serves as the base type for composite syntax elements, such as function calls, operators, and parenthesized expressions, where the expression structure is represented by nested SyntaxNode instances.

The child collection returned by getChildren() contains the immediate descendants of this node and is used to build and traverse the syntax tree.

  • Constructor Details

    • NonTerminalNode

      public NonTerminalNode()
  • Method Details

    • getChildren

      public List<SyntaxNode> getChildren()
      Gets the immediate child nodes of this non-terminal node.

      Use this method to inspect the nested structure of a composite formula expression, such as a function call, operator expression, or parenthesized expression. The returned list is this node's child collection, and its elements are not null.

      
       SyntaxNode node = SyntaxNode.Parse("SUM(A1,B1)");
       NonTerminalNode nonTerminalNode = (NonTerminalNode) node;
       List<SyntaxNode> children = nonTerminalNode.getChildren();
       SyntaxNode firstChild = children.get(0);
       String firstArgument = firstChild.toString();
       
      Specified by:
      getChildren in class SyntaxNode
      Returns:
      A list containing the immediate child nodes of this non-terminal node.