Package ghidra.program.model.lang
Class RegisterTree
- java.lang.Object
-
- ghidra.program.model.lang.RegisterTree
-
- All Implemented Interfaces:
java.lang.Comparable<RegisterTree>
public class RegisterTree extends java.lang.Object implements java.lang.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 Summary
Constructors Constructor Description RegisterTree(Register reg)
RegisterTree(java.lang.String name, Register[] regs)
Constructs a RegisterTree with the given name and set of registersRegisterTree(java.lang.String name, RegisterTree tree)
Constructs a RegisterTree with one RegisterTree child
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(RegisterTree tree)
Adds a Register Tree to this tree.int
compareTo(RegisterTree other)
RegisterTree[]
getComponents()
Get the RegisterTrees that are the children of this RegisterTreejava.lang.String
getName()
Returns the name of this register tree.RegisterTree
getParent()
Returns the parent RegisterTree.java.lang.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.Register
getRegister()
Returns the Register associated with this tree.java.lang.String
getRegisterPath()
The path of this register, which includes the parent path of this RegisterTree if this RegisterTree has a parent.RegisterTree
getRegisterTree(Register register1)
Returns the RegisterTree for the given register if one exists in this RegisterTree object.void
remove(Register reg)
Removes the register from the childrenjava.lang.String
toString()
-
-
-
Constructor Detail
-
RegisterTree
public RegisterTree(Register reg)
-
RegisterTree
public RegisterTree(java.lang.String name, Register[] regs)
Constructs a RegisterTree with the given name and set of registers- Parameters:
name
- the name of the treeregs
- the array of registers to form into a tree
-
RegisterTree
public RegisterTree(java.lang.String name, RegisterTree tree)
Constructs a RegisterTree with one RegisterTree child- Parameters:
name
- the name of this treetree
- the child tree.
-
-
Method Detail
-
getName
public java.lang.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 java.lang.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 java.lang.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 interfacejava.lang.Comparable<RegisterTree>
- See Also:
Comparable.compareTo(java.lang.Object)
-
remove
public void remove(Register reg)
Removes the register from the children- Parameters:
reg
- the register to remove.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-