package edu.chl.proton.model;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Stina Werme
 * Created by stinawerme on 01/05/17.
 */
public class Folder extends FileSystemEntity {

    private List<Folder> childFolders = new ArrayList<Folder>();
    private List<File> files = new ArrayList<File>();


    public Folder(String name) {
        this.setName(name);

    }

    protected void addFolder(Folder folder) {
        folders.add(folder);
    }

    protected void addFile(File file) {
        files.add(file);
    }

    protected List<Folder> getFolders() {
        return childFolders;
    }

    protected List<File> getFiles() {
        return files;
    }

    protected void removeFolder(Folder folder) {
        childFolders.remove(folder);
    }

    protected void removeFile(File file) {
        files.remove(file);

    }
}

@@ -371,25 +371,24 @@
 Name(name);%0A
-%0A
     %7D%0A%0A    p
@@ -400,204 +400,444 @@
 ted 
-void addFolder(Folder folder) %7B%0A        folders.add(folder);%0A    %7D%0A%0A    protected void addFile(File file) %7B%0A        files.add(file);%0A    %7D%0A%0A    protected List%3CFolder%3E getFolders() %7B%0A        return
+List%3CFolder%3E getFolders() %7B%0A        return childFolders;%0A    %7D%0A%0A    protected List%3CFile%3E getFiles() %7B%0A        return files;%0A    %7D%0A%0A    protected void addFolder(Folder folder) %7B%0A        // Remove the given folder from its current folder%0A        folder.getParentFolder().removeFolder(folder);%0A        // Set the new parent folder%0A        folder.setParentFolder(this);%0A        // Add it to its new parent folder's child folder list%0A       
  chi
@@ -837,32 +837,44 @@
     childFolders
+.add(folder)
 ;%0A    %7D%0A%0A    pro
@@ -884,52 +884,291 @@
 ted 
-List%3CFile%3E getFiles() %7B%0A        return files
+void addFile(File file) %7B%0A        // Remove the given file from its current folder%0A        file.getParentFolder().removeFile(file);%0A        // Set the new parent folder%0A        file.setParentFolder(this);%0A        // Add it to its new parent folder's file list%0A        files.add(file)
 ;%0A  
@@ -1250,32 +1250,70 @@
 remove(folder);%0A
+        folder.setParentFolder(null);%0A
     %7D%0A%0A    prote
@@ -1373,16 +1373,52 @@
 e(file);
+%0A        file.setParentFolder(null);
 %0A%0A    %7D%0A

Update add and remove methods with new 'parentFolder'