Programming Assignment
4: Binary Search Trees and More Simulation due Friday November 14 at 3:00PM
Extra Credit Opportunity: Create a test input file for programming assignment 4. Submit that input file, along with a file contining the output from your program, to Dr. Howe via e-mail by Noon on Wednesday, November 12. Be sure to specify how many timesteps to run the simulation for in your e-mail. Dr. Howe will run the canonical version of the assignment on your input and verify your program's output. If your submitted output is correct, and it's a test case that has not been previously submitted, you will receive five extra credit points on this assignment. Passing test cases will be posted here, along with the correct output.
Test cases are now posted. There are five event files. Each was run for two different values of maxTime. A brief description of each test case, as well as the values of maxTime, can be found in testCases.txt in the tar file.
- What should the behavior be when sending a packet whose destination IP is not in the Router's routing table?
- Set the next hop to null and return the packet as normal.
- What is the assignment name for checkin?
- PROGRAM4
- How should I handle time in the simulator? Do I use "time" from JAVA? Should it stop at the time of the last event in the eventfile?
- The simulator keeps its own time, starting from 0 and continuing until the termination criteria are met. Do not use "time" as our timestamps are simplistic. The termination criteria are: that either the current time is greater than the maxTime or that (nothing is left in the event file and no packets are on any of the internal structures of the routers). So in the second case, maxTime is large enough that the simulation runs out of tasks long before it would get to maxTime and so stops when all the packets have been taken off the routers.
- How should I order the checking of the routers for packets?
- The assignment says to order them by IP address. Practically, in this case, that is produced with an inorder traversal of your binary search tree of routers.
- How should Routers be ordered when checking them?
- You should use an inorder traversal over the binary search tree of Routers to define the order of checking. Here's a subtle point though... IPAddress components should be treated as Strings in the compareTo. In the compareTo for IPAddress, each part in IPV4, for example, is what is between the "."; compare each part separately and as soon as one doesn't match, return the value of the compareTo on that part in each IPAddress. So for example, "2.3.4.5" is actually greater than "100.3.4.5".
- Can an IPv4 address has a field with a value of > 255?
- Ick... the specs are somewhat ambiguous on this. No, if it comes from a packet; not specified, if it comes from the event file. So... we will *not* include a test case that has a field greater than 255. Hence, you have less to worry about from Dan Newman's test case.
- Why does the test case for maxTime=3 have long exception messages?
- because I downloaded the wrong output. Revised one is available via the assignment description.
Test cases