public List<AudioFile> getAudioFiles() { List<AudioFile> result = new ArrayList<AudioFile>(); result.addAll(files); for (String string : folders.keySet()) { Folder f = folders.get(string); result.addAll(f.getAudioFiles()); } return result; }
/** * Adds a folder as child of this folder * * @param f */ public void addFolder(Folder f) { if (folders.containsKey(f.getName())) { Folder folder = folders.get(f.getName()); folder.addFoldersOf(f); } else { folders.put(f.getName(), f); f.setParentFolder(this); } }
/** * Adds all children folders of a given folder to this * * @param f */ private void addFoldersOf(Folder f) { folders.putAll(f.getFolders()); }
/** * Removes a folder from this folder * * @param f */ public void removeFolder(Folder f) { folders.remove(f.getName()); }