Skip to content

usf-cs272-fall2022/homework-FileSorter-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileSorter

Points

For this homework, you will explore using the Comparable and Comparator interfaces, and anonymous inner classes, non-static inner classes, and static nested classes to sort files by different properties.

Hints

Below are some hints that may help with this homework assignment:

  • Focus first on implementing the Comparable interface for the FileMetadata static nested class. You will need to modify the declaration of this class and add method(s) for this part.

    ⚠️ There will be at least one warning in the test code until you properly implement the Comparable interface!

  • The Comparator members require you to (1) create either an anonymous inner class, non-static inner class, or static nested class and (2) initialize an instance of that class. You may add additional classes, methods, and/or members for this part as needed.

  • Remember, to initialize an instance of a non-static inner class, you need an instance of the outer class first. See the Java Tutorials: Nested Classes tutorial for examples. One example they provide is:

    OuterClass outerObject = new OuterClass();
    OuterClass.InnerClass innerObject = outerObject.new InnerClass();

    This can be combined into a single line as follows:

     OuterClass.InnerClass example = new OuterClass().new InnerClass();
  • This homework will not be directly used by any project. However, it is useful for demonstrating different approaches to sorting data, which may come in handy for project 2 when sorting search results.

These hints are optional. There may be multiple approaches to solving this homework.

Instructions

Use the "Tasks" view in Eclipse to find the TODO comments for what need to be implemented and the "Javadoc" view to see additional details.

The tests are provided in the src/test/ directory; do not modify any of the files in that directory. Check the run details on GitHub Actions for how many points each test group is worth.

See the Homework Guides for additional details on homework requirements and submission.

About

FileSorter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages