Search in sources :

Example 1 with NewFileInfo

use of aserg.gtf.model.NewFileInfo in project Truck-Factor by aserg-ufmg.

the class GitTruckFactor method applyRegexSelect.

private static void applyRegexSelect(List<NewFileInfo> files, String exp) {
    int count = 0;
    for (NewFileInfo newFileInfo : files) {
        if (!newFileInfo.getFiltered()) {
            if (!newFileInfo.getPath().matches(exp)) {
                count++;
                newFileInfo.setFiltered(true);
                newFileInfo.setFilterInfo("REGEX: " + exp);
            }
        }
    }
    LOGGER.info("REGEX FILTER = " + count);
}
Also used : NewFileInfo(aserg.gtf.model.NewFileInfo)

Example 2 with NewFileInfo

use of aserg.gtf.model.NewFileInfo in project Truck-Factor by aserg-ufmg.

the class GitTruckFactorRepList method applyRegexSelect.

private static void applyRegexSelect(List<NewFileInfo> files, String exp) {
    int count = 0;
    for (NewFileInfo newFileInfo : files) {
        if (!newFileInfo.getFiltered()) {
            if (!newFileInfo.getPath().matches(exp)) {
                count++;
                newFileInfo.setFiltered(true);
                newFileInfo.setFilterInfo("REGEX: " + exp);
            }
        }
    }
    System.out.println("REGEX FILTER = " + count);
}
Also used : NewFileInfo(aserg.gtf.model.NewFileInfo)

Example 3 with NewFileInfo

use of aserg.gtf.model.NewFileInfo in project Truck-Factor by aserg-ufmg.

the class GitTruckFactorRepList method applyRegexFilter.

private static void applyRegexFilter(List<NewFileInfo> files, String exp) {
    int count = 0;
    for (NewFileInfo newFileInfo : files) {
        if (!newFileInfo.getFiltered()) {
            if (newFileInfo.getPath().matches(exp)) {
                count++;
                newFileInfo.setFiltered(true);
                newFileInfo.setFilterInfo("REGEX: " + exp);
            }
        }
    }
    System.out.println("REGEX FILTER = " + count);
}
Also used : NewFileInfo(aserg.gtf.model.NewFileInfo)

Example 4 with NewFileInfo

use of aserg.gtf.model.NewFileInfo in project Truck-Factor by aserg-ufmg.

the class LinguistExtractor method execute.

public List<NewFileInfo> execute() {
    List<NewFileInfo> linguistFiles = new ArrayList<NewFileInfo>();
    try {
        Map<String, List<String>> languageMap = new HashMap<String, List<String>>();
        //System.out.format("%s (%s): Extracting file language information...\n",repositoryName, new Date());
        BufferedReader br = new BufferedReader(new FileReader(repositoryPath + fileName));
        String sCurrentLine;
        String[] values;
        while ((sCurrentLine = br.readLine()) != null) {
            values = sCurrentLine.split(";");
            String language = values[0];
            if (language.contains("\'"))
                language = language.replace("'", "''");
            String path = values[1];
            linguistFiles.add(new NewFileInfo(repositoryName, path, language));
        }
        br.close();
    } catch (FileNotFoundException e) {
        LOGGER.warn(fileName + " not found. Executing without Linguist filter.");
        linguistFiles = null;
    } catch (Exception e) {
        LOGGER.error("Erro no projeto " + repositoryName, e);
        linguistFiles = null;
    }
    return linguistFiles;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BufferedReader(java.io.BufferedReader) FileNotFoundException(java.io.FileNotFoundException) ArrayList(java.util.ArrayList) List(java.util.List) FileReader(java.io.FileReader) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) NewFileInfo(aserg.gtf.model.NewFileInfo)

Example 5 with NewFileInfo

use of aserg.gtf.model.NewFileInfo in project Truck-Factor by aserg-ufmg.

the class LinguistExtractor method setNotLinguist.

public List<NewFileInfo> setNotLinguist(List<NewFileInfo> files) throws IOException {
    Map<String, NewFileInfo> linguistFilesMap = new HashMap<String, NewFileInfo>();
    List<NewFileInfo> linguistFiles = execute();
    if (linguistFiles != null) {
        for (NewFileInfo linguistFile : linguistFiles) {
            linguistFilesMap.put(linguistFile.getPath(), linguistFile);
        }
        for (NewFileInfo file : files) {
            if (linguistFilesMap.containsKey(file.getPath())) {
                file.setLanguage(linguistFilesMap.get(file.getPath()).getLanguage());
            } else {
                file.setFiltered(true);
                file.setFilterInfo("NOTLINGUIST");
            }
        }
    }
    return files;
}
Also used : HashMap(java.util.HashMap) NewFileInfo(aserg.gtf.model.NewFileInfo)

Aggregations

NewFileInfo (aserg.gtf.model.NewFileInfo)16 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 LogCommitInfo (aserg.gtf.model.LogCommitInfo)3 Repository (aserg.gtf.model.authorship.Repository)3 DOACalculator (aserg.gtf.task.DOACalculator)3 BufferedReader (java.io.BufferedReader)3 FileReader (java.io.FileReader)3 HashMap (java.util.HashMap)3 GreedyTruckFactor (aserg.gtf.truckfactor.GreedyTruckFactor)2 TFInfo (aserg.gtf.truckfactor.TFInfo)2 TruckFactor (aserg.gtf.truckfactor.TruckFactor)2 LineInfo (aserg.gtf.util.LineInfo)2 FileNotFoundException (java.io.FileNotFoundException)2 Date (java.util.Date)2 NewFileInfoDAO (aserg.gtf.dao.NewFileInfoDAO)1 File (aserg.gtf.model.authorship.File)1 NewAliasHandler (aserg.gtf.task.NewAliasHandler)1 FileInfoExtractor (aserg.gtf.task.extractor.FileInfoExtractor)1