java.lang.Object
org.variantsync.boosting.datastructure.ASTNode
All Implemented Interfaces:
Serializable

public class ASTNode extends Object implements 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:
  • 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

      public void addChild(ASTNode child)
    • setProductEquivalent

      public void setProductEquivalent(ASTNode productEquivalent)
      Sets the equivalent node of this node.
      Parameters:
      productEquivalent - the equivalent AST node
    • getProductEquivalent

      public ASTNode getProductEquivalent()
      Gets the equivalent node of this node.
    • isSimilar

      public boolean isSimilar(ASTNode eccoNode)
      Checks whether the given ASTNode is similar to this one.
      Parameters:
      eccoNode - another ASTNode object
    • getCode

      public String getCode()
      Returns:
      the code associated with this ASTNode
    • getParent

      public ASTNode getParent()
      Returns:
      the parent of this ASTNode
    • setParent

      public void setParent(ASTNode parent)
      Sets the parent of this ASTNode in the AST.
    • getChildren

      public CustomHashSet<ASTNode> getChildren()
      Returns a set of this node's child nodes.
    • getStartPosition

      public Position getStartPosition()
      Return the position (file, line) where the content of this node starts.
    • getMappings

      public CustomHashSet<org.logicng.formulas.Formula> 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

      public ASTNode.NODE_TYPE getType()
      Gets the type of this node