1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package gov.nasa.pds.tools.file;
16
17 import java.util.ArrayList;
18 import java.util.Collection;
19 import java.util.List;
20
21 /***
22 * Class that can hold a list of files and directories. Used to store files
23 * and directories found when traversing a directory.
24 *
25 * @author mcayanan
26 *
27 */
28 public class FileList {
29
30 private List files;
31 private List dirs;
32
33 public FileList() {
34 files = new ArrayList();
35 dirs = new ArrayList();
36 }
37
38 /***
39 * Adds a single object to the end of the file list
40 * @param o a single file to add
41 */
42 public void addToFileList(Object o) {
43 files.add(o);
44 }
45
46 /***
47 * Adds a list of objects to the end of the file list
48 * @param c a list of files to add
49 */
50 public void addToFileList(Collection c) {
51 files.addAll(c);
52 }
53
54 /***
55 * Adds a single object to the end of the directory list
56 * @param o a single directory to add
57 */
58 public void addToDirList(Object o) {
59 dirs.add(o);
60 }
61
62 /***
63 * Adds a list of objects to the end of the directory list
64 * @param c a list of directories to add
65 */
66 public void addToDirList(Collection c) {
67 dirs.addAll(c);
68 }
69
70 /***
71 * Gets files that were added to the list
72 * @return a list of files
73 */
74 public List getFiles() {
75 return files;
76 }
77
78 /***
79 * Gets directories that were added to the list
80 * @return a list of directories
81 */
82 public List getDirs() {
83 return dirs;
84 }
85 }