Package ghidra.trace.database.program

# Class DBTraceProgramViewRootModule

java.lang.Object
ghidra.trace.database.program.DBTraceProgramViewRootModule

All Implemented Interfaces:
  `Group`, `ProgramModule`

public class DBTraceProgramViewRootModule extends Object implements ProgramModule

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ProgramModule[]`
  `EMPTY_MODULE_ARRAY`
  `protected final AbstractDBTraceProgramViewListing`
  `listing`
  `protected final DBTraceProgramView`
  `program`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DBTraceProgramViewRootModule(AbstractDBTraceProgramViewListing listing)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(ProgramFragment fragment)`
  Adds the given fragment as a child of this module.
  `void`
  `add(ProgramModule module)`
  Adds the given module as a child of this module.
  `boolean`
  `contains(CodeUnit codeUnit)`
  Returns whether this fragment contains the given code unit.
  `boolean`
  `contains(ProgramFragment fragment)`
  Returns whether this module directly contains the given fragment as a child.
  `boolean`
  `contains(ProgramModule module)`
  Returns whether this module directly contains the given module as a child.
  `ProgramFragment`
  `createFragment(String fragmentName)`
  Creates a new fragment and makes it a child of this module.
  `ProgramModule`
  `createModule(String moduleName)`
  Creates a new module and makes it a child of this module.
  `AddressSetView`
  `getAddressSet()`
  Returns the set of addresses for this module which will be the combined set of addresses from the set of all fragments which are descendants of this module.
  `Group[]`
  `getChildren()`
  Returns an array containing this module's children.
  `String`
  `getComment()`
  Obtains the comment that has been associated with this fragment or module.
  `Address`
  `getFirstAddress()`
  Returns the first address of this module which will be the minimum address of the first descendant fragment which is non-empty.
  `int`
  `getIndex(String name)`
  Get the index of the child with the given name.
  `Address`
  `getLastAddress()`
  Returns the last address of this module which will be the maximum address of the last descendant fragment which is non-empty.
  `Address`
  `getMaxAddress()`
  Returns the maximum address of this module which will be the maximum address from the set of all fragments which are descendants of this module.
  `Address`
  `getMinAddress()`
  Returns the minimum address of this module which will be the minimum address from the set of all fragments which are descendants of this module.
  `long`
  `getModificationNumber()`
  Get the current modification number of the module tree; the number is updated when ever a change is made to any module or fragment that is part of this module's root tree.
  `String`
  `getName()`
  Obtains the name that has been associated with this fragment.
  `int`
  `getNumChildren()`
  Returns the number of children of this module.
  `int`
  `getNumParents()`
  Obtains the number of parent's of this fragment.
  `String[]`
  `getParentNames()`
  Returns the names of the modules which are parents to this fragment.
  `ProgramModule[]`
  `getParents()`
  Returns a list of the modules which are parents for this group.
  `long`
  `getTreeID()`
  Get the ID for the tree that this module belongs to.
  `String`
  `getTreeName()`
  Returns the name of the tree that this group belongs to.
  `Object`
  `getVersionTag()`
  Returns an object that can be used to detect when the module tree has been affected by an undo or redo.
  `boolean`
  `isDeleted()`
  Returns true if this group has been deleted from the program
  `boolean`
  `isDescendant(ProgramFragment fragment)`
  Returns whether the given fragment is a descendant of this module.
  `boolean`
  `isDescendant(ProgramModule module)`
  Returns whether the given module is a descendant of this module.
  `void`
  `moveChild(String name, int index)`
  Changes the ordering of this module's children by moving the child with the given name to position given by index.
  `protected <T> T`
  `reduceRegions(Function<TraceMemoryRegion,T> func, BiFunction<T,T,T> reducer)`
  `boolean`
  `removeChild(String name)`
  Removes a child module or fragment from this Module.
  `void`
  `reparent(String name, ProgramModule oldParent)`
  Reparents child with the given name to this Module; removes the child from oldParent.
  `void`
  `setComment(String comment)`
  Sets the comment to associate with this fragment.
  `void`
  `setName(String name)`
  Sets the name of this fragment.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.program.model.listing.Group

  `getGroupPath`

- ## Field Details

  - ### EMPTY_MODULE_ARRAY

    public static final ProgramModule[] EMPTY_MODULE_ARRAY

  - ### program

    protected final DBTraceProgramView program

  - ### listing

    protected final AbstractDBTraceProgramViewListing listing

- ## Constructor Details

  - ### DBTraceProgramViewRootModule

    public DBTraceProgramViewRootModule(AbstractDBTraceProgramViewListing listing)

- ## Method Details

  - ### getComment

    public String getComment()
    Description copied from interface: `Group`
    Obtains the comment that has been associated with this fragment or module.
    Specified by:
      `getComment` in interface `Group`
    Returns:
      may be null.

  - ### setComment

    public void setComment(String comment)
    Description copied from interface: `Group`
    Sets the comment to associate with this fragment.
    Specified by:
      `setComment` in interface `Group`
    Parameters:
      `comment` - the comment.

  - ### getName

    public String getName()
    Description copied from interface: `Group`
    Obtains the name that has been associated with this fragment. A fragment will always have a name and it will be unique within the set of all fragment and module names.
    Specified by:
      `getName` in interface `Group`

  - ### setName

    public void setName(String name) throws DuplicateNameException
    Description copied from interface: `Group`
    Sets the name of this fragment.
    Specified by:
      `setName` in interface `Group`
    Parameters:
      `name` - the string to use for the fragment's name.
    Throws:
      `DuplicateNameException` - thrown if the name being set is already in use by another fragment or a module.

  - ### contains

    public boolean contains(CodeUnit codeUnit)
    Description copied from interface: `Group`
    Returns whether this fragment contains the given code unit.
    Specified by:
      `contains` in interface `Group`
    Parameters:
      `codeUnit` - the code unit being tested.
    Returns:
      true if the code unit is in the fragment, false otherwise.

  - ### getNumParents

    public int getNumParents()
    Description copied from interface: `Group`
    Obtains the number of parent's of this fragment. If a fragment is in a module then the module is a parent of the fragment and the fragment is a child of the module. A fragment must have at least one parent and it may have multiple parents.
    Specified by:
      `getNumParents` in interface `Group`
    Returns:
      the number of parents of this fragment.

  - ### getParents

    public ProgramModule[] getParents()
    Description copied from interface: `Group`
    Returns a list of the modules which are parents for this group.
    Specified by:
      `getParents` in interface `Group`

  - ### getParentNames

    public String[] getParentNames()
    Description copied from interface: `Group`
    Returns the names of the modules which are parents to this fragment.
    Specified by:
      `getParentNames` in interface `Group`

  - ### getTreeName

    public String getTreeName()
    Description copied from interface: `Group`
    Returns the name of the tree that this group belongs to.
    Specified by:
      `getTreeName` in interface `Group`

  - ### contains

    public boolean contains(ProgramFragment fragment)
    Description copied from interface: `ProgramModule`
    Returns whether this module directly contains the given fragment as a child.
    Specified by:
      `contains` in interface `ProgramModule`
    Parameters:
      `fragment` - the fragment to check.

  - ### contains

    public boolean contains(ProgramModule module)
    Description copied from interface: `ProgramModule`
    Returns whether this module directly contains the given module as a child.
    Specified by:
      `contains` in interface `ProgramModule`
    Parameters:
      `module` - the module to check.
    Returns:
      true if module is the same as this module, or if module is a child of this module.

  - ### getNumChildren

    public int getNumChildren()
    Description copied from interface: `ProgramModule`
    Returns the number of children of this module.
    Specified by:
      `getNumChildren` in interface `ProgramModule`

  - ### getChildren

    public Group[] getChildren()
    Description copied from interface: `ProgramModule`
    Returns an array containing this module's children.
    Specified by:
      `getChildren` in interface `ProgramModule`

  - ### getIndex

    public int getIndex(String name)
    Description copied from interface: `ProgramModule`
    Get the index of the child with the given name.
    Specified by:
      `getIndex` in interface `ProgramModule`
    Parameters:
      `name` - name of child
    Returns:
      int index or -1 if this Module does not have a child with the given name

  - ### add

    public void add(ProgramModule module) throws CircularDependencyException, DuplicateGroupException
    Description copied from interface: `ProgramModule`
    Adds the given module as a child of this module.
    Specified by:
      `add` in interface `ProgramModule`
    Parameters:
      `module` - the module to be added.
    Throws:
      `CircularDependencyException` - thrown if the module being added is an ancestor of this module. The module structure of a program does not allow "cycles" of this sort to be created.
      `DuplicateGroupException` - thrown if the module being added is already a child of this module.

  - ### add

    public void add(ProgramFragment fragment) throws DuplicateGroupException
    Description copied from interface: `ProgramModule`
    Adds the given fragment as a child of this module.
    Specified by:
      `add` in interface `ProgramModule`
    Throws:
      `DuplicateGroupException` - thrown if the fragment being added is already a child of this module.

  - ### createModule

    public ProgramModule createModule(String moduleName) throws DuplicateNameException
    Description copied from interface: `ProgramModule`
    Creates a new module and makes it a child of this module.
    Specified by:
      `createModule` in interface `ProgramModule`
    Parameters:
      `moduleName` - the name to use for the new module.
    Returns:
      the newly created module.
    Throws:
      `DuplicateNameException` - thrown if the given name is already used by an existing module or fragment.

  - ### createFragment

    public ProgramFragment createFragment(String fragmentName) throws DuplicateNameException
    Description copied from interface: `ProgramModule`
    Creates a new fragment and makes it a child of this module.
    Specified by:
      `createFragment` in interface `ProgramModule`
    Parameters:
      `fragmentName` - the name to use for the new fragment.
    Returns:
      the newly created fragment.
    Throws:
      `DuplicateNameException` - thrown if the given name is already used by an existing module or fragment.

  - ### reparent

    public void reparent(String name, ProgramModule oldParent) throws NotFoundException
    Description copied from interface: `ProgramModule`
    Reparents child with the given name to this Module; removes the child from oldParent.
    Specified by:
      `reparent` in interface `ProgramModule`
    Parameters:
      `name` - name of child to reparent
      `oldParent` - old parent
    Throws:
      `NotFoundException` - if name is not the name of a child in oldParent

  - ### moveChild

    public void moveChild(String name, int index) throws NotFoundException
    Description copied from interface: `ProgramModule`
    Changes the ordering of this module's children by moving the child with the given name to position given by index.
    Specified by:
      `moveChild` in interface `ProgramModule`
    Parameters:
      `name` - the name of the child to move.
      `index` - the index to move it to.
    Throws:
      `NotFoundException` - thrown if a child with the given name cannot be found in this module.

  - ### removeChild

    public boolean removeChild(String name) throws NotEmptyException
    Description copied from interface: `ProgramModule`
    Removes a child module or fragment from this Module.
    Specified by:
      `removeChild` in interface `ProgramModule`
    Returns:
      true if successful, false if no child in this module has the given name.
    Throws:
      `NotEmptyException` - thrown if the module appears in no other modules and it is not empty.

  - ### isDescendant

    public boolean isDescendant(ProgramModule module)
    Description copied from interface: `ProgramModule`
    Returns whether the given module is a descendant of this module.
    Specified by:
      `isDescendant` in interface `ProgramModule`
    Parameters:
      `module` - the module to check.
    Returns:
      true if the module is a descendant, false otherwise.

  - ### isDescendant

    public boolean isDescendant(ProgramFragment fragment)
    Description copied from interface: `ProgramModule`
    Returns whether the given fragment is a descendant of this module.
    Specified by:
      `isDescendant` in interface `ProgramModule`
    Parameters:
      `fragment` - the fragment to check.
    Returns:
      true if the fragment is a descendant, false otherwise.

  - ### reduceRegions

    protected <T> T reduceRegions(Function<TraceMemoryRegion,T> func, BiFunction<T,T,T> reducer)

  - ### getMinAddress

    public Address getMinAddress()
    Description copied from interface: `ProgramModule`
    Returns the minimum address of this module which will be the minimum address from the set of all fragments which are descendants of this module.
    Specified by:
      `getMinAddress` in interface `Group`
    Specified by:
      `getMinAddress` in interface `ProgramModule`
    Returns:
      the minimum address, this will be null if all of the module's descendant fragments are empty.

  - ### getMaxAddress

    public Address getMaxAddress()
    Description copied from interface: `ProgramModule`
    Returns the maximum address of this module which will be the maximum address from the set of all fragments which are descendants of this module.
    Specified by:
      `getMaxAddress` in interface `Group`
    Specified by:
      `getMaxAddress` in interface `ProgramModule`
    Returns:
      the maximum address, this will be null if all of the module's descendant fragments are empty.

  - ### getFirstAddress

    public Address getFirstAddress()
    Description copied from interface: `ProgramModule`
    Returns the first address of this module which will be the minimum address of the first descendant fragment which is non-empty. In other words this returns the first address for this module as defined by the user ordering of the module's children.
    Specified by:
      `getFirstAddress` in interface `ProgramModule`
    Returns:
      the first address, this will be null if all of the module's descendant fragments are empty.

  - ### getLastAddress

    public Address getLastAddress()
    Description copied from interface: `ProgramModule`
    Returns the last address of this module which will be the maximum address of the last descendant fragment which is non-empty. In other words this returns the last address for this module as defined by the user ordering of the module's children.
    Specified by:
      `getLastAddress` in interface `ProgramModule`
    Returns:
      the last address, this will be null if all of the module's descendant fragments are empty.

  - ### getAddressSet

    public AddressSetView getAddressSet()
    Description copied from interface: `ProgramModule`
    Returns the set of addresses for this module which will be the combined set of addresses from the set of all fragments which are descendants of this module.
    Specified by:
      `getAddressSet` in interface `ProgramModule`
    Returns:
      the complete address set for this module.

  - ### getVersionTag

    public Object getVersionTag()
    Description copied from interface: `ProgramModule`
    Returns an object that can be used to detect when the module tree has been affected by an undo or redo. After an undo/redo, if this module was affected, then a new verionTag object is created.
    Specified by:
      `getVersionTag` in interface `ProgramModule`

  - ### getModificationNumber

    public long getModificationNumber()
    Description copied from interface: `ProgramModule`
    Get the current modification number of the module tree; the number is updated when ever a change is made to any module or fragment that is part of this module's root tree.
    Specified by:
      `getModificationNumber` in interface `ProgramModule`

  - ### getTreeID

    public long getTreeID()
    Description copied from interface: `ProgramModule`
    Get the ID for the tree that this module belongs to.
    Specified by:
      `getTreeID` in interface `ProgramModule`
    Returns:
      ID for the tree

  - ### isDeleted

    public boolean isDeleted()
    Description copied from interface: `Group`
    Returns true if this group has been deleted from the program
    Specified by:
      `isDeleted` in interface `Group`
    Returns:
      true if this group has been deleted from the program