Skip to content

OOA&D project for directory searching and comparison

License

Notifications You must be signed in to change notification settings

wendyltan/SearchDir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SearchDir

Object-Oriented Analysis and design class project for directory searching and difference comparison.

Basic Structure

  • builderModel: Store file and directory model class.Both of the model class use Builder pattern.
  • modeFactory: Store factory classes's codes,using Factory pattern here.
  • decoratorFilter: Store codes related to condition search ,using Decorator pattern here.
  • gui:Codes about gui.Here I'm using JavaFX to build the interface
  • sortStrategy: Store codes related to sorting directory files according to some rules,using Strategy pattern here.

Design

  • Use SFile to represent file object
  • Use SDirectory to represent directory object
  • Use FileListManager to store specific directory's files info,use Singleton pattern to avoid unneeded instance of this manager class.
  • Use Sort interface,and let other sorting method implements it
  • Use CondictionFilter interface,as ancient class of other condition filters
  • Use ModeFactory,return objects that implement Mode interface.
  • InfoGetter, get directory infos and make itself a decoratee,become capable to retrieve file infos filtered byCondiction

UML Design

UML

Usage

  • Run SearchGui for most of the functions with nice interface
  • Or InfoGetter.main() for only search by some criterias

Running screenshots

Basic:

  • Before Search

before

In log mode,you can search directories for result,but you can't use compare button.

  • First Search

first

The output will show in left window.Of course you can choose whichever side of window you want by toggling the combobox "left/right"

  • Second Search

second

Now that that directory you search on your disk has changed,it will show new infos at right window at default.

Till now,the program has automatically written info into logs.Now switch to compare mode:

compare

Then click compare button on main screen,then you might see something like this:

compare_result

compare_result

Then we know some files were removed from original place.

If there is any new file added in,you can see the changes too in differ log

Extra and command mode

You can use other sorting method while searching for directories infos:

sort_method

And you can search for some files with some condition under command line mode:

command1

command2

About:

about

What can it do?

  • Normal mode:

    • Given a directory path,outputs all directories and files' info on gui.
    • Automatically save above infos into a log file.
    • Be able to choose sorting method through a combobox.
    • Read log files that are already exist through gui.
    • If enter the same path twice into search box to search infos, it will build a new.txt log file.
    • Entering different path to search in this mode won't build new log file(or can't update new log)
  • Compare mode:

    • If info of searched dirs have changed on your machine,when in compare mode, it will generate a differ.txt file to show the old and new structure's difference
    • Make sure to have an old and new log file of same path first!(Otherwise compare will be meaningless)
  • Command line mode(InfoGetter):

    • According to fileSizefileTypefileLastEdit to search for matches and output in the console.

Noted

If you are confused about the comparison result,check the ori,new and differ log file.

If you want to see more about how design pattern is implemented in Java,check out my repo here: JavaDPImpl

About

OOA&D project for directory searching and comparison

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages