import java.util.*; public class CompoundFile extends File { // instance varible to hold the file list; ArrayList File_list; // constructor CompoundFile(File oneFile, String name){ super(oneFile,name); File_list = new ArrayList(); } public CompoundFile getDir() { return this; } // method to check if there is a file got the name str public boolean isExist(String str) { if (!File_list.isEmpty()) { for (int k = 0; k < File_list.size(); k ++) { File tmpFile = (File)(File_list.get(k)); String nameFound = tmpFile.getFileName().getI(); if (nameFound.compareTo(str) == 0) return true; } return false; } return false; } // end of isExist(String) // method to print the disk usage public void print(String s) { String dirName = this.getFileName().getI(); String str = s + dirName; if (File_list.isEmpty()) System.out.println(str); else { for (int k = 0; k < File_list.size(); k ++) { File tmpFile = (File)(File_list.get(k)); tmpFile.print(str + "/"); } System.out.println(str); } } // end of print method }// end of class compoundFile