SWE/CS 332 In Class Exercise # 10


Name(s):

Consider an alternative to Liskov's Poly implementation: MapPoly.java. The overview is the same, of course, but the rep is different, and hence, the abstraction function and rep-invariant must also be different. Enumerate a representative set of (abstract state, rep-state) pairs, and use those to derive both functions. How does the code have to change if the rep is simply a Map instead of a TreeMap?
    // Overview:  Polys are immutable polynomials c0 + c1x + c2x^2 + ...
    TreeMap<Integer, Integer> trms;