Class RegisterTree

java.lang.Object
ghidra.program.model.lang.RegisterTree
All Implemented Interfaces:
Comparable<RegisterTree>

public class RegisterTree extends Object implements Comparable<RegisterTree>
The RegisterTree class builds and represents relationships between registers. Any register that "breaks down" into smaller registers can be represent by a RegisterTree. The largest register will be at the root and the registers that make it up will be its children trees. The children are RegisterTrees as well and can have children trees of thier own. The root of a RegisterTree may not have an associated Register which means that its children are unrelated. This way all the registers of a processor can be represented as a single RegisterTree.
  • Constructor Details

    • RegisterTree

      public RegisterTree(Register reg)
    • RegisterTree

      public RegisterTree(String name, Register[] regs)
      Constructs a RegisterTree with the given name and set of registers
      Parameters:
      name - the name of the tree
      regs - the array of registers to form into a tree
    • RegisterTree

      public RegisterTree(String name, RegisterTree tree)
      Constructs a RegisterTree with one RegisterTree child
      Parameters:
      name - the name of this tree
      tree - the child tree.
  • Method Details

    • getName

      public String getName()
      Returns the name of this register tree.
    • add

      public void add(RegisterTree tree)
      Adds a Register Tree to this tree.
      Parameters:
      tree - the register tree to add
    • getComponents

      public RegisterTree[] getComponents()
      Get the RegisterTrees that are the children of this RegisterTree
      Returns:
      a array of RegisterTrees
    • getRegister

      public Register getRegister()
      Returns the Register associated with this tree. This may be null which indicates the children RegisterTrees are unrelated to each other.
    • getParent

      public RegisterTree getParent()
      Returns the parent RegisterTree.
    • getParentRegisterPath

      public String getParentRegisterPath()
      The parent path of this RegisterTree if it exists or null if this tree has no parent or no parent with a register.
      Returns:
      The parent path of this RegisterTree.
    • getRegisterPath

      public String getRegisterPath()
      The path of this register, which includes the parent path of this RegisterTree if this RegisterTree has a parent.
      Returns:
      the path of this register.
    • getRegisterTree

      public RegisterTree getRegisterTree(Register register1)
      Returns the RegisterTree for the given register if one exists in this RegisterTree object.
      Parameters:
      register1 - The register for which to get a RegisterTree.
      Returns:
      The RegisterTree for the given register if one exists in this RegisterTree object.
    • compareTo

      public int compareTo(RegisterTree other)
      Specified by:
      compareTo in interface Comparable<RegisterTree>
      See Also:
    • remove

      public void remove(Register reg)
      Removes the register from the children
      Parameters:
      reg - the register to remove.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: