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  // $Id: FileList.java 3461 2008-08-07 17:43:26Z pramirez $
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  }