SWE 619 Assignment 4
Spring 2013


Goal: Rep-Invariants.

Reimplement Liskov's IntSet example, with the following changes:

  1. Change the representation to be the one suggested by Liskov on pages 102 and 103. That is, use three instance variables, els, otherEls, and sz.

  2. The integers stored in otherEls should be kept sorted in increasing size.

  3. Give the representation invariant for this implementation by adding additional constraint(s) to the rep-invariant shown on pages 103 and 104. Does the abstraction function need to be changed?

  4. Implement the abstraction function (as toString()) and the representation invariant (as repOk()).

  5. Once your code is complete, add some fault (intentionally, if necessary) that results in a violation of the rep-invariant. Demonstrate this with a call to repOk(). To help out the GTA, you should document your fault with an easily identifiable comment in your code.

Provide a decent set of JUnit tests.