Lab
9
Get started now
ADD IPAddress DomainName DEL IPAddress DomainNameIf the command is not ADD or DEL, the domain name is invalid, or the IPAddress is invalid, the `update()` method must throw an `IllegalArgumentException`. For the `ADD` command, if the domain name exists, the IP address is updated and the previous IP address is returned. If no entry for the domain name was found, it is added and `null` is returned. For the `DEL` command, if the domain name/IPAddress mapping is found, the entry is removed and the IP address is returned. If the domain name does not exist, the command is ignored and the method returns `null`. If the domain name exists but the IPAddress does not match, a `InputMismatchException` must be thrown. Here is a sample update.txt file:
ADD 178.56.67.89 google.com ADD 178.56.67.112 google.com DEL 104.40.211.35 microsoft.comTo manually change an entry, enter the name of the domain and the corresponding IP address in the dialog box and click the Add or Delete button to add, update, or delete the entry. #### The Simulator Our DNS will be driven by a simple GUI simulator. The main program should present a simple GUI as shown above. When it starts, it should perform the creation of a new DNS server object, but not actually start it. When the Start button is clicked, it starts the service as described above. If Stop is clicked, the service is stopped if the service was running and the dialog waits for another start. If Update is clicked, the update (from update.txt) is performed as described above if and only if the service is running. If the service is running and Start is clicked, the action is ignored. If Exit is clicked, the simulation ends (the entire program stops running). ## Undo/Redo (potentially optional) Based on your knowledge of stacks and queues, you may wish to add Undo and/or Redo buttons. These would allow the user to undo/redo Add and Delete commands (generated by the Add and Delete buttons, not the update file). Ideally, the buttons would only be enabled when there is a command to be undone or redone. Check with your instructor to see if this functionality is required or optional. ## Benchmarking (potentially optional) You may wish to benchmark the performance when using a `TreeMap` and compare it to the performance when using a `HashMap`. You may need to make use of a larger dnsentries.txt file in order to see significant differences. Check with your instructor to see if this functionality is required or optional. ## Lab Deliverables > See your professor's instructions for details on submission guidelines and due dates. > * Dr. Taylor's students: See below > * All other students should refer to Blackboard > >If you have any questions, consult your instructor. ## Acknowledgements This assignment was written by Prof. Jon Hopkins and [Dr. Chris Taylor](/taylor/).