Assignment 10, due Nov. 13

Part of the homework for CS:2820, Fall 2015
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: The logic simulator of MP3 and MP4 uses lambda expressions to schedule new events. There is an alternative approach to this problem that was discussed in Lecture 21 on Nov. 10.

    In short, we arrange the class hierarchy so that class Simulator.Event is a public abstract class. Any class that needs to be scheduled must be an extension of Simulator.Event. Instead of having actions that can be triggered as a component of an event, we make the trigger() method an abstract method of Simulator.Event.

    Consider modifying the logic simulator distributed as a solution to MP3 so that it uses this simulatin framework: In that simulator, there were 4 calls to Simulator.schedule().

    a) Write the code for Wire.inputChange() and any associated local classes using the new framework. In this part, input change events should call Wire.outputChange(). That is, you should not optimize. (1 point)

    b) Write the code for Wire.inputChange() etc using the new framework, optimizing as much as possible to eliminate calls to other methods of class Wire. (1 point)

    c) Looking at the code for class Output, how many new classes would you have to introduce in order to rewrite your code for this new framework? (1 point)