Package digilib.io

Class DocuDirCache

java.lang.Object
digilib.io.DocuDirCache
Direct Known Subclasses:
AliasingDocuDirCache

public class DocuDirCache extends Object
Author:
casties
  • Field Details

    • logger

      protected static org.slf4j.Logger logger
      general logger for this class
    • map

      HashMap of directories
    • fileClass

      protected FileOps.FileClass fileClass
      allowed file class (image/text)
    • numFiles

      protected AtomicInteger numFiles
      number of files in the whole cache (approximate)
    • hits

      protected AtomicInteger hits
      number of cache hits
    • misses

      protected AtomicInteger misses
      number of cache misses
  • Constructor Details

    • DocuDirCache

      public DocuDirCache(FileOps.FileClass fc, DigilibConfiguration dlConfig)
      Constructor with digilib configuration and file class.
      Parameters:
      fc - the FileClass
      dlConfig - the DigilibConfiguration
    • DocuDirCache

      public DocuDirCache()
      Default constructor. Uses FileClass.IMAGE.
  • Method Details

    • size

      public int size()
      The number of directories in the cache.
      Returns:
      the size
    • put

      public DocuDirectory put(DocuDirectory newdir)
      Add a DocuDirectory to the cache. Always returns the correct Object from the cache, either newdir one or another one.
      Parameters:
      newdir - the DocuDirectory
      Returns:
      dir the DocuDirectory
    • putDir

      public DocuDirectory putDir(DocuDirectory newDir)
      Add a directory to the cache and check its parents. Always returns the correct Object from the cache, either newDir or the cached one.
      Parameters:
      newDir - the DocuDirectory
      Returns:
      the DocuDirectory
    • getFile

      public DocuDirent getFile(String fn, int in, FileOps.FileClass fc)
      Deprecated.
      Returns the DocuDirent with the pathname fn and the index in of FileClass fc. If fn is a file then the corresponding DocuDirent is returned and the index is ignored.
      Parameters:
      fn - digilib pathname
      in - file index
      fc - file class
      Returns:
      the DocuDirent
    • getFile

      public DocuDirent getFile(String fn, int pn)
      Returns the DocuDirent with the pathname fn and the index in. If fn represents a file then the corresponding DocuDirent is returned and the number is ignored.
      Parameters:
      fn - digilib pathname
      pn - file number
      Returns:
      the DocuDirent
    • getDirectory

      public DocuDirectory getDirectory(String fn)
      Returns the DocuDirectory indicated by the pathname fn. If fn represents a file then its parent directory is returned.
      Parameters:
      fn - digilib pathname
      Returns:
      the DocuDirectory
    • getNumFiles

      public int getNumFiles()
      Returns:
      long the num files
    • getHits

      public int getHits()
      Returns:
      long the hits
    • getMisses

      public int getMisses()
      Returns:
      long the misses
    • getFileClass

      public FileOps.FileClass getFileClass()
      Returns:
      the FileClass
    • setFileClass

      public void setFileClass(FileOps.FileClass fileClass)
      Parameters:
      fileClass - the FileClass