Skip to content

Commit def88e4

Browse files
committed
KERML_-57/SYSML2_-510 Updated reflective model generation per resolution
- Also updated for proper KerML and SysML keywords. - Results in no actual change to SysML.sysml over updates already done for ST6RI-827.
1 parent e4ab324 commit def88e4

3 files changed

Lines changed: 241 additions & 240 deletions

File tree

org.omg.sysml/src/org/omg/sysml/generation/MOF2KerMLText.xtend

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class MOF2KerMLText {
122122
}
123123

124124
def toMetaclass(org.eclipse.uml2.uml.Class class_) {
125-
toMetaclass(class_, "metaclass")
125+
class_.toMetaclass("metaclass")
126126
}
127127

128128
def toMetaclass(org.eclipse.uml2.uml.Class class_, String keyword) {
@@ -158,12 +158,13 @@ class MOF2KerMLText {
158158
}
159159

160160
def toFeature(org.eclipse.uml2.uml.Property property) {
161-
toFeature(property, property.isComposite, "feature")
161+
val keyword = '''«IF property.isComposite»composite «ENDIF»«IF property.readOnly»const «ELSE»var «ENDIF»feature'''
162+
property.toFeature(keyword)
162163
}
163164

164-
def toFeature(org.eclipse.uml2.uml.Property property, boolean isComposite, String keyword) {
165+
def toFeature(org.eclipse.uml2.uml.Property property, String keyword) {
165166
'''
166-
«IF property.derivedUnion»abstract «ENDIF»«IF isComposite»composite «ENDIF»«IF property.readOnly»readonly «ENDIF»«IF property.derived»derived «ENDIF»«keyword» «nameOf(property)» : «property.type.toTypeName»«property.toMultiplicity»«property.toSubsets»«property.toRedefines»;
167+
«IF property.derived»derived «ENDIF»«IF property.derivedUnion»abstract «ENDIF»«keyword» «nameOf(property)» : «property.type.toTypeName»«property.toMultiplicity»«property.toSubsets»«property.toRedefines»;
167168
'''
168169
}
169170

@@ -194,16 +195,16 @@ class MOF2KerMLText {
194195

195196
def String getReservedWords() {
196197
// Note: Every word must be preceded and followed by a space.
197-
" about abstract alias all and as assign assoc behavior binding bool by chains
198-
class classifier comment composite conjugate conjugates conjugation connector
199-
datatype default derived differences disjoining disjoint doc element else end
200-
expr false feature featured featuring filter first flow for from function
201-
hastype if intersects implies import in inout interaction inv inverse
202-
inverting istype language locale member metaclass metadata multiplicity namespace
203-
nonunique not null of or ordered out package portion predicate private
204-
protected public readonly references redefines redefinition relationship rep
205-
return specialization specializes step struct subclassifier subset subsets
206-
subtype succession then to true type typed typing unions xor "
198+
" about abstract alias all and as assoc behavior binding bool by chains class
199+
classifier comment composite conjugate conjugates conjugation connector const
200+
crosses datatype default dependency derived differences disjoining disjoint doc
201+
else end expr false feature featured featuring filter first flow for from
202+
function hastype if implies import in inout interaction intersects inv inverse
203+
inverting istype language library locale member meta metaclass metadata
204+
multiplicity namespace nonunique not null of or ordered out package portion
205+
predicate private protected public redefines redefinition references rep return
206+
specialization specializes standard step struct subclassifier subset subsets
207+
subtype succession then to true type typed typing unions var xor "
207208
}
208209

209210
def toTypeName(Type type) {

org.omg.sysml/src/org/omg/sysml/generation/MOF2SysMLText.xtend

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,32 @@ class MOF2SysMLText extends MOF2KerMLText {
3838
}
3939

4040
override toMetaclass(org.eclipse.uml2.uml.Class class_) {
41-
toMetaclass(class_, "metadata def")
41+
class_.toMetaclass("metadata def")
4242
}
4343

4444
override toFeature(org.eclipse.uml2.uml.Property property) {
4545
if (property.type instanceof DataType) {
46-
toFeature(property, false, "attribute")
46+
property.toFeature("attribute")
4747
} else {
48-
toFeature(property, false, if (property.isComposite) "item" else "ref item")
48+
val keyword = '''«IF property.readOnly»constant «ENDIF»«IF !property.isComposite»ref «ENDIF»item'''
49+
property.toFeature(keyword)
4950
}
5051
}
5152

5253
override String getReservedWords() {
5354
// Note: Every word must be preceded and followed by a space.
54-
" about abstract accept action actor after alias all allocate allocation
55-
analysis and as assign assert assume at attribute bind binding by
56-
calc case comment concern connect connection constraint decide def default
57-
defined dependency derived do doc else end entry enum event exhibit
58-
exit expose filter first flow for fork frame from hastype if implies
59-
import in include individual inout interface istype item join language
60-
library locale loop merge message meta metadata nonunique not objective
61-
occurrence of or ordered out package parallel part perform port private
62-
protected public readonly redefines ref references render rendering rep
63-
require requirement return satisfy send snapshot specializes stakeholder
64-
standard state subject subsets succession terminate then timeslice to
65-
transition until use variant variation verification verify via view
66-
viewpoint when while xor "
55+
" about abstract accept action actor after alias all allocate allocation analysis
56+
and as assert assign assume at attribute bind binding by calc case comment
57+
concern connect connection constant constraint crosses decide def default
58+
defined dependency derived do doc else end entry enum event exhibit exit expose
59+
false filter first flow for fork frame from hastype if implies import in include
60+
individual inout interface istype item join language library locale loop merge
61+
message meta metadata nonunique not null objective occurrence of or ordered out
62+
package parallel part perform port private protected public redefines ref
63+
references render rendering rep require requirement return satisfy send snapshot
64+
specializes stakeholder standard state subject subsets succession terminate then
65+
timeslice to transition true until use variant variation verification verify via
66+
view viewpoint when while xor "
6767
}
6868

6969
static def void main(String[] args) {

0 commit comments

Comments
 (0)