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