SWE 619 Assignment 4
Spring 2013
Goal:
Rep-Invariants.
Reimplement Liskov's IntSet
example, with the following changes:
-
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
.
-
The integers stored in
otherEls
should be kept sorted
in increasing size.
-
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?
-
Implement the abstraction function (as
toString()
)
and the representation invariant (as repOk()
).
-
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.