Class AbstractDirectory

java.lang.Object
megamek.common.util.fileUtils.AbstractDirectory
Direct Known Subclasses:
DirectoryItems

public abstract class AbstractDirectory extends Object
AbstractDirectory is a class that is used to define a directory.
  • Constructor Details

  • Method Details

    • getRootName

      public String getRootName()
    • setRootName

      public void setRootName(String rootName)
    • getRootPath

      public String getRootPath()
    • setRootPath

      public void setRootPath(String rootPath)
    • getCategories

      public Map<String,AbstractDirectory> getCategories()
    • getCategory

      @Nullable public AbstractDirectory getCategory(String categoryPath)
    • getNonEmptyCategoryPaths

      public List<String> getNonEmptyCategoryPaths()
    • getItems

      public Map<String,ItemFile> getItems()
    • getItemNames

      public Iterator<String> getItemNames(@Nullable String categoryName)
      Get the names of all the items in one of the categories.
      Parameters:
      categoryName - the String name of the category whose item names are required.
      Returns:
      an Iterator of String names. This value will not be null, but it may be empty.
    • getItem

      @Nullable public Object getItem(@Nullable String categoryName, String itemName) throws Exception
      Get the indicated item from the correct category.
      Parameters:
      categoryName - the String name of the category whose item names are required
      itemName - the String name of the indicated item
      Returns:
      the Object in the given category with the given name
      Throws:
      Exception - if there's any error getting the item
    • merge

      public void merge(AbstractDirectory other)
      Adds the given AbstractDirectory's contents to this one's. Note: equally named categories are integrated into one another, but for items in the exact same category (file path) and with the same name the item of other will replace the item in this AbstractDirectory.
      Parameters:
      other - The AbstractDirectory to merge into this one