Class ASTNode
java.lang.Object
org.variantsync.boosting.datastructure.ASTNode
- All Implemented Interfaces:
Serializable
Represents a node in an Abstract Syntax Tree (AST).
Each ASTNode contains information about a specific code element, such as a
class, method, or statement.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
A node-type specifies the type of node (e.g., root, file, kind of declaration, etc.). -
Constructor Summary
ConstructorsConstructorDescriptionASTNode
(ASTNode parent, String code, Position position, ASTNode.NODE_TYPE type, org.logicng.formulas.Formula mapping) Constructs a new ASTNode with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Returns a set of this node's child nodes.getCode()
org.logicng.formulas.Formula
Returns the best mapping as a formulaCustomHashSet
<org.logicng.formulas.Formula> Returns set set of all possible mappings (if the mapping is a DNF formula, each clause is a possible mapping on its own) for this node.Gets the equivalent node of this node.Return the position (file, line) where the content of this node starts.getType()
Gets the type of this nodeboolean
Checks whether the given ASTNode is similar to this one.void
setMapping
(org.logicng.formulas.Formula mapping) Sets a specific mapping for this nodevoid
Sets the parent of this ASTNode in the AST.void
setProductEquivalent
(ASTNode productEquivalent) Sets the equivalent node of this node.
-
Constructor Details
-
ASTNode
public ASTNode(ASTNode parent, String code, Position position, ASTNode.NODE_TYPE type, org.logicng.formulas.Formula mapping) Constructs a new ASTNode with the specified parameters.
-
-
Method Details
-
addChild
-
setProductEquivalent
Sets the equivalent node of this node.- Parameters:
productEquivalent
- the equivalent AST node
-
getProductEquivalent
Gets the equivalent node of this node. -
isSimilar
Checks whether the given ASTNode is similar to this one.- Parameters:
eccoNode
- another ASTNode object
-
getCode
- Returns:
- the code associated with this ASTNode
-
getParent
- Returns:
- the parent of this ASTNode
-
setParent
Sets the parent of this ASTNode in the AST. -
getChildren
Returns a set of this node's child nodes. -
getStartPosition
Return the position (file, line) where the content of this node starts. -
getMappings
Returns set set of all possible mappings (if the mapping is a DNF formula, each clause is a possible mapping on its own) for this node. -
getMapping
public org.logicng.formulas.Formula getMapping()Returns the best mapping as a formula -
setMapping
public void setMapping(org.logicng.formulas.Formula mapping) Sets a specific mapping for this node -
getType
Gets the type of this node
-