Relationship in a uml class diagram of a java program

Assignment Help JAVA Programming
Reference no: EM131596445

Project

The fourth programming project involves writing a program that behaves like the Java command line compiler. Whenever we request that the Java compiler recompile a particular class, it not only recompiles that class but every other class that depends upon it, directly or indirectly, and in a particular order. To make the determination about which classes need recompilation, the Java compiler maintains a directed graph of class dependencies. Any relationship in a UML class diagram of a Java program such as inheritance relationships, composition relationships and aggregations relationships indicate a class dependency.

The main class for this project should create the GUI shown below:

762_Figure.jpg

The GUI must be generated by code that you write. You may not use a drag-and-drop GUI generator.

Pressing the Build Directed Graph button should cause the specified input file that contains the class dependency information to be read in and the directed graph represented by those dependencies to be built. The input file associated with the above example is shown below:
ClassA ClassC ClassE ClassB ClassD ClassG
ClassE ClassB ClassF ClassH ClassI ClassC

Each line of this file specifies classes that have other classes that depend upon them. The first line, for example, indicates that ClassA has two classes that depend upon it, ClassC and ClassE. In the context of recompilation, it means when ClassA is recompiled, ClassC and ClassE must be recompiled as well. Using graph terminology, the first name on each line is the name of a vertex and the remaining are its associated adjacency list. Classes that have no dependent classes need not appear at the beginning of a separate line. Notice, for example, that ClassC is not the first name on any line of the file.

After pressing the Build Directed Graph button, one of following two messages should be generated depending upon whether the specified file name could be opened:

1335_Figure1.jpg

Once the graph has been built, the name of a class to be recompiled can be specified and the Topological Order button can be pressed. Provided a valid class name has been supplied, the list of classes that need to be recompiled should be listed in the order they are to be recompiled in the text area at the bottom of the window. An invalid class name should generate an appropriate error message.

The correct recompilation order is any topological order of the subgraph that emanates from the specified vertex. Topological orders are not unique, but the one that is to be used for this program is the one generated using a depth-first search of the graph. The algorithm for generating this topological order is shown below:
depth_first_search(vertex s) if s is discovered
throw cycle detected exception if s is finished
return
mark s as discovered
for all adjacent vertices v depth_first_search(v)
mark s as finished push s onto the stack

This algorithm generates a reverse topological order so after it completes, the forward topological order can be ascertained by popping the vertices off the stack. Note that an exception is to be thrown if the graph contains a cycle. When circular dependencies exist in Java programs, the compiler must make two passes over all the classes in the cycle, first compiling the specifications and subsequently the remaining code. For this program, it will be sufficient to display a message indicating that a cycle has been detected.

In addition to the main class that defines the GUI, a second class is needed to define the directed graph. It should be a generic class allowing for a generic type for the vertex names. In this application those names will be strings. The graph should be represented as an array list of vertices that contain a linked list of their associated adjacency lists. The adjacency lists should be

lists of integers that represent the index rather than vertex name itself. A hash map should be used to associate vertex names with their index in the list of vertices:

For the input file shown above the array list of linked lists of integers would be the following:

0 [[1, 2]
1 []
2 [3, 6, 7]
3 [4, 5]
4 []
5 []
6 []
7 []
8 [1]

Storing the vertex indices rather than the names simplifies the depth-first search. The hash map would associate index 0 with ClassA, index 1 with ClassC and so on.

The directed graph class needs three public methods, one to initialize the graph each time a new file is read in, one to and an edge to the graph and one to generate a topological order given a starting index.

Finally checked exception classes should be defined for the cases where a cycle occurs and when an invalid class name is specified.

You are to submit two files.

1. The first is a .zip file that contains all the source code for the project, which includes any code that was provided. 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.

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: EM131596445

Questions Cloud

Explain why this combination would be impossible : If "free" land means land that is in excess supply-and therefore has a zero price-and "free" labour means labour that is free of bondage.
Increase in the aggregate demand curve : Discuss the difference between an increase in the aggregate demand curve and an increase in the quantity of real GDP demanded.
The social worker and client would feel would be one relief : Two positive feelings that I as the social worker and client would feel would be one relief that everything in the case was accomplished.
Develop a comprehensive global human resource strategy : Develop a comprehensive global human resource strategy for your company. Investigate what the firm is essentially doing and/or focus on what it should be doing.
Relationship in a uml class diagram of a java program : CMSC 350 Project 4 - Any relationship in a UML class diagram of a Java program such as inheritance relationships, composition relationships
National crime prevention council : The National Crime Prevention Council believes crime prevention requires efforts not only geared towards decreasing the threat of criminal activity
What are the funding sources for the fusion center : The 9/11 Commission Report concluded that the failure of the intelligence community (IC) to share information between agencies and levels of government.
Forecast of supply and demand for long-term care : What does the forecast of supply and demand for the long-term care industry look like for the next 25 years and how should that impact decision making?
Long-term care unique compared to a hospital : What are the factors that make long-term care unique compared to a hospital? List at least 4-6 factors.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create the metric distance program

Create the Metric Distance (MD) Program. What is a "metric distance". Given a set of metrics, m1, m2, m3... mn, for a set of modules (records).

  Code 2-dimensional array that stores the average scores

Instructions: Code a 2-dimensional (2D) array that stores the average scores for 2 football teams across 2 years. In a method called setAvgScores, prompt for the averages and store them in the 2D array which will be returned

  Simulate a scenario with two server windows

Simulate a scenario with two server windows and two queues. When a group of customers arrive each individual in the group will choose the same queue.

  Difference for class linked bag and test into main program

write a method difference for the class linked bag and test into main program.

  Define a class constant for the maximum number

Your program is required to exactly reproduce the format and behavior of the log of execution at the end of this write-up - practice with while loops

  Convert a binarystring into a decimal number

Write the bin2Dec(String binaryString)method to convert a binarystring into a decimal number - Implement to throw a NumberFormatException

  How would you categorize this kind of script what resources

write a 200- to 300-word short-answer response to the following bull how would you classify this type of script? bull

  Write a postfixcalculator class

Write a PostfixCalculator class - create multiple implementations of the operator interface in order to do this - You should have two private member variables

  Supply constructor that makes polynomial from a single term

Supply methods to add, multiply, and print polynomials - Need help with the assignment

  Create a taxreturn class with fields

Create a TaxReturn class with fields that hold a taxpayer's Social Security number, last name, first name, middle initial, zip code, annual income

  Write the constructor date which has 3 parameters

The Date.java class. Implement a public class Date that represents a date composed of a month , day, and a year. Declare month, day, and year as integers. Date has a constructor with 3 parameters and 4 methods. Write the constructor Date which has..

  Complete bst implementation

Complete BST implementation: - Write methods for ImOrder, PreOrder and PostOrder Traversals - Write min() method - Write Successor () method - Extra Credit Implement Binary Heapusmg An&Y Node implementation

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