Skip to Main Content
Data collection libraries play an important role in component-based software development. The collections contained in those libraries (JCF, STL, LEDA, etc.) implement a mathematical model that defines one or more access methods to the elements (access by key, access to the element stored last, etc.). In addition, most of these libraries allow a different, more efficient type of access, which can be direct access (e.g., by means of the position where the element is stored, that is obtained when it is inserted) or sequential access (usually by means of the iterator concept). This type of efficient access presents several risks with respect to criteria such as precision and suitability that are not solved appropriately in the current existing libraries. In this work, we present two design patterns that provide a generic solution to the problem together with their implementation using aspects. The patterns introduce new data types and new operations that provide the libraries with full uniformity and a high extensibility degree. The use ofaspects allows dissociating these types of access and the functionality of the collection, making aspects responsible of the position persistence management, modification monitoring during iterations, etc. The proposal is implemented using AspectJ.