wiki:PRO_LIB_MODEL_PRO_LISTS_R0
Last modified 14 years ago Last modified on 04/21/09 16:35:35

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=PRO_LIB_MODEL_PRO_LISTS_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

The current search capabilities of ProLists are not sufficient - it's very slow for large collections. So we need a way to optimize this search.

Task requirements

  • Provide a way to optimize search in ProList
  • This should not break the current use of ProLib
  • It will be good if these new search capabilities can be used with the current use of ProList and there will be no need for refactor

Task result

The result should be code and documentation

Implementation idea

Use a map for categorizing the elements of the list by keys. This way required values (that are searched) will be returned by Map#get(key)

PRO_LIB_CORE_TUTORIAL

How to demo

Show some code, documentation and introduce the new functionality to the others

Design

In order to get better performance without making huge refactoring (introduce new type, replace using old types with the new one etc.) two methods will be added to the ProList interface. Their implementation will be in BaseProList and this will keep other classes and their use with no change.

A new field will be added to BaseProList - a Map instance where will be stored the elements from the list under some key. This doesn't remove the need from the list itself. Nothing of this will remove some existing code. Only new code will be added.

A new class will be added - ListEntry. It will have two field - key : Obejct and value : Object. This class will serve as a helper class for work with the Map.

In the add/remove method of ProList will be added new functionality that will add the parameter to the map with the following rules:

  • If the parameter is ListEntry - the key in the map is the key of ListEntry
  • if the parameter is Immutable - the key in the map is the Immutable object
  • if the parameter is Mutable - the added in the map is null

The two new methods are :

  • findAll (key : Object) : List<E> - this method will return all the entries in the list with the specified key
  • findOne (key : Object) : E - this method will return only one entry from the list for the key. More - if there are more than one entry an exception will be thrown

Implementation

The task is implemented according to the design

Changesets: [2163]

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)