SWE 619 In Class Exercise Number 3A


Consider Liskov's immutable Poly example, where an abstract Poly is defined as c0 + c1x + c2x^2 + ..., and is implemented with one variable:

   private Map<Integer, Integer> map;
Fill in example values that are mapped by the abstraction function. (Code available here: Poly)
Abstract State: Poly



 AF
/|\
 |
 |
 |
 |----------------------------------------------------------
 |
 |
 |
 |



Representation State: map
  1. Identify representation states that should not be mapped.
  2. Try to capture these states with a rule (that is, a rep-invariant).
  3. Consider implementing the degree() method. What code would do the job? What more specific type of map would make the implementation simpler?