- Timestamp:
- 08/05/14 10:00:41 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/loader/AbstractFolderLoader.java
r2 r4 9 9 import de.ugoe.cs.cpdp.versions.SoftwareVersion; 10 10 11 11 /** 12 * Abstract class for loading data from a folder. The subfolders of a defined 13 * folder define the projects, the file contained in the subfolder are the 14 * versions of a project. 15 * 16 * @author Steffen Herbold 17 */ 12 18 public abstract class AbstractFolderLoader implements IVersionLoader { 13 14 // TODO15 interface SingleVersionLoader {16 Instances load(File file);17 boolean filenameFilter(String filename);18 }19 19 20 20 /** … … 22 22 */ 23 23 private String path = ""; 24 24 25 25 /** 26 26 * @see de.ugoe.cs.cpdp.loader.IVersionLoader#setLocation(java.lang.String) … … 28 28 @Override 29 29 public void setLocation(String location) { 30 path =location;30 path = location; 31 31 } 32 32 33 33 /** 34 34 * @see de.ugoe.cs.cpdp.loader.IVersionLoader#load() … … 37 37 public List<SoftwareVersion> load() { 38 38 final List<SoftwareVersion> versions = new LinkedList<SoftwareVersion>(); 39 39 40 40 final File dataDir = new File(path); 41 41 final SingleVersionLoader instancesLoader = getSingleLoader(); 42 43 for ( File projectDir : dataDir.listFiles()) {44 if ( projectDir.isDirectory()) {42 43 for (File projectDir : dataDir.listFiles()) { 44 if (projectDir.isDirectory()) { 45 45 String projectName = projectDir.getName(); 46 for( File versionFile : projectDir.listFiles() ) { 47 if( versionFile.isFile() && instancesLoader.filenameFilter(versionFile.getName()) ) { 46 for (File versionFile : projectDir.listFiles()) { 47 if (versionFile.isFile() 48 && instancesLoader.filenameFilter(versionFile 49 .getName())) { 48 50 String versionName = versionFile.getName(); 49 51 Instances data = instancesLoader.load(versionFile); 50 versions.add(new SoftwareVersion(projectName, versionName, data)); 52 versions.add(new SoftwareVersion(projectName, 53 versionName, data)); 51 54 } 52 55 } … … 55 58 return versions; 56 59 } 57 60 61 /** 62 * Returns the concrete {@link SingleVersionLoader} to be used with this 63 * folder loader. 64 * 65 * @return 66 */ 58 67 abstract protected SingleVersionLoader getSingleLoader(); 59 68 }
Note: See TracChangeset
for help on using the changeset viewer.