Class ASTPath.ASTEntry

java.lang.Object
org.checkerframework.afu.scenelib.io.ASTPath.ASTEntry
All Implemented Interfaces:
Comparable<ASTPath.ASTEntry>
Enclosing class:
ASTPath

public static class ASTPath.ASTEntry extends Object implements Comparable<ASTPath.ASTEntry>
A single entry in an AST path.
  • Constructor Details

    • ASTEntry

      public ASTEntry(Tree.Kind treeKind, String childSelector, Integer argument)
      Constructs a new AST entry. For example, in the entry:
      
       Block.statement 3
       
      the tree kind is "Block", the child selector is "statement", and the argument is "3".
      Parameters:
      treeKind - the kind of this AST entry
      childSelector - the child selector to this AST entry
      argument - the argument
    • ASTEntry

      public ASTEntry(Tree.Kind treeKind, String childSelector)
      Constructs a new AST entry, without a numeric argument.
      Parameters:
      treeKind - the kind of this AST entry
      childSelector - the child selector to this AST entry
  • Method Details

    • getTreeKind

      public Tree.Kind getTreeKind()
      Gets the tree node equivalent kind of this AST entry. For example, in
      
       Block.statement 3
       
      "Block" is the tree kind.
      Returns:
      the tree kind
    • getChildSelector

      public String getChildSelector()
      Gets the child selector of this AST entry. For example, in
      
       Block.statement 3
       
      "statement" is the child selector.
      Returns:
      the child selector
    • childSelectorIs

      public boolean childSelectorIs(String s)
      Determines if the given string is equal to this AST path entry's child selector.
      Parameters:
      s - the string to compare to
      Returns:
      true if the string matches the child selector, false otherwise
    • getArgument

      public int getArgument()
      Gets the argument of this AST entry. For example, in
      
       Block.statement 3
       
      "3" is the argument.
      Returns:
      the argument
      Throws:
      IllegalStateException - if this AST entry does not have an argument
    • hasArgument

      public boolean hasArgument()
      Checks that this Entry has an argument.
      Returns:
      if this entry has an argument
    • compareTo

      public int compareTo(ASTPath.ASTEntry o)
      Specified by:
      compareTo in interface Comparable<ASTPath.ASTEntry>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object