Package gov.nara.nwts.ftapp.filetest

Source Code of gov.nara.nwts.ftapp.filetest.DirMatch

package gov.nara.nwts.ftapp.filetest;

import gov.nara.nwts.ftapp.FTDriver;
import gov.nara.nwts.ftapp.stats.DirStats;
import gov.nara.nwts.ftapp.stats.Stats;

import java.io.File;

/**
* Create FileAnalyzer statistics by directory.
* @author TBrady
*
*/
class DirMatch extends DefaultFileTest {

  public DirMatch(FTDriver dt) {
    super(dt);
  }

  public String toString() {
    return "Match By Path";
  }
  public String getKey(File f) {
    return getKey(f, f.getParentFile());
  }
 
  public String getKey(File f, Object parentdir) {
    String key = "";
    if (parentdir instanceof File) {
      key = ((File)parentdir).getAbsolutePath().substring(getRoot().getAbsolutePath().length());
    }
    return key;   
  }
 
    public String getShortName(){return "Path";}

  public Object fileTest(File f) {
    return null;
  }
    public Stats createStats(String key){
      return new DirStats(key);
    }
    public Object[][] getStatsDetails() {
      return DirStats.details;
    }
  public void initFilters() {
    initAllFilters();
  }

  public String getDescription() {
    return "This test counts the number of items found in a specific directory.  This test will also compute cumulative totals found for each directory that is scanned.";
  }

}
TOP

Related Classes of gov.nara.nwts.ftapp.filetest.DirMatch

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.