Class SyntaxNode
- Direct Known Subclasses:
NonTerminalNode
, TerminalNode
public abstract class SyntaxNode
extends Object
Represents a node in the syntax tree. The node can be terminal or non-terminal.
-
Constructor Summary
Constructors
-
Method Summary
Clones the syntax node if the node is mutable.
boolean
Checks whether the SyntaxNode
equal to another.
Gets children of a non-terminal node.
int
This object doesn't support getting hash code, because all fields are mutable.
Loads a SyntaxNode
from a string that contains formula, optionallyspecifying context.
Loads a SyntaxNode
from a string that contains formula, optionallyspecifying context.
Returns the formula text for this node, optionally specifying context.
Returns the formula text for this node, optionally specifying context.
-
Constructor Details
-
SyntaxNode
public SyntaxNode()
-
Method Details
-
getChildren
Gets children of a non-terminal node. Elements are not nullable.
- Returns:
- A list containing the child nodes of this SyntaxNode.
-
toString
Returns the formula text for this node, optionally specifying context.
- Overrides:
toString
in class Object
- Returns:
- A string representation of the formula text for this node.
-
toString
Returns the formula text for this node, optionally specifying context.
- Parameters:
context
- Options for converting FormulaSyntaxTree
tostring
.
-
Parse
Loads a SyntaxNode
from a string that contains formula, optionallyspecifying context.
- Parameters:
text
- A string
that contains formula.
- Returns:
- A
SyntaxNode
populated from the string that contains formula.
-
Parse
Loads a SyntaxNode
from a string that contains formula, optionallyspecifying context.
- Parameters:
text
- A string
that contains formula.
context
- A ParseContext
that specifies base row, base columnand R1C1 reference style.
- Returns:
- A
SyntaxNode
populated from the string that contains formula.
-
equals
public boolean equals(Object obj)
Checks whether the SyntaxNode
equal to another.
- Overrides:
equals
in class Object
- Parameters:
obj
- Another syntax node.
- Returns:
- Whether the current node equals to the specified node.
-
hashCode
public int hashCode()
This object doesn't support getting hash code, because all fields are mutable.
- Overrides:
hashCode
in class Object
- Returns:
- The hash code of the current type.
-
clone
Clones the syntax node if the node is mutable.
- Overrides:
clone
in class Object
- Returns:
- If the node is mutable, returns the cloned object. Otherwise, returnsthe equivalent object from object pool.