How the main method will initially build the graph

Assignment Help JAVA Programming
Reference no: EM133457159 , Length: 4 pages

Data Structures and Analysis

Project

The fourth programming project involves writing a program that accepts information contained in a file about the class dependencies in a Java program and creates a directed graph from that information. From the directed graph, it produces two different kinds of displays of those dependency relationships.

A sample input file is shown below:

ClassA ClassC ClassE ClassJ ClassB ClassD ClassG

ClassC ClassA

ClassE ClassB ClassF ClassH ClassJ ClassB

ClassI ClassC

The first name of each line of the file is a Java class upon which other classes depend. The remaining names are the classes that depend upon the first class on that line. The first line of the above file, for example, indicates that ClassA has three classes that depend upon it, ClassC, ClassE and ClassJ. A class that have does any classes that depend on it, need not appear at the head of any line.
The main method in the class for this project should allow user select the input file from the default directory by using the JFileChooser class. It should then add the edges to a directed graph that defines these class dependencies.
A second class, DirectedGraph, should be a generic class, whose generic parameter specifies the type of the labels that are associated with the vertices of the graph.
It should contain a method that allows edges to be added to the graph, which is how the main method will initially build the graph. It should also contain a method that performs a depth-first search of that graph. The pseudocode for that search is show below:
depth_first_search(vertex s) if s is discovered
perform cycle detected action return
perform add vertex action mark s as discovered perform descend action
for all adjacent vertices v depth_first_search(v)
perform ascend action mark s as finished

When the method in the DirectedGraph class that initiates the depth first search is called, it should first initialize all the vertices to the undiscovered state and begin the search at the vertex that corresponds to the first name in the input file.

Another method in the DirectedGraph class should then allow the main method to display any unreachable classes by examining all the vertices of the graph to see which remain undiscovered.

This project should contain a generic interface named DFSActions, whose generic parameter again specifies the type of the labels that are associated with the vertices of the graph. It should contain four method signatures that correspond to the four actions performed in the depth first search: cycle detected, process vertex, descend and ascend.

There should be two additional classes that both implement the aforementioned interface. The first, Hierarchy, should produce a hierarchical representation of the class dependencies. Circular dependencies should be flagged. For the above input file, the following hierarchical representation should be produced:
ClassA
ClassC * ClassE
ClassB
ClassD ClassG
ClassF ClassH
ClassJ
ClassB
ClassD ClassG
The asterisk after ClassC results from the fact that ClassC depends upon ClassA and ClassA depends upon ClassC. The Hierarchy class should override the toString method, which should return a string that contains the above, after having performed the depth-first search.
The other class that implements the DFSActions interface should be ParenthesizedList. It should produce an alternate representation that is also returned by its toString method. For the above input file, the following hierarchical representation should be produced:
( ClassA ( ClassC * ClassE ( ClassB ( ClassD ClassG ) ClassF ClassH ) ClassJ ( ClassB ( ClassD ClassG ))))
The main method should produce both representations. In addition it should display the unreachable classes by calling the previously mentioned method. For the above input file, the following unreachable class should be identified:
ClassI is unreachable
Code duplication should be avoided. In particular, the depth first code should not be duplicated.

You are to submit two files.

1. The first is a .zip file that contains all the source code for the project. The .zip file should contain only source code and nothing else, which means only the .java files. If you elect to use a package the
.java files should be in a folder whose name is the package name. Every outer class should be in a separate .java file with the same name as the class name. Each file should include a comment block at the top containing your name, the project name, the date, and a short description of the class contained in that file.

2. The second is a Word document (PDF or RTF is also acceptable) that contains the documentation for the project, which should include the following:
a. A UML class diagram that includes all classes you wrote. Do not include predefined classes.
You need only include the class name for each individual class, not the variables or methods
b. A test plan that includes test cases that you have created indicating what aspects of the program each one is testing
c. A short paragraph on lessons learned from the project

Reference no: EM133457159

Questions Cloud

How the mexicas got to the valley of anahuac : Provide a historical account of how the Mexicas got to the Valley of Anahuac,
Assess the needs of the organization and make recommendation : Health information Professionals must have effective problem solving, critical thinking, and interpersonal abilities to successfully assess the needs
Describe the structure of cell membranes : Describe the structure of cell membranes and the movement of molecules across a membrane.
Explain about type 1 and type 2 diabetes : Explain in specfic detail about type 1 and type 2 diabetes, gestational diabetes diagnosis, treatment options, risk factors, signs and symptoms, demogrpahics.
How the main method will initially build the graph : Create a directed graph from that information. From the directed graph, it produces two different kinds of displays of those dependency relationships
What outcome evaluation do you think is appropriate : What outcome evaluation do you think is appropriate to measure the effectiveness of your solution in other to give the community members some level of comfort
Scientific revolution affected modern society : What are some of the ways that the Scientific Revolution affected modern society? If the Enlightenment did not exist, what would be different today?
How would you differentiate an invention from an innovation : How would you differentiate an invention from an innovation as it applies to science and technology? Provide two examples of invention and innovation
What political-economic and social reforms were instituted : What political, economic, and social reforms were instituted by the Qing Dynasty during its final decade,

Reviews

len3457159

6/30/2023 12:55:22 AM

Code duplication should be avoided. In particular, the depth first code should not be duplicated. You are to submit two files. 1. The first is a .zip file that contains all the source code for the project. The .zip file should contain only source code and nothing else, which means only the .java files. If you elect to use a package the .java files should be in a folder whose name is the package name. Every outer class should be in a separate .java file with the same name as the class name. Each file should include a comment block at the top containing your name, the project name, the date, and a short description of the class contained in that file. 2. The second is a Word document (PDF or RTF is also acceptable) that contains the documentation for the project, which should include the following: a. A UML class diagram that includes all classes you wrote. Do not include predefined classes. You need only include the class name for each individual class, not the variables or methods b. A test plan that includes test cases that you have created indicating what aspects of the program each one is testing c. A short paragraph on lessons learned from the project Robert Graham project

Write a Review

JAVA Programming Questions & Answers

  Complete java method called getword

complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception

  Provide a method heading for a public method

Provide a method heading for a public method named setCost that receives a double parameter named cost and returns nothing. You must use good style

  Create a gui to display the structure

Read a data file, create the internal data structure, create a GUI to display the structure, and let the user search the structure. Sort the structure, use hash maps to create the structure more efficiently.

  Use loops in the "equals" method to reduce the fractions

The equals method modification should loop repeatedly until the user decides to quit. Inside the body of the loop, the programshould allow the user to enter a target fraction into an anonymous object and learn whether the fractions are identical.

  Create a class called invoice that a hardware store may use

Create a class called Invoice that a hardware store may use to represent an invoice for an item sold at the store.  The class should have four (4) instance variables: part number : string and part description : string (what is the item)

  Make a row with different string names

How do you make a row with different string names and put a certain amount of space between each one?

  Create an abstract employee class

We are going to create an abstract Employee class and an abstract calculatePay method. The abstract Employee class will prevent a programmer from creating an object based on Employee

  Choose of your favorite proverbs from famous proverbs

The web page shall contain a table with 2x50 cells nicely positioned on the page. Choose 20 of your favorite proverbs from famous proverbs, each as a string literal pre-stored in a JavaScript array. Randomly choose one from the 20 proverbs and hav..

  Write a method called listfilter

Write a method called listFilter() that takes in a list of strings, and returns a list containing only the strings that have an even length

  Create an electronics class that implements item

Create an Electronics class that Implements Item - Implementing TrainCar - TrainCar implements some straightforward methods. Its job is to store references to objects of type Item. Since Item is an interface, this means store objects that implemen..

  Write a method named kineticenergy

Write a method named kineticEnergy that accepts an object's mass (in kilograms) and velocity (in meters per second) as arguments

  What cannot be inherited from base classes

What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd