View Javadoc

1   //Copyright 2006-2007, by the California Institute of Technology.
2   //ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged.
3   //Any commercial use must be negotiated with the Office of Technology Transfer
4   //at the California Institute of Technology.
5   //
6   //This software is subject to U. S. export control laws and regulations
7   //(22 C.F.R. 120-130 and 15 C.F.R. 730-774). To the extent that the software
8   //is subject to U.S. export control laws and regulations, the recipient has
9   //the responsibility to obtain export licenses or other export authority as
10  //may be required before exporting such information to foreign countries or
11  //providing access to foreign nationals.
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  }