Git Product home page Git Product logo

commandlinetree's Introduction

commandLineTree

A Console-based program to print tree of folders and files of any given path.

Besides, This project provides the implementation of Tree ADT that acts as a Set (Collection) and can be reused in any other projects. Moreover, the Tree ADT supports weight along each edge. The source code for the Tree and its components is located at ..\commandLineTree\src\logicLayer\tree\

img.png

The Tree ADT implementation supports some methods such as:

  • Get subtree of a node
  • Move subtree of node A to node B
  • AddNode(To parent, From Child)
  • Get value (label) at given index in pre-order traversal
  • Find the lowest common ancestor of two given labels
  • Pre-order Traversal
  • Get level of a node
  • Get height of a node
  • and many more...

How to run

  • run Client.java which is located at the path ..\commandLineTree\src\client\Client.java

How to reuse Tree class:

  • Initialize new Tree instance: Tree<data_type> t = new Tree<>()
  • Add new label to the tree: t.add(18)

See test.java for more.

Note

For some environments such as Windows cmd or Eclipse, the program may not be displayed correctly due to the use of extended ASCII characters. Please use any text file encoding in your IDE that supports extended ASCII like UTF-8. For example, in Eclipse:

img.png

Besides, IntelliJ IDEA has no display problem when running the program.

Techniques

  • This program redesigns Dr. Le, Minh Duc's fundamental design (Node - Edge) to implement the abstract data type Tree (ADT).
  • It also implements Java's Set interface.
  • A feature that stands out from the prototype design is:
    Instead of using two Vector properties to store Node and Edge, the program is built around two HashMap properties to reduce time complexity while traversing the tree.

Specifically, The first HashMap attributes is HashMap<Node<E>, Edge<E>> parentEdges.
This property allows edge storage that connects a node to its parent node. With something similar to a while loop, it is possible to trace the edges of each node to the ancestral nodes all the way to the root of the tree.

img.png


The Second HashMap attributes is HashMap<Node<E>, List<Edge<E>>> properF1DescEdges. It records each node's edges to its "F1" child nodes.

img.png

Usage

Enter the path of the desired folder.

img.png

Optional Argument

There is an optional argument when typing your path to style the Tree: -s.

A Complete syntax should be --path [-s]

For example:
C:/your-path/a-folder/ -s

With this argument, It is possible to distinguish between directory and file.

img.png

About the author

Phan Quang Tuan, a Software Engineering student of FIT HANU.

References:
[1] Dr. Le, Minh Duc. (2021). Object Oriented Program Development Undergraduate Programming CourseBook.
[2] Mr. Dang Dinh Quan. Software Engineering 1 Fall 2021 Course Slides.
[3] Liskov, B., & Guttag, J. (2001). Program Development in Java: Abstraction, Specification, and Object-Oriented Design. Addison-Wesley.

License

This program is released under the MIT License.

commandlinetree's People

Contributors

tuanphantom avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.