Package ghidra.program.model.data

# Interface Category

All Superinterfaces:
  `Comparable<Category>`

public interface Category extends Comparable<Category>
Each data type resides in a given a category.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DataType`
  `addDataType(DataType dt, DataTypeConflictHandler handler)`
  Adds the given datatype to this category.
  `Category`
  `copyCategory(Category category, DataTypeConflictHandler handler, TaskMonitor monitor)`
  Make a new sub-category from the given category.
  `Category`
  `createCategory(String name)`
  Create a category with the given name; if category already exists, then return that category.
  `Category[]`
  `getCategories()`
  Get all categories in this category.
  `Category`
  `getCategory(String name)`
  Get a category with the given name.
  `CategoryPath`
  `getCategoryPath()`
  return the full CategoryPath for this category.
  `String`
  `getCategoryPathName()`
  Get the fully qualified name for this category.
  `DataType`
  `getDataType(String name)`
  Get a data type with the given name.
  `DataTypeManager`
  `getDataTypeManager()`
  Get the data type manager associated with this category.
  `DataType[]`
  `getDataTypes()`
  Get all data types in this category.
  `List<DataType>`
  `getDataTypesByBaseName(String name)`
  Get all data types in this category whose base name matches the base name of the given name.
  `long`
  `getID()`
  Get the ID for this category.
  `String`
  `getName()`
  Get the name of this category.
  `Category`
  `getParent()`
  Return this category's parent; return null if this is the root category.
  `Category`
  `getRoot()`
  Get the root category.
  `boolean`
  `isRoot()`
  Returns true if this is the root category.
  `void`
  `moveCategory(Category category, TaskMonitor monitor)`
  Move the given category to this category; category is removed from its original parent category.
  `void`
  `moveDataType(DataType type, DataTypeConflictHandler handler)`
  Move a data type into this category.
  `boolean`
  `remove(DataType type, TaskMonitor monitor)`
  Remove a datatype from this category.
  `boolean`
  `removeCategory(String name, TaskMonitor monitor)`
  Remove the named category from this category.
  `boolean`
  `removeEmptyCategory(String name, TaskMonitor monitor)`
  Remove the named category from this category, IFF it is empty.
  `void`
  `setName(String name)`
  Sets the name of this category.

  ### Methods inherited from interface java.lang.Comparable

  `compareTo`

- ## Method Details

  - ### getName

    String getName()
    Get the name of this category.
    Returns:
      the name.

  - ### setName

    void setName(String name) throws DuplicateNameException, InvalidNameException
    Sets the name of this category.
    Parameters:
      `name` - the new name for this category
    Throws:
      `DuplicateNameException` - if another category exists in the same parent with the same name
      `InvalidNameException` - if the name is not an acceptable name.

  - ### getCategories

    Category[] getCategories()
    Get all categories in this category.
    Returns:
      zero-length array if there are no categories.

  - ### getDataTypes

    DataType[] getDataTypes()
    Get all data types in this category.
    Returns:
      zero-length array if there are no data types.

  - ### getDataTypesByBaseName

    List<DataType> getDataTypesByBaseName(String name)
    Get all data types in this category whose base name matches the base name of the given name. The base name of a name is the first part of the string up to where the first ".conflict" occurs. In other words, finds all data types whose name matches the given name once any conflict suffixes have been removed from both the given name and the data types that are being scanned.
    Parameters:
      `name` - the name for which to get conflict related data types in this category. Note: the name that is passed in will be normalized to its base name, so you may pass in names with .conflict appended as a convenience.
    Returns:
      a list of data types that have the same base name as the base name of the given name.

  - ### addDataType

    DataType addDataType(DataType dt, DataTypeConflictHandler handler)
    Adds the given datatype to this category.
    Parameters:
      `dt` - the datatype to add to this category.
      `handler` - the DataTypeConflictHandler to use if conflicts are discovered.
    Returns:
      the new datatype with its category path adjusted.

  - ### getCategory

    Category getCategory(String name)
    Get a category with the given name.
    Parameters:
      `name` - the name of the category.
    Returns:
      null if there is no category by this name.

  - ### getCategoryPath

    CategoryPath getCategoryPath()
    return the full CategoryPath for this category.
    Returns:
      the full CategoryPath for this category.

  - ### getDataType

    DataType getDataType(String name)
    Get a data type with the given name.
    Parameters:
      `name` - the name of the data type.
    Returns:
      null if there is no data type by this name.

  - ### createCategory

    Category createCategory(String name) throws InvalidNameException
    Create a category with the given name; if category already exists, then return that category.
    Parameters:
      `name` - the category name.
    Returns:
      the category.
    Throws:
      `InvalidNameException` - if name has invalid characters.

  - ### removeCategory

    boolean removeCategory(String name, TaskMonitor monitor)
    Remove the named category from this category.
    Parameters:
      `name` - the name of the category to remove.
      `monitor` - the task monitor.
    Returns:
      true if the category was removed.

  - ### removeEmptyCategory

    boolean removeEmptyCategory(String name, TaskMonitor monitor)
    Remove the named category from this category, IFF it is empty.
    Parameters:
      `name` - the name of the category to remove.
      `monitor` - the task monitor.
    Returns:
      true if the category was removed.

  - ### moveCategory

    void moveCategory(Category category, TaskMonitor monitor) throws DuplicateNameException
    Move the given category to this category; category is removed from its original parent category.
    Parameters:
      `category` - the category to move.
      `monitor` - the monitor.
    Throws:
      `DuplicateNameException` - if this category already contains a category or data type with the same name as the category param.

  - ### copyCategory

    Category copyCategory(Category category, DataTypeConflictHandler handler, TaskMonitor monitor)
    Make a new sub-category from the given category.
    Parameters:
      `category` - the category to copy into this category.
      `handler` - the handler to call if there is a data type conflict.
      `monitor` - the monitor.
    Returns:
      category that is added to this category.

  - ### getParent

    Category getParent()
    Return this category's parent; return null if this is the root category.
    Returns:
      the category.

  - ### isRoot

    boolean isRoot()
    Returns true if this is the root category.
    Returns:
      true if this is the root category.

  - ### getCategoryPathName

    String getCategoryPathName()
    Get the fully qualified name for this category.
    Returns:
      the name.

  - ### getRoot

    Category getRoot()
    Get the root category.
    Returns:
      the category.

  - ### getDataTypeManager

    DataTypeManager getDataTypeManager()
    Get the data type manager associated with this category.
    Returns:
      the manager.

  - ### moveDataType

    void moveDataType(DataType type, DataTypeConflictHandler handler) throws DataTypeDependencyException
    Move a data type into this category.
    Parameters:
      `type` - data type to be moved.
      `handler` - the handler to call if there is a data type conflict.
    Throws:
      `DataTypeDependencyException` - if a disallowed dependency is created during the move.

  - ### remove

    boolean remove(DataType type, TaskMonitor monitor)
    Remove a datatype from this category.
    Parameters:
      `type` - data type to be removed.
      `monitor` - monitor of progress in case operation takes a long time.
    Returns:
      true if the data type was found in this category and successfully removed.

  - ### getID

    long getID()
    Get the ID for this category.
    Returns:
      the ID.