Assignment 4

Due Date : 2/20 @ 11:59pm

Instructions

Each of you should have a repository in CCIS’s GitHub with the name assignment4-ccisLogin. Use this repository and add all your work there. In order to clone the repositories from CCIS GitHub to your machine (or watch this video video instructions):

  1. Sign in to GitHub.

  2. On your CCIS GitHub home page your Github Handle should appear on the left as a button/drop down menu. Click that button and from the drop down menu select cs8674sp15-seattle. The CCIS GitHub page will then navigate to the class' web page and to the contents that is available to you.

  3. On the right you should be able to see all repositories to which you have been given access. Find the repository whose name matches the pattern assignment4-ccisLogin, where ccisLogin is your CCIS login name, e.g,assignment4-john123, and click on it.

  4. On the repositories home page look at the bottom right hand corner for a button with the text Clone in Desktop. By clicking on this button your browser will launch the GitHub client that we installed in Lab1 and ask for a location on your drive to store the repository.

    If you are not using the GitHub client the clone URL is located above the Clone in Desktop button. Copy the URL and issue the following command on your shell git clone URL.

  5. Create a file and save it under the folder on your drive that you selected in the preceding step.

Remember to push your changes to the CCIS GitHub repository often.

Grading Criteria

Problem 1

All Java source code that is part of your solution to this problem must reside inside a java package with the name edu.neu.ccs.cs8674.sp15.seattle.assignment4.problem1

We are going to extend/add more operations to our implementation of binary trees (BT) from our previous assignment.

  1. add the operation deleteNode to BT; the operation takes in a Node, n, and if n is in the BT then remove n from the BT and return the new BT, else if n is not in the BT return the BT unchanged. The BT returned must be a valid BT, i.e., no dead nodes. Calling deleteNode on an empty BT should signal an error.
  2. add the operation mirror to BT; the operation returns a mirror image of the current BT. Here is an example Mirror Tree Example

Problem 2

All Java source code that is part of your solution to this problem must reside inside a java package with the name edu.neu.ccs.cs8674.sp15.seattle.assignment4.problem2

You have been tasked to implement the filesystem for a small embeded device called Duke. The company that is creating the device has given you the following list of requirements

File System for Duke

The filesystem is made up of folders and files. The device will be delivered with an initial filesystem that will contain one folder, the root folder. The filesystem should allow the creation of files and folders. All files and folders created will be under the root folder.

Files

A file must have the following properties

There are certain restrictions when it comes to files

For our initial testing phase the QA and the hardware engineers asked that at a minimum the following operations are available and working

  1. Create the empty root folder
  2. Create a file under a folder
  3. Create a folder under another folder
  4. Create any number of nested folders
  5. A save operation on files that can alter the size of the file as well as its last modified date

Folders

By default the filesystem comes with a folder called the root folder. All files and sub-folder can be accessed by starting at the root folder and navigating down to files and/or folders. Here is the initial list of properties for folders

There are certain restrictions when it comes to folders and their properties

Dates

A Date from the point of you of our system consists of

All ranges are inclusive, i.e., 1-12 allows for numbers 1,2,3,4,5,6,7,8,9,10,11 and 12.

To help us test and debug we also need the ability to print out a filesytem. For now we can display that on the console. The print out of a filesystem should show the following information for each filesystem element

  1. File
    • File name
    • File extension
    • File size in bytes
    • Creation date
    • Last modified date.
  2. Folder
    • Folder name
    • Folder size
    • Creation date
    • Last modified date

Here are a few more requirements on how the print out should be displayed.

Here are is one possible way of printing out the filesystem.

2014.01.02 (10:10) 2015.02.12 (23:12)  2.6   Mb     /         
2014.01.02 (10:10) 2015.02.12 (23:12)  50    Kb     README.txt
2014.01.02 (10:10) 2015.01.12 (23:12)  1.6   Mb     resources/
2014.01.02 (10:10) 2015.01.12 (23:12)  450   Kb       logo.res
2014.01.02 (10:10) 2015.01.01 (23:12)  200   Kb       error.res
2014.01.02 (10:10) 2015.01.20 (23:12)  300   Kb       popup.res
2014.01.02 (10:10) 2015.01.20 (23:12)  720   Kb       documentation.res
2014.01.02 (10:10) 2015.02.12 (23:12) 1000   Kb     bin/
2014.01.02 (10:10) 2015.02.12 (23:12)  400   Kb       install.bin
2014.01.02 (10:10) 2015.02.12 (23:12)  250   Kb       uninstall.bin
2014.01.02 (10:10) 2015.02.12 (23:12)  350   Kb       update.bin
2014.01.02 (10:10) 2014.11.18 (23:12)  1.3   Kb     cfg/
2014.01.02 (10:10) 2014.11.18 (23:12)  440   bytes    endpoints.cfg
2014.01.02 (10:10) 2014.02.12 (23:12)  220   bytes    layout.cfg
2014.01.02 (10:10) 2014.02.20 (23:12)  520   bytes    logging.cfg
2014.01.02 (10:10) 2014.02.25 (23:12)  120   bytes    updates.cfg

The filesystem should also support an operation that will print out the disk usage of the filesystem. For this operation the output should be the full path of the file/folder starting from the root folder as a string followed by the size occupied by that file/folder. Printing out the size should follow the same rules as described above concerning filesystem size units.

We should be able to call disk usage on the filesystem and optionally provide a sorting criterion. The possible sorting criteria are

Here are some possible ways of printing out the disk usage of a filesystem.

 
## disk usage with no sorting criterion

2.6   Mb     /         
50    Kb     /README.txt
1.6   Mb     /resources/
450   Kb     /resources/logo.res
200   Kb     /resources/error.res
300   Kb     /resources/popup.res
720   Kb     /resources/documentation.res
1000  Kb     /bin/
400   Kb     /bin/install.bin
250   Kb     /bin/uninstall.bin
350   Kb     /bin/update.bin
1.3   Kb     /cfg/
440   bytes  /cfg/endpoints.cfg
220   bytes  /cfg/layout.cfg
520   bytes  /cfg/logging.cfg
120   bytes  /cfg/updates.cfg
 
## disk usage sorted lexicographically (ignore case)

2.6   Mb     /
1000  Kb     /bin/
400   Kb     /bin/install.bin
250   Kb     /bin/uninstall.bin
350   Kb     /bin/update.bin
1.3   Kb     /cfg/
440   bytes  /cfg/endpoints.cfg
220   bytes  /cfg/layout.cfg
520   bytes  /cfg/logging.cfg
120   bytes  /cfg/updates.cfg
50    Kb     /README.txt
1.6   Mb     /resources/
720   Kb     /resources/documentation.res
200   Kb     /resources/error.res
450   Kb     /resources/logo.res
300   Kb     /resources/popup.res
 
## disk usage sorted by size (smallest to largest)

120   bytes  /cfg/updates.cfg
220   bytes  /cfg/layout.cfg
440   bytes  /cfg/endpoints.cfg
520   bytes  /cfg/logging.cfg
50    Kb     /README.txt
200   Kb     /resources/error.res
250   Kb     /bin/uninstall.bin
300   Kb     /resources/popup.res
350   Kb     /bin/update.bin
400   Kb     /bin/install.bin
450   Kb     /resources/logo.res
720   Kb     /resources/documentation.res
1000  Kb     /bin/
1.3   Kb     /cfg/
1.6   Mb     /resources/
2.6   Mb     /