Creating operations to be implemented

 

Introduction

Here we will be working with the "PatternsToImplement" package, which will allow us to automatically create the operations that a class must redefine according to its implementation links.

 

The "PatternsToImplement" package contains:

·         an "Appliance" class interface containing the "switchOn" and "switchOff" operations

·         a "Screen" class interface specializing "Appliance" and containing the "displayTest", "getCurser" and "setCurser" operations

·         a "GraphicTool" class interface containing the "drawRectangle" and "drawCircle" operations

·         a "MyGraphicDisplay" class which implements the "Screen" and "GraphicTool" interfaces

 

We are going to run the pattern on the "MyGraphicDisplay" class.

 

 

Initial model

 

Figure 56. The initial model

 

 

Calling the pattern

 

Figure 57. Calling the pattern

 

 

Final model

 

Figure 58. The model after transformation

 

 

Summary of the modifications made to the model

The "MyGraphicTool" class has been enriched with the following operations:

·         "displayTest" which redefines the operation of the same name of the "Screen" class

·         "getCursor" which redefines the operation of the same name of the "Screen" class

·         "setCursor" which redefines the operation of the same name of the "Screen" class

·         "switchOn" which redefines the operation of the same name of the "Appliance" class

·         "switchOff" which redefines the operation of the same name of the "Appliance" class

·         "drawRectangle" which redefines the operation of the same name of the GraphicTool" class

·         "drawCircle" which redefines the operation of the same name of the "GraphicTool" class