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
degree()
method.
What code would do the job?
What more specific type of map would make the implementation simpler?