package net.pterodactylus.jsite.project;
import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
*/
private static class ProjectFileImpl implements ProjectFile {
+ private final ProjectFileImpl parentProjectFile;
+ private final String name;
+ private final boolean directory;
+ private final boolean hidden;
+ private List<ProjectFileImpl> childProjectFiles = new ArrayList<ProjectFileImpl>();
+
+
+
+ public ProjectFileImpl(ProjectFileImpl parentProjectFile, String name, boolean isDirectory, boolean isHidden) {
+ this.parentProjectFile = parentProjectFile;
+ this.name = name;
+ this.directory = isDirectory;
+ this.hidden = isHidden;
+ }
+
+ //
+ // INTERFACE ProjectFile
+ //
+
/**
* @see net.pterodactylus.jsite.project.ProjectFile#getName()
*/
public String getName() {
- // TODO Auto-generated method stub
- return null;
+ return name;
}
/**
* @see net.pterodactylus.jsite.project.ProjectFile#getParents()
*/
public List<ProjectFile> getParents() {
- // TODO Auto-generated method stub
- return null;
+ List<ProjectFile> parentProjectFiles = new ArrayList<ProjectFile>();
+ ProjectFileImpl currentProjectFile = this;
+ do {
+ parentProjectFiles.add(0, currentProjectFile);
+ } while ((currentProjectFile = currentProjectFile.parentProjectFile) != null);
+ return parentProjectFiles;
}
/**
// TODO Auto-generated method stub
return null;
}
+
+ //
+ // PRIVATE METHODS
+ //
+
+ private ProjectFileImpl getParent() {
+ return parentProjectFile;
+ }
+
+
}
}