|
Annex B: Design PatternsB2.AdapterDescriptionThis pattern is useful when we wish to use an existing class but the interface suggested is not satisfactory; the pattern then proposes to define, by multiple inheritance, a class carrying out the necessary actions of adaptation. Structure and Components
Structure and Components of the Adapter design pattern
Collaborations
Strengths and Weaknessesallows the re-use of an existing class of objects in another context, it is not always possible to carry out actions of adaptation to implement this pattern. Use in CBR*ToolsThis pattern is used to connect two phases of reasoning: the first provides a type of results which do not conform with the expected ones from the second. This pattern is also used in the same manner to connect indices. However, in CBR*Tools, the application of this pattern is facilitated by the definition of hierarchy of interface classes (i.e. not defining any code). The adaptation thus avoids the call to existing code (which is not always adaptable) and arises in a symmetrical way between the interface of origin and the one that is desired. This type of adapter is known as bidirectional. Brigitte Trousse Last modified: Wed Oct 3 16:04:10 MEST 2001 |