[]
        
(Showing Draft Content)

LogicalNode

Class LogicalNode


public class LogicalNode extends ConstNode
Represents a boolean literal node in a formula syntax tree.

This constructor initializes a logical literal node in the expression syntax tree with the specified constant value.


 FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("SUM(5,\"6\",TRUE)");
 FunctionNode functionNode = (FunctionNode) syntaxTree.getRoot();
 LogicalNode logicalNode = (LogicalNode) functionNode.getChildren().get(2);
 boolean value = logicalNode.getValue();
 
  • Constructor Details

    • LogicalNode

      public LogicalNode(boolean value)
      Creates a new LogicalNode from a boolean value.

      This constructor initializes a logical literal node in the expression syntax tree with the specified constant value.

      Parameters:
      value - The boolean value represented by this node.
  • Method Details

    • getValue

      public final boolean getValue()
      Gets the value of this node.

      Returns the boolean value represented by this logical literal node in the syntax tree.

      
       FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("SUM(5,\"6\",TRUE)");
       FunctionNode functionNode = (FunctionNode) syntaxTree.getRoot();
       LogicalNode logicalNode = (LogicalNode) functionNode.getChildren().get(2);
       boolean value = logicalNode.getValue();
       
      Returns:
      The boolean value of this node.
    • setValue

      public final void setValue(boolean value)
      Sets the value of this node.

      sets the boolean value represented by this logical literal node in the syntax tree.

      
       FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("SUM(5,\"6\",TRUE)");
       FunctionNode functionNode = (FunctionNode) syntaxTree.getRoot();
       LogicalNode logicalNode = (LogicalNode) functionNode.getChildren().get(2);
       logicalNode.setValue(false);
       String formulaText = syntaxTree.toString();
       
      Parameters:
      value - The boolean value of this node.