Package loci.formats

Class ResourceNamer

java.lang.Object
loci.formats.ResourceNamer

public class ResourceNamer extends Object
Utility class helping with generating human-readable resource names based on alphanumeric indexing.
Since:
5.0
Author:
Blazej Pindelski, bpindelski at dundee.ac.uk
  • Field Details

  • Constructor Details

    • ResourceNamer

      public ResourceNamer(int resourceCount)
  • Method Details

    • getLocationFromResourceName

      public loci.common.Location getLocationFromResourceName(loci.common.Location resourceParentPath, String resourceName, int nameIndex, String resourceExtension)
      Creates a new Location instance using the provided parent path and child node name. Concatenates the child name with a numerical index that acts as an incrementing counter of node elements.
      Parameters:
      resourceParentPath - Path to the parent element.
      resourceName - Template string used for naming the child resource.
      nameIndex - Numerical value used for naming the child resource.
      resourceExtension - Optional extension (if the child resource is a file) or path separator (if folder).
      Returns:
      Location New instance representing the parent and child resources.
    • restartAlphabet

      public void restartAlphabet()
      Resets the internal state of the class so that it starts alphabet generation from the first letter (ASCII A).
    • nextLetter

      public void nextLetter()
      Increments the internal alphabet pointer to the next element of the alphabet.
    • getLetter

      public String getLetter()
      Returns a String representing a single letter (in the case where the class instance has been initialized with a resource count lower than 26) or a concatenation of two letters (if resource count is higher than 26).
      Returns:
      See above.
    • alphabeticIndexCount

      public static int alphabeticIndexCount(String index)