Enterprise Systems Integration
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP3760/6760: Enterprise Systems Integration
DSC 30 Final Project
General Requirements
1
. Office hours through Autograder and Zoom: You are only allowed to submit at most 2
tickets for debugging questions on the final project (autograder errors will not count).
We will count your opportunity as used if you asked any questions about the final
project in a session.
2
. Piazza: You can submit unlimited amounts of clarification questions in public posts
only. Private posts about the final project will not be answered. You are not allowed to
post your final project code in a piazza post unless being told to do so by an instructor.
Since all clarification questions are public posts, you are encouraged to search your
potential questions first before you make a new post.
3
. Others: You are not allowed to request help on the final project through other
approaches, including sending email to the instructors, or reaching the instructors
through social networks.
Note that these policies will only apply to the final project related questions. If you need help
from us for other reasons, feel free to contact us in the usual approach you prefer.
START EARLY!
●
Choose names for test methods and for variables that are descriptive and useful when
you see them in the test output.
●
●
Consider writing helper methods if you repeatedly use the same set of statements.
Use Javadoc comments for descriptions of your methods and classes and inline
comments if the logic of your program is not captured by your variable names and the
natural flow of code.
Testing Requirements
For the final project, you are not required to submit any test cases, including JUnit test files
and main methods. However, we strongly recommend you to test your code thoroughly.
Think about the butterfly effect: a small mistake in one method will lead to a major failure of
the project.
Please follow the same procedures as before to get your starter code and set up IntelliJ.
Part 1: Project Overview
In this project, you will implement a hybrid data structure (called FADAF, Part 4) that stores
key-data pairs with support of duplicate keys.
The goal of creating this new data structure is to achieve optimal time complexity for every
operation it supports by sacrificing space complexity. To achieve this goal, we will use a
combination of data structures we learned from this class as the backed structures. This new
data structure will be primarily backed by (thus you must use) a hash table (Chaining, Part 2),
and a binary search tree that supports duplicates (DAFTree, Part 3). If you want to use other
data structures for optimization, feel free to use the built-in ones (import from java.util.*
package), but you must implement Part 2 and 3, and use these two structures to implement
Part 4. This is an open-ended project, meaning that there are multiple valid implementations
for many methods. You should enhance the time complexity of all methods as best as you
can.
Note that the backed data structures in Part 2 and Part 3 are considered as helper classes.
Therefore, you will find that many methods will give access to the raw implementation details
(
such as tree nodes) publicly. With the same reasoning, you are allowed to add helper
methods with ANY access modifier (not confined to private anymore) in these two data
structures. However, the hybrid data structure in Part 4 will still NOT allow any public
exposure of implementation details, just like the usual data structures you have implemented
before.
You may reuse the codes from your previous PAs, readings, lectures, and exams to
save you some time. Make sure you have done the necessary modifications to fit
these codes in this assignment.
Part 2: Hash Table (Chaining)
Introduction
In this section, you will implement a hash table that applies the chaining
to resolve collisions. You may refer to the course materials for the specific algorithms of
chaining. For this implementation, we will use the LinkedList API from Java.util to express the
chain, and an array of LinkedList to express the table.
Another key difference between this hash table and the hash table in PA 8 is that our hash
table now supports Generics (<T>). The hashCode()
method is declared in the Java.lang.Object (parent class of ALL class by default), and
implemented in all common concrete classes (such as Integer, String, etc.). This method
returns the hash value of the given object that Java’s built-in hash tables can use. If you want
to use Java’s built-in hash tables for your self-defined classes or the instructed hash table
described below, these classes must overwrite the hashCode() method. You may read the
method descriptions below for how you should apply this method to this implementation.
Debugging Tip: Create a HashTable that stores Integer to test, since the hashCode of an
integer is just the integer itself which is easy to keep track of.
Implementation
All implementations of this part should be done in HashTable.java, and you must
complete all the following constructor and methods.
public HashTable(int capacity)
A constructor that initializes a hash table with specified capacity.
@
throws IllegalArgumentException if capacityis less than the minimum threshold (10)
public boolean insert(T value)
A method that inserts the value in the hash table. This method returns true if the value
is inserted, and false if the value is already present in the hash table. Before insertion,
this method checks if the load factor is greater than ⅔, and invokes rehash() if the
condition satisfies.
@
throws NullPointerException if the value is null
public boolean delete(T value)
A method that deletes the value from the hash table. This method returns true if the
value was in the hash table before deletion, and false if the value was not found.
@
throws NullPointerException if the value is null
public boolean lookup(T value)
A method that checks if the value is stored in the hash table. This method returns true
if the value is in the hash table, and false otherwise.
@
throws NullPointerException if the value is null
public int size()
A method that returns the total number of elements stored in the hash table.
public int capacity()
A method that returns the total capacity of the hash table.
private int hashValue(T value)
A method that calculates the hash value (expected index) of the value in the hash
table. This method calls the hashCode() of the value and mod by the capacity of the
hash table.
private void rehash()
A method that performs rehash when the condition is met. This method doubles the
capacity of the original table, and re-insert all values (not the chained list) present in
the old table by iterating through the old table.
You can add more helper methods with ANY access modifiers if you think they are
necessary for your implementation.
In this section, you will
implement a modified version of the Binary Search Tree that supports storing duplicates. This
tree is called Duplicates-Are-Fine tree, and you should have already seen it in the second
midterm. You may refer to the second midterm and other course materials for specific
definitions and examples of DAF trees.
Note that compared with the declarations in the midterm 2, we have added a par reference in
DAFNode that points to the parent node. This reference might be helpful to optimize certain
operations. In addition, since we consider this tree as a helper class for our hybrid structure,
you will find many methods are returning the node directly. This is intended and might be
useful for your Part 4 implementation.
A key feature of this tree is that it supports two generic parameters (<K extends
Comparable<? super K>, D>). Parameter K is used to denote the type of key, and the type K
must be Comparable so that you can use compareTo() for comparison. Parameter D is used
to denote the type of data, and you can use any concrete class to fit in this type. The
declaration of DAFTree with concrete classes will look like DAFTree<String, Integer>.
Since the DAF tree is a normal BST with dup sequences, you should be able to finish the
majority of implementations by modifying your BST implementation. However, you should
always keep the dup sequences in mind when modifying your old code, and sometimes
accommodating the dup sequences will be trickier than you would expect. We will have more
explanations of methods in the implementation section.