
130 A Practical Guide to Data Structures and Algorithms Using Java
11.3.3 Representation Accessors
While a[i] = u
i
for the Array class, data structures that extend Array do not always have u
i
= a[i].
For example, a circular array has an instance variable, start such that a[start] = u
0
. Thus, the
abstraction function is different for the CircularArray. We introduce representation accessors getPo-
sition and getIndex to translate between the user position and underlying index. We also introduce
representation accessors, nextIndex and prevIndex to use to move forward or backwards within the
underlying array. When the abstraction function changes, we must ...