Class BooleanNode

    • Constructor Detail

      • BooleanNode

        public BooleanNode​(boolean value,
                           SourceLocation sourceLocation)
    • Method Detail

      • getValue

        public boolean getValue()
        Gets the true or false value of the boolean node.
        Returns:
        Returns true or false.
      • getType

        public NodeType getType()
        Description copied from class: Node
        Gets the type of the node.
        Specified by:
        getType in class Node
        Returns:
        Returns the node type.
      • accept

        public <R> R accept​(NodeVisitor<R> visitor)
        Description copied from class: Node
        Accepts a visitor with the node.
        Specified by:
        accept in class Node
        Type Parameters:
        R - visitor return type.
        Parameters:
        visitor - Visitor to dispatch to.
        Returns:
        Returns the accepted result.
      • expectBooleanNode

        public BooleanNode expectBooleanNode​(java.lang.String errorMessage)
        Description copied from class: Node
        Casts the current node to a BooleanNode, throwing ExpectationNotMetException when the node is the wrong type.
        Overrides:
        expectBooleanNode in class Node
        Parameters:
        errorMessage - Error message to use if the node is of the wrong type.
        Returns:
        Returns a boolean node.
      • expectBooleanNode

        public BooleanNode expectBooleanNode​(java.util.function.Supplier<java.lang.String> errorMessage)
        Description copied from class: Node
        Casts the current node to a BooleanNode, throwing ExpectationNotMetException when the node is the wrong type.
        Overrides:
        expectBooleanNode in class Node
        Parameters:
        errorMessage - Error message supplier.
        Returns:
        Returns a boolean node.
      • asBooleanNode

        public java.util.Optional<BooleanNode> asBooleanNode()
        Description copied from class: Node
        Gets the node as an BooleanNode if it is an boolean.
        Overrides:
        asBooleanNode in class Node
        Returns:
        Returns the optional BooleanNode.
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object