Package ghidra.trace.database.program

# Class DBTraceProgramViewBookmarkManager

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

All Implemented Interfaces:
  `BookmarkManager`, `TraceProgramViewBookmarkManager`

public class DBTraceProgramViewBookmarkManager extends Object implements TraceProgramViewBookmarkManager

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final DBTraceBookmarkManager`
  `bookmarkManager`
  `protected static final Bookmark[]`
  `EMPTY_BOOKMARK_ARRAY`
  `protected static final String[]`
  `EMPTY_STRING_ARRAY`
  `protected final DBTraceProgramView`
  `program`

  ### Fields inherited from interface ghidra.program.model.listing.BookmarkManager

  `OLD_BOOKMARK_PROPERTY_OBJECT_CLASS1, OLD_BOOKMARK_PROPERTY_OBJECT_CLASS2`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DBTraceProgramViewBookmarkManager(DBTraceProgramView program)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BookmarkType`
  `defineType(String type, Icon icon, Color color, int priority)`
  Define a bookmark type with its marker icon and color.
  `protected void`
  `doDeleteOrTruncateLifespan(TraceBookmark bm)`
  `protected void`
  `doRemoveByAddressSet(AddressSetView set, TaskMonitor monitor, Predicate<? super TraceBookmark> predicate)`
  `protected static <T, U extends T>
  Iterator<T>`
  `filteredIterator(Iterator<U> it, Predicate<? super U> predicate)`
  A less restrictive casting of `IteratorUtils.filteredIterator(Iterator, org.apache.commons.collections4.Predicate)`.
  `Bookmark`
  `getBookmark(long id)`
  Returns the bookmark that has the given id or null if no such bookmark exists.
  `Bookmark`
  `getBookmark(Address addr, String type, String category)`
  Get a specific bookmark
  `AddressSetView`
  `getBookmarkAddresses(String type)`
  Get addresses for bookmarks of a specified type.
  `protected Comparator<Bookmark>`
  `getBookmarkComparator(boolean forward)`
  `int`
  `getBookmarkCount()`
  Returns the total number of bookmarks in the program
  `int`
  `getBookmarkCount(String type)`
  Return the number of bookmarks of the given type
  `Bookmark[]`
  `getBookmarks(Address addr)`
  Get all bookmarks on a specific address
  `Bookmark[]`
  `getBookmarks(Address address, String type)`
  Get bookmarks of the indicated type on a specific address
  `Iterator<Bookmark>`
  `getBookmarksIterator()`
  Returns an iterator over all bookmarks
  `Iterator<Bookmark>`
  `getBookmarksIterator(Address startAddress, boolean forward)`
  Returns an iterator over all bookmark types, starting at the given address, with traversal in the given direction.
  `Iterator<Bookmark>`
  `getBookmarksIterator(String type)`
  Get iterator over all bookmarks of the specified type.
  `BookmarkType`
  `getBookmarkType(String type)`
  Get a bookmark type
  `BookmarkType[]`
  `getBookmarkTypes()`
  Returns list of known bookmark types
  `String[]`
  `getCategories(String type)`
  Get list of categories used for a specified type
  `TraceProgramView`
  `getProgram()`
  Returns the program associated with this BookmarkManager.
  `long`
  `getSnap()`
  `Trace`
  `getTrace()`
  `boolean`
  `hasBookmarks(String type)`
  Returns true if program contains one or more bookmarks of the given type
  `boolean`
  `isDefinedType(String type)`
  Returns true if the given bookmark type has been defined via a call to `BookmarkManager.defineType(String, Icon, Color, int)`.
  `void`
  `removeBookmark(Bookmark bookmark)`
  Remove bookmark
  `void`
  `removeBookmarks(AddressSetView set, TaskMonitor monitor)`
  Removes all bookmarks over the given address set.
  `void`
  `removeBookmarks(AddressSetView set, String type, TaskMonitor monitor)`
  Removes all bookmarks of the given type over the given address set
  `void`
  `removeBookmarks(AddressSetView set, String type, String category, TaskMonitor monitor)`
  Removes all bookmarks of the given type and category over the given address set
  `void`
  `removeBookmarks(String type)`
  Removes all bookmarks of the given type.
  `void`
  `removeBookmarks(String type, String category, TaskMonitor monitor)`
  Removes all bookmarks with the given type and category.
  `Bookmark`
  `setBookmark(Address addr, String type, String category, String comment)`
  Set a bookmark.

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

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

- ## Field Details

  - ### EMPTY_STRING_ARRAY

    protected static final String[] EMPTY_STRING_ARRAY

  - ### EMPTY_BOOKMARK_ARRAY

    protected static final Bookmark[] EMPTY_BOOKMARK_ARRAY

  - ### program

    protected final DBTraceProgramView program

  - ### bookmarkManager

    protected final DBTraceBookmarkManager bookmarkManager

- ## Constructor Details

  - ### DBTraceProgramViewBookmarkManager

    public DBTraceProgramViewBookmarkManager(DBTraceProgramView program)

- ## Method Details

  - ### defineType

    public BookmarkType defineType(String type, Icon icon, Color color, int priority)
    Description copied from interface: `BookmarkManager`
    Define a bookmark type with its marker icon and color. The icon and color values are not permanently stored. Therefor, this method must be re-invoked by a plugin each time a program is opened if a custom icon and color are desired.
    Specified by:
      `defineType` in interface `BookmarkManager`
    Parameters:
      `type` - bookmark type
      `icon` - marker icon which may get scaled
      `color` - marker color
      `priority` - the bookmark priority
    Returns:
      bookmark type object

  - ### isDefinedType

    public boolean isDefinedType(String type)
    Description copied from interface: `BookmarkManager`
    Returns true if the given bookmark type has been defined via a call to `BookmarkManager.defineType(String, Icon, Color, int)`. This allows clients to know whether the given type should be displayed.
    Specified by:
      `isDefinedType` in interface `BookmarkManager`
    Parameters:
      `type` - the type to check
    Returns:
      true if defined

  - ### getBookmarkTypes

    public BookmarkType[] getBookmarkTypes()
    Description copied from interface: `BookmarkManager`
    Returns list of known bookmark types
    Specified by:
      `getBookmarkTypes` in interface `BookmarkManager`
    Returns:
      list of known bookmark types

  - ### getBookmarkType

    public BookmarkType getBookmarkType(String type)
    Description copied from interface: `BookmarkManager`
    Get a bookmark type
    Specified by:
      `getBookmarkType` in interface `BookmarkManager`
    Parameters:
      `type` - bookmark type name
    Returns:
      bookmark type or null if type is unknown

  - ### getCategories

    public String[] getCategories(String type)
    Description copied from interface: `BookmarkManager`
    Get list of categories used for a specified type
    Specified by:
      `getCategories` in interface `BookmarkManager`
    Parameters:
      `type` - bookmark type
    Returns:
      array of category strings

  - ### setBookmark

    public Bookmark setBookmark(Address addr, String type, String category, String comment)
    Description copied from interface: `BookmarkManager`
    Set a bookmark.
    Specified by:
      `setBookmark` in interface `BookmarkManager`
    Parameters:
      `addr` - the address at which to set a bookmark
      `type` - the name of the bookmark type.
      `category` - the category for the bookmark.
      `comment` - the comment to associate with the bookmark.
    Returns:
      the new bookmark

  - ### getBookmark

    public Bookmark getBookmark(Address addr, String type, String category)
    Description copied from interface: `BookmarkManager`
    Get a specific bookmark
    Specified by:
      `getBookmark` in interface `BookmarkManager`
    Parameters:
      `addr` - the address of the bookmark to retrieve
      `type` - the name of the bookmark type.
      `category` - the category of the bookmark.
    Returns:
      the bookmark with the given attributes, or null if no bookmarks match.

  - ### doDeleteOrTruncateLifespan

    protected void doDeleteOrTruncateLifespan(TraceBookmark bm)

  - ### removeBookmark

    public void removeBookmark(Bookmark bookmark)
    Description copied from interface: `BookmarkManager`
    Remove bookmark
    Specified by:
      `removeBookmark` in interface `BookmarkManager`
    Parameters:
      `bookmark` - the bookmark to remove.

  - ### removeBookmarks

    public void removeBookmarks(String type)
    Description copied from interface: `BookmarkManager`
    Removes all bookmarks of the given type.
    Specified by:
      `removeBookmarks` in interface `BookmarkManager`
    Parameters:
      `type` - bookmark type

  - ### removeBookmarks

    public void removeBookmarks(String type, String category, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `BookmarkManager`
    Removes all bookmarks with the given type and category.
    Specified by:
      `removeBookmarks` in interface `BookmarkManager`
    Parameters:
      `type` - the type of the bookmarks to be removed.
      `category` - bookmark category of the types to be removed.
      `monitor` - a task monitor to report the progress.
    Throws:
      `CancelledException` - if the user (via the monitor) cancelled the operation.

  - ### doRemoveByAddressSet

    protected void doRemoveByAddressSet(AddressSetView set, TaskMonitor monitor, Predicate<? super TraceBookmark> predicate) throws CancelledException
    Throws:
      `CancelledException`

  - ### removeBookmarks

    public void removeBookmarks(AddressSetView set, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `BookmarkManager`
    Removes all bookmarks over the given address set.
    Specified by:
      `removeBookmarks` in interface `BookmarkManager`
    Parameters:
      `set` - the set of addresses from which to remove all bookmarks.
      `monitor` - a task monitor to report the progress.
    Throws:
      `CancelledException` - if the user (via the monitor) cancelled the operation.

  - ### removeBookmarks

    public void removeBookmarks(AddressSetView set, String type, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `BookmarkManager`
    Removes all bookmarks of the given type over the given address set
    Specified by:
      `removeBookmarks` in interface `BookmarkManager`
    Parameters:
      `set` - the set of addresses from which to remove all bookmarks of the given type.
      `type` - the type of bookmarks to remove.
      `monitor` - a task monitor to report the progress.
    Throws:
      `CancelledException` - if the user (via the monitor) cancelled the operation.

  - ### removeBookmarks

    public void removeBookmarks(AddressSetView set, String type, String category, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `BookmarkManager`
    Removes all bookmarks of the given type and category over the given address set
    Specified by:
      `removeBookmarks` in interface `BookmarkManager`
    Parameters:
      `set` - the set of addresses from which to remove all bookmarks of the given type and category.
      `type` - the type of bookmarks to remove.
      `category` - the category of bookmarks to remove.
      `monitor` - a task monitor to report the progress.
    Throws:
      `CancelledException` - if the user (via the monitor) cancelled the operation.

  - ### getBookmarks

    public Bookmark[] getBookmarks(Address addr)
    Description copied from interface: `BookmarkManager`
    Get all bookmarks on a specific address
    Specified by:
      `getBookmarks` in interface `BookmarkManager`
    Parameters:
      `addr` - the address at which to retrieve all bookmarks.
    Returns:
      array of bookmarks

  - ### getBookmarks

    public Bookmark[] getBookmarks(Address address, String type)
    Description copied from interface: `BookmarkManager`
    Get bookmarks of the indicated type on a specific address
    Specified by:
      `getBookmarks` in interface `BookmarkManager`
    Parameters:
      `address` - the address at which to search for bookmarks.
      `type` - bookmark type to search for
    Returns:
      array of bookmarks

  - ### getBookmarkAddresses

    public AddressSetView getBookmarkAddresses(String type)
    Description copied from interface: `BookmarkManager`
    Get addresses for bookmarks of a specified type.
    Specified by:
      `getBookmarkAddresses` in interface `BookmarkManager`
    Parameters:
      `type` - bookmark type
    Returns:
      address set containing bookmarks of the specified type.

  - ### filteredIterator

    protected static <T, U extends T> Iterator<T> filteredIterator(Iterator<U> it, Predicate<? super U> predicate)
    A less restrictive casting of `IteratorUtils.filteredIterator(Iterator, org.apache.commons.collections4.Predicate)`.

    This one understands that the predicate will be testing things of the (possibly more-specific) type of elements in the original iterator, not that of the returned iterator.

    Parameters:
      `it` - the iterator
      `predicate` - the predicate
    Returns:
      the iterator

  - ### getBookmarksIterator

    public Iterator<Bookmark> getBookmarksIterator(String type)
    Description copied from interface: `BookmarkManager`
    Get iterator over all bookmarks of the specified type.
    Specified by:
      `getBookmarksIterator` in interface `BookmarkManager`
    Parameters:
      `type` - the bookmark type to search for
    Returns:
      an iterator over all bookmarks of the specified type.

  - ### getBookmarksIterator

    public Iterator<Bookmark> getBookmarksIterator()
    Description copied from interface: `BookmarkManager`
    Returns an iterator over all bookmarks
    Specified by:
      `getBookmarksIterator` in interface `BookmarkManager`
    Returns:
      an iterator over all bookmarks

  - ### getBookmarkComparator

    protected Comparator<Bookmark> getBookmarkComparator(boolean forward)

  - ### getBookmarksIterator

    public Iterator<Bookmark> getBookmarksIterator(Address startAddress, boolean forward)
    Description copied from interface: `BookmarkManager`
    Returns an iterator over all bookmark types, starting at the given address, with traversal in the given direction.
    Specified by:
      `getBookmarksIterator` in interface `BookmarkManager`
    Parameters:
      `startAddress` - the address at which to start
      `forward` - true to iterate in the forward direction; false for backwards
    Returns:
      an iterator over all bookmark types, starting at the given address, with traversal in the given direction.

  - ### getBookmark

    public Bookmark getBookmark(long id)
    Description copied from interface: `BookmarkManager`
    Returns the bookmark that has the given id or null if no such bookmark exists.
    Specified by:
      `getBookmark` in interface `BookmarkManager`
    Parameters:
      `id` - the id of the bookmark to be retrieved.
    Returns:
      the bookmark

  - ### hasBookmarks

    public boolean hasBookmarks(String type)
    Description copied from interface: `BookmarkManager`
    Returns true if program contains one or more bookmarks of the given type
    Specified by:
      `hasBookmarks` in interface `BookmarkManager`
    Parameters:
      `type` - the type of bookmark to check for.
    Returns:
      true if program contains one or more bookmarks of the given type

  - ### getBookmarkCount

    public int getBookmarkCount(String type)
    Description copied from interface: `BookmarkManager`
    Return the number of bookmarks of the given type
    Specified by:
      `getBookmarkCount` in interface `BookmarkManager`
    Parameters:
      `type` - the type of bookmarks to count
    Returns:
      the number of bookmarks of the given type

  - ### getBookmarkCount

    public int getBookmarkCount()
    Description copied from interface: `BookmarkManager`
    Returns the total number of bookmarks in the program
    Specified by:
      `getBookmarkCount` in interface `BookmarkManager`
    Returns:
      the total number of bookmarks in the program

  - ### getTrace

    public Trace getTrace()

  - ### getSnap

    public long getSnap()

  - ### getProgram

    public TraceProgramView getProgram()
    Description copied from interface: `BookmarkManager`
    Returns the program associated with this BookmarkManager.
    Specified by:
      `getProgram` in interface `BookmarkManager`
    Specified by:
      `getProgram` in interface `TraceProgramViewBookmarkManager`
    Returns:
      the program associated with this BookmarkManager.