implement 'topification': adding an abstract 'Top'-class to a class diagram, and making all classes inherit from it
This commit is contained in:
parent
daa50d8c82
commit
ffc07fd83c
8 changed files with 86 additions and 0 deletions
5
transformation/topify/rules/r_create_inheritance_lhs.od
Normal file
5
transformation/topify/rules/r_create_inheritance_lhs.od
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
some_class:RAM_Class
|
||||
|
||||
top:RAM_Class {
|
||||
condition = `get_name(this) == "Top"`;
|
||||
}
|
||||
7
transformation/topify/rules/r_create_inheritance_nac.od
Normal file
7
transformation/topify/rules/r_create_inheritance_nac.od
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# If our class already inherits from another class, then DON'T create an inheritance link
|
||||
|
||||
some_class:RAM_Class
|
||||
|
||||
any_other_class:RAM_Class
|
||||
|
||||
:RAM_Inheritance(some_class -> any_other_class)
|
||||
9
transformation/topify/rules/r_create_inheritance_nac2.od
Normal file
9
transformation/topify/rules/r_create_inheritance_nac2.od
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Only create inheritance link once:
|
||||
|
||||
some_class:RAM_Class
|
||||
|
||||
top:RAM_Class {
|
||||
condition = `get_name(this) == "Top"`;
|
||||
}
|
||||
|
||||
:RAM_Inheritance (some_class -> top)
|
||||
9
transformation/topify/rules/r_create_inheritance_rhs.od
Normal file
9
transformation/topify/rules/r_create_inheritance_rhs.od
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
some_class:RAM_Class
|
||||
|
||||
top:RAM_Class {
|
||||
condition = `get_name(this) == "Top"`;
|
||||
}
|
||||
|
||||
# Create inheritance link
|
||||
|
||||
:RAM_Inheritance (some_class -> top)
|
||||
1
transformation/topify/rules/r_create_top_lhs.od
Normal file
1
transformation/topify/rules/r_create_top_lhs.od
Normal file
|
|
@ -0,0 +1 @@
|
|||
# empty
|
||||
5
transformation/topify/rules/r_create_top_nac.od
Normal file
5
transformation/topify/rules/r_create_top_nac.od
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Top-class should not yet already exist:
|
||||
|
||||
top:RAM_Class {
|
||||
condition = `get_name(this) == "Top"`;
|
||||
}
|
||||
8
transformation/topify/rules/r_create_top_rhs.od
Normal file
8
transformation/topify/rules/r_create_top_rhs.od
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# We create the 'Top'-class with a GlobalCondition, because that's the only way we can control the name of the object to be created.
|
||||
|
||||
:GlobalCondition {
|
||||
condition = ```
|
||||
top = create_object("Top", "Class")
|
||||
set_slot_value(top, "abstract", True)
|
||||
```;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue