|
|
| Line 45: |
Line 45: |
| |} | | |} |
| This system is defined by: | | This system is defined by: |
| *<math>S = \left\{ A, B, D \right\} </math>
| | <math>S=\left\{ A, B, D\right\}</math> |
| *<math>
| | |
| C = \left\{ 1 \mapsto A, 2 \mapsto B, 3 \mapsto D \right\} | | <math>\tau = |
| | \left\{ |
| | A \mapsto \left\{ f1 \mapsto \underline{A.f1}, g1 \mapsto \underline{A.g1} \right\}, |
| | B \mapsto \left\{ f2 \mapsto \underline{B.f2}, g2 \mapsto \underline{B.g2} \right\}, |
| | D \mapsto \left\{ f1 \mapsto \underline{D.f1}, g1 \mapsto \underline{D.g1} \right\} |
| | \right\} |
| </math> | | </math> |
| *<math>S_1 = \left\{ A\right\}, S_2 = \left\{ A, B\right\}, S_3 = \left\{ A, B, D \right\}</math>
| | |
| *<math>\tau =
| | <math>\alpha = \left\{ |
| \left\{ | | A \mapsto \emptyset, |
| A \mapsto \left\{ f_1 \mapsto \underline{A.f_1}, g_1 \mapsto \underline{A.g_1} \right\}, | | B \mapsto \left\{ A \right\}, |
| B \mapsto \left\{ f_2 \mapsto \underline{B.f_2}, g_2 \mapsto \underline{B.g_2} \right\}, | | D \mapsto \left\{ A, B \right\} |
| D \mapsto \left\{ f_1 \mapsto \underline{D.f_1}, g_1 \mapsto \underline{D.g_1} \right\} | |
| \right\} | | \right\} |
| </math> | | </math> |
| *<math>\eta =
| | |
| | <math>\eta = |
| \left\{ | | \left\{ |
| | A \mapsto \emptyset, |
| B \mapsto \left\{ | | B \mapsto \left\{ |
| A \mapsto \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} | | A \mapsto \left\{ f_1 \mapsto f_2, g_1 \mapsto g_2 \right\} |
| | \right\}, |
| | D \mapsto \left\{ |
| | A \mapsto \emptyset, B \mapsto \emptyset |
| \right\} | | \right\} |
| \right\} | | \right\} |
| </math> | | </math> |
| *<math>\alpha = \left\{
| | |
| C_2 \mapsto \left\{ C_1 \right\}, | | <math>\sigma = \left\{ |
| C_3 \mapsto \left\{ C_2, C_1 \right\} | | A \mapsto \emptyset, |
| | B \mapsto \left\{ A \mapsto \emptyset \right\}, |
| | D \mapsto \left\{ A \mapsto \left\{ g_1 \right\}, |
| | B \mapsto \left\{ f_2 \right\} \right\} |
| \right\} | | \right\} |
| </math> | | </math> |
| *<math>\sigma = \left\{
| | |
| C_3 \mapsto \left\{ C_2 \mapsto \left\{ f_2 \right\}, C_1 \mapsto \left\{ g_1 \right\} \right\}
| | <math> |
| \right\} | | C = \left\{ 1 \mapsto A, 2 \mapsto B, 3 \mapsto D \right\} |
| </math> | | </math> |
|
| |
|
Author: Matthias Konrad
The system
In this example we are studying a simple system with three classes that contains both renaming and selects:
class
A
feature
f1 do ... end
g1 do ... end
end
|
class
B
inherit
A
rename f1 as f2, g1 as g2
redefine f2, g2 end
feature
f2 do ... end
g2 do ... end
end
|
class
D
inherit
A
redefine f1, g1
select g1 end
B
select f2 end
feature
f1 do ... end
g1 do ... end
end
|
This system is defined by:
The naming function
We proceed by calculating the naming function. According to its definition we have to do that incrementally. Meaning that we first calculate then and finally .
Calculating
Since contains only one class it is sufficient to define . According to the definition:
We can forget about the right part of the union since has no base classes. So we need to calculate:
-
So we get:
And hence:
Calculating
We show the calculation of the different (four) parts of the function in separate sections:
Calculate
According to the definition:
Calculate
According to the definition:
Calculate
According to the definition:
Lets calculate the left part first:
And now the right part:
So we get:
Calculate
According to the definition:
Where:
And:
Here are the steps taken to compute the part:
-
-
So we get:
Putting the parts together:
We can know show the complete total function:
|
|
|
|
|
|
|
|
|
|
|
|
Calculating
We will not show the complete construction of but restrict our self to the most interesting parts.
Calculate
According to the definition:
Where:
And:
Note that we can omit from the formulas since it is always empty.
-
-
So we get:
The complete naming function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The dynamic binding function
To calculate the dynamic binding function, we need to get . We will again calculate it incrementally:
Calculating
According to the definition:
Since is empty this simplifies to:
So we get:
Calculating
Again we calculate the different parts of the function in separate sections:
Calculate
According to the definition:
Calculate
According to the definition:
Calculate
According to the definition:
-
So we get:
Calculate
According to the definition:
At this stage it should be clear how to calculate this, so we just give the result:
Putting the parts together:
We can know show the complete total function:
|
|
|
|
|
|
|
|
|
|
|
|
Calculating
There is nothing new for this calculation so we just present the result:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Deriving the dynamic binding function
The function is now given. We evaluate it at two interesting points: