|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.pipe.iterator.UnlabeledFileIterator
public class UnlabeledFileIterator
An iterator that generates instances from an initial directory or set of directories. The iterator will recurse through sub-directories. Each filename becomes the data field of an instance, and the targets are set to null. To set the target values to the directory name, use FileIterator instead.
Field Summary | |
---|---|
static java.util.regex.Pattern |
ALL_DIRECTORIES
Use as label names all the directory names in the filename. |
static java.util.regex.Pattern |
FIRST_DIRECTORY
Use as label names the first directory in the filename. |
static java.util.regex.Pattern |
LAST_DIRECTORY
Use as label name the last directory in the filename. |
static java.util.regex.Pattern |
STARTING_DIRECTORIES
Use as label names the directories specified in the constructor, optionally removing common prefix of all starting directories |
Constructor Summary | |
---|---|
|
UnlabeledFileIterator(java.io.File directory)
|
|
UnlabeledFileIterator(java.io.File[] directories)
|
protected |
UnlabeledFileIterator(java.io.File[] directories,
java.io.FileFilter fileFilter)
Construct a FileIterator that will supply filenames within initial directories as instances |
|
UnlabeledFileIterator(java.io.File directory,
java.io.FileFilter fileFilter)
|
|
UnlabeledFileIterator(java.lang.String directory)
|
|
UnlabeledFileIterator(java.lang.String[] directories,
java.io.FileFilter ff)
|
|
UnlabeledFileIterator(java.lang.String directory,
java.io.FileFilter filter)
|
Method Summary | |
---|---|
java.util.ArrayList<java.io.File> |
getFileArray()
|
boolean |
hasNext()
|
Instance |
next()
|
java.io.File |
nextFile()
|
void |
remove()
|
static java.io.File[] |
stringArray2FileArray(java.lang.String[] sa)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.regex.Pattern STARTING_DIRECTORIES
public static final java.util.regex.Pattern FIRST_DIRECTORY
public static final java.util.regex.Pattern LAST_DIRECTORY
public static final java.util.regex.Pattern ALL_DIRECTORIES
Constructor Detail |
---|
protected UnlabeledFileIterator(java.io.File[] directories, java.io.FileFilter fileFilter)
directories
- Array of directories to collect files fromfileFilter
- class implementing interface FileFilter that will decide which names to accept.
May be null.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 directory with the matcher.find() method. If null, then all instances
will have target null.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 UnlabeledFileIterator(java.lang.String[] directories, java.io.FileFilter ff)
public UnlabeledFileIterator(java.io.File directory, java.io.FileFilter fileFilter)
public UnlabeledFileIterator(java.io.File directory)
public UnlabeledFileIterator(java.io.File[] directories)
public UnlabeledFileIterator(java.lang.String directory)
public UnlabeledFileIterator(java.lang.String directory, java.io.FileFilter filter)
Method Detail |
---|
public java.util.ArrayList<java.io.File> getFileArray()
public static java.io.File[] stringArray2FileArray(java.lang.String[] sa)
public Instance next()
next
in interface java.util.Iterator<Instance>
public void remove()
remove
in interface java.util.Iterator<Instance>
public java.io.File nextFile()
public boolean hasNext()
hasNext
in interface java.util.Iterator<Instance>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |