Java Command Line Compiler Program Write a program that behaves like the Java command line compiler. Whenever we request that the Java compiler recompile a

Java Command Line Compiler Program Write 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. CMSC 350 Project 4
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:
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
ClassB
ClassE
ClassI
ClassC ClassE
ClassD ClassG
ClassB ClassF ClassH
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.
1
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:
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:
2
0
1
2
3
4
5
6
7
8
[[1, 2]
[]
[3, 6, 7]
[4, 5]
[]
[]
[]
[]
[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
Grading Rubric:
Criteria
Meets
Does Not Meet
Design
5 points
GUI is hand coded and matches required
design (1)
Includes a generic class for a directed
graph (2)
0 points
GUI is generated by a GUI generator or
does not match required design (0)
Does not include a generic class for a
directed graph (0)
3
Graph is represented as an array list of
vertices that contain a linked list of their
associated adjacency lists (1)
Graph is not represented as an array
list of vertices that contain a linked list
of their associated adjacency lists (0)
Includes checked exception classes for
cycles and invalid class names (1)
Functionality
Test Cases
Documentation
Overall Score
Does not Include checked exception
classes for cycles and invalid class
names (0)
10 points
0 points
Produces correct topological order for all Does not produce correct topological
cases without cycles (3)
order for all cases without cycles (0)
Produces error message for all cases
Does not produce error message for all
with cycles (3)
cases with cycles (0)
Reports error message when file does
Does not report error message when
not open (2)
file does not open (0)
Reports error message when invalid
Does not report error message when
class name is entered (1)
invalid class name is entered (0)
Generates message confirming graph
Does not generate message confirming
has been built (1)
graph has been built (0)
5 points
0 points
Test cases include a graph without cycles Test cases do not include a graph
(2)
without cycles (0)
Test cases include a graph with cycles (1) Test cases does not include a graph
with cycles (0)
Test cases include an invalid file name
Test cases do not include an invalid file
(1)
name (0)
Test cases include an invalid class name
Test cases do not include an invalid
(1)
class name (0)
5 points
0 points
Correct UML diagram included (2)
Correct UML diagram not included (0)
Lessons learned included (2)
Lessons learned not included (0)
Comment blocks with class description
Comment blocks with class description
included with each class (1)
not included with each class (0)
Meets
16 or more
Does not meet
0-15
4

Purchase answer to see full
attachment

Don't use plagiarized sources. Get Your Custom Essay on
Java Command Line Compiler Program Write a program that behaves like the Java command line compiler. Whenever we request that the Java compiler recompile a
Just from $13/Page
Order Essay
Homework On Time
Calculate the Price of your PAPER Now
Pages (550 words)
Approximate price: -

Why Choose Us

Top quality papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional academic writers

We have hired a team of professional writers experienced in academic and business writing. Most of them are native speakers and PhD holders able to take care of any assignment you need help with.

Free revisions

If you feel that we missed something, send the order for a free revision. You will have 10 days to send the order for revision after you receive the final paper. You can either do it on your own after signing in to your personal account or by contacting our support.

On-time delivery

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & confidential

We use several checkers to make sure that all papers you receive are plagiarism-free. Our editors carefully go through all in-text citations. We also promise full confidentiality in all our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

You are welcome to choose your academic level and the type of your paper. Our academic experts will gladly help you with essays, case studies, research papers and other assignments.

Admissions

Admission help & business writing

You can be positive that we will be here 24/7 to help you get accepted to the Master’s program at the TOP-universities or help you get a well-paid position.

Reviews

Editing your paper

Our academic writers and editors will help you submit a well-structured and organized paper just on time. We will ensure that your final paper is of the highest quality and absolutely free of mistakes.

Reviews

Revising your paper

Our academic writers and editors will help you with unlimited number of revisions in case you need any customization of your academic papers