00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package dochelper.xins;
00011
00012 import java.io.File;
00013 import java.io.IOException;
00014 import java.util.ArrayList;
00015 import java.util.regex.Pattern;
00016
00017 import dochelper.FileRecordSet;
00018 import dochelper.util.FileUtils;
00019
00027 public class XINSFunctionRecordSet extends FileRecordSet {
00028
00029
00030
00031
00032 protected void _listDirectory(ArrayList stack, ArrayList files, String directory, String glob, boolean recursive) throws IOException {
00033
00034 if(stack.contains(directory)) {
00035
00036 return;
00037 } else
00038 stack.add(directory);
00039
00040 File[] _files = FileUtils._listDirectory(directory);
00041
00042 if(_files == null || _files.length == 0)
00043 return;
00044
00045 for(int i = 0; i < _files.length; i++) {
00046 File file = _files[i];
00047
00048 if(file.isDirectory()) {
00049
00050 if(recursive) {
00051
00052 String canonPath = file.getCanonicalPath();
00053
00054 _listDirectory(stack,files, canonPath, glob,recursive);
00055 }
00056 } else {
00057
00058 if(!Pattern.matches(glob, file.getName()))
00059 continue;
00060
00061
00062 files.add(new XINSFunctionRecord(file, this.getName() + "Record"));
00063 }
00064 }
00065
00066 }
00067
00068 }