edu.stanford.nlp.io
Class NumberRangeFileFilter

java.lang.Object
  |
  +--edu.stanford.nlp.io.NumberRangeFileFilter
All Implemented Interfaces:
FileFilter

public class NumberRangeFileFilter
extends Object
implements FileFilter

Implements a file filter that examines a number in a filename to determine acceptance. This is useful for wanting to process ranges of numbered files in collections where each file has some name, part of which is alphabetic and constant, and part of which is numeric. The test is evaluated based on the rightmost natural number found in the filename string. (It only looks in the final filename, not in other components of the path.) Number ranges are inclusive.


Constructor Summary
NumberRangeFileFilter(int min, int max, boolean recurse)
          Sets up a NumberRangeFileFilter by specifying the range of numbers to accept, and whether to also traverse folders for recursive search.
 
Method Summary
 boolean accept(File file)
          Checks whether a file satisfies the number range selection filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberRangeFileFilter

public NumberRangeFileFilter(int min,
                             int max,
                             boolean recurse)
Sets up a NumberRangeFileFilter by specifying the range of numbers to accept, and whether to also traverse folders for recursive search.

Parameters:
min - The minimum number file to accept (checks >= this one)
max - The maximum number file to accept (checks <= this one)
recurse - go into folders
Method Detail

accept

public boolean accept(File file)
Checks whether a file satisfies the number range selection filter.

Specified by:
accept in interface FileFilter
Parameters:
file - The file
Returns:
true if the file is within the range filtered for


Stanford NLP Group