Class Tree

  • All Implemented Interfaces:
    AutoCloseable, Iterable<Node>

    public class Tree
    extends Object
    implements Iterable<Node>
    A Tree represents the syntax tree of an entire source code file. It contains Node instances that indicate the structure of the source code.
    Since:
    1.0.0
    Author:
    Tommy MacWilliam, Ozren Dabić
    • Method Detail

      • close

        public void close()
        Delete the tree, freeing all the memory that it used.
        Specified by:
        close in interface AutoCloseable
      • edit

        public void edit​(@NotNull
                         @NotNull InputEdit edit)
        Edit the syntax tree to keep it in sync with source code that has been edited.
        Parameters:
        edit - Changes made to the source code in terms of both byte offsets and row/column coordinates
      • getRootNode

        public Node getRootNode()
        Returns:
        The root node of the syntax tree
      • iterator

        @NotNull
        public @NotNull Iterator<Node> iterator()
        Specified by:
        iterator in interface Iterable<Node>
        Returns:
        An iterator over the entire syntax tree, starting from the root node
      • isNull

        public final boolean isNull()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object