[]
        
(Showing Draft Content)

FunctionNode

Class FunctionNode


public class FunctionNode extends NonTerminalNode
Represents a function call expression in a syntax tree.

A FunctionNode stores the function name and inherits child-node support from NonTerminalNode so the function arguments can be represented as nested syntax nodes.


 FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("LEFT(sheet1!$B$3,1)");
 FunctionNode functionNode = (FunctionNode) syntaxTree.getRoot();
 String name = functionNode.getName();
 int argumentCount = functionNode.getChildren().size();
 
  • Constructor Details

    • FunctionNode

      public FunctionNode(String name)
      Creates a new FunctionNode with a function name.
      Parameters:
      name - The function name.
  • Method Details

    • getName

      public final String getName()
      Gets the name of the function.

      Use this method to retrieve the function identifier represented by this FunctionNode.

      
       FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("LEFT(sheet1!$B$3,1)");
       FunctionNode functionNode = (FunctionNode) syntaxTree.getRoot();
       String name = functionNode.getName();
       
      Returns:
      The current function name.
    • setName

      public final void setName(String value)
      Sets the name of the function.

      Use this method to change the function identifier represented by this FunctionNode.

      
       FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("SUM(5,\"6\",TRUE)");
       FunctionNode functionNode = (FunctionNode) syntaxTree.getRoot();
       functionNode.setName("AVERAGE");
       String formulaText = syntaxTree.toString();
       
      Parameters:
      value - The function name to set.