/** * Construct a FileListIterator with the file containing the list of files, which * contains one filename per line. * * The instances constructed from the filelist are returned in the same order * as listed */ public FileListIterator(File filelist, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) throws FileNotFoundException, IOException { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; List filenames = readFileNames (filelist); File[] fa = stringList2FileArray (filenames, null); fillFileArrayAssignCommonPrefixIndexAndSubIterator(fa, removeCommonPrefix); }
private static Iterator<Instance> constructIterator (File trainFile, File dataDir, boolean isList) throws IOException { if (isList) { return new FileListIterator (trainFile, dataDir, null, null, true); } else { return new LineGroupIterator (new FileReader (trainFile), Pattern.compile ("^\\s*$"), true); } }
/** * Construct an iterator over the given arry of Files * * The instances constructed from the files are returned in the same order * as they appear in the given array * * @param files Array of files from which to construct instances * @param fileFilter class implementing interface FileFilter that will decide which names to accept. * May be null. * @param targetPattern regex Pattern applied to the filename whose first parenthesized group * on matching is taken to be the target value of the generated instance. * The pattern is applied to the filename with the matcher.find() method. * @param removeCommonPrefix boolean that modifies the behavior of the STARTING_DIRECTORIES * pattern, removing the common prefix of all initially specified * directories, leaving the remainder of each filename as the target value. * */ public FileListIterator(File[] files, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; fillFileArrayAssignCommonPrefixIndexAndSubIterator(files, removeCommonPrefix); }
private static Iterator<Instance> constructIterator (File trainFile, File dataDir, boolean isList) throws IOException { if (isList) { return new FileListIterator (trainFile, dataDir, null, null, true); } else { return new LineGroupIterator (new FileReader (trainFile), Pattern.compile ("^\\s*$"), true); } }
/** * Construct an iterator over the given arry of Files * * The instances constructed from the files are returned in the same order * as they appear in the given array * * @param files Array of files from which to construct instances * @param fileFilter class implementing interface FileFilter that will decide which names to accept. * May be null. * @param targetPattern regex Pattern applied to the filename whose first parenthesized group * on matching is taken to be the target value of the generated instance. * The pattern is applied to the filename with the matcher.find() method. * @param removeCommonPrefix boolean that modifies the behavior of the STARTING_DIRECTORIES * pattern, removing the common prefix of all initially specified * directories, leaving the remainder of each filename as the target value. * */ public FileListIterator(File[] files, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; fillFileArrayAssignCommonPrefixIndexAndSubIterator(files, removeCommonPrefix); }
/** * Construct a FileListIterator with the file containing the list of files, which * contains one filename per line. * * The instances constructed from the filelist are returned in the same order * as listed */ public FileListIterator(File filelist, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) throws FileNotFoundException, IOException { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; List filenames = readFileNames (filelist); File[] fa = stringList2FileArray (filenames, null); fillFileArrayAssignCommonPrefixIndexAndSubIterator(fa, removeCommonPrefix); }
private static Iterator<Instance> constructIterator (File trainFile, File dataDir, boolean isList) throws IOException { if (isList) { return new FileListIterator (trainFile, dataDir, null, null, true); } else { return new LineGroupIterator (new FileReader (trainFile), Pattern.compile ("^\\s*$"), true); } }
/** * Construct an iterator over the given arry of Files * * The instances constructed from the files are returned in the same order * as they appear in the given array * * @param files Array of files from which to construct instances * @param fileFilter class implementing interface FileFilter that will decide which names to accept. * May be null. * @param targetPattern regex Pattern applied to the filename whose first parenthesized group * on matching is taken to be the target value of the generated instance. * The pattern is applied to the filename with the matcher.find() method. * @param removeCommonPrefix boolean that modifies the behavior of the STARTING_DIRECTORIES * pattern, removing the common prefix of all initially specified * directories, leaving the remainder of each filename as the target value. * */ public FileListIterator(File[] files, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; fillFileArrayAssignCommonPrefixIndexAndSubIterator(files, removeCommonPrefix); }
/** * Construct a FileListIterator with the file containing the list of files, which * contains one filename per line. * * The instances constructed from the filelist are returned in the same order * as listed */ public FileListIterator(File filelist, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) throws FileNotFoundException, IOException { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; List filenames = readFileNames (filelist); File[] fa = stringList2FileArray (filenames, null); fillFileArrayAssignCommonPrefixIndexAndSubIterator(fa, removeCommonPrefix); }
/** * Construct a FileListIterator with the file containing the list of files * of RELATIVE pathnames, one filename per line. * <p> * The instances constructed from the filelist are returned in the same order * as listed * @param filelist List of relative file names. * @param baseDirectory Base directory for relative file names. * */ public FileListIterator(File filelist, File baseDirectory, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) throws FileNotFoundException, IOException { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; List filenames = readFileNames (filelist); File[] fa = stringList2FileArray (filenames, baseDirectory); fillFileArrayAssignCommonPrefixIndexAndSubIterator(fa, removeCommonPrefix); }
/** * Construct a FileListIterator with the file containing the list of files * of RELATIVE pathnames, one filename per line. * <p> * The instances constructed from the filelist are returned in the same order * as listed * @param filelist List of relative file names. * @param baseDirectory Base directory for relative file names. * */ public FileListIterator(File filelist, File baseDirectory, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) throws FileNotFoundException, IOException { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; List filenames = readFileNames (filelist); File[] fa = stringList2FileArray (filenames, baseDirectory); fillFileArrayAssignCommonPrefixIndexAndSubIterator(fa, removeCommonPrefix); }
/** * Construct a FileListIterator with the file containing the list of files * of RELATIVE pathnames, one filename per line. * <p> * The instances constructed from the filelist are returned in the same order * as listed * @param filelist List of relative file names. * @param baseDirectory Base directory for relative file names. * */ public FileListIterator(File filelist, File baseDirectory, FileFilter fileFilter, Pattern targetPattern, boolean removeCommonPrefix) throws FileNotFoundException, IOException { this.fileFilter = fileFilter; this.fileArray = new ArrayList(); this.targetPattern = targetPattern; List filenames = readFileNames (filelist); File[] fa = stringList2FileArray (filenames, baseDirectory); fillFileArrayAssignCommonPrefixIndexAndSubIterator(fa, removeCommonPrefix); }