Module: RGen::ECore::EPackage::ClassModule
- Includes:
- Util::NameHelper
- Defined in:
- lib/rgen/ecore/ecore_ext.rb,
lib/mmgen/mm_ext/ecore_mmgen_ext.rb
Instance Method Summary
collapse
#camelize, #className, #firstToLower, #firstToUpper, #normalize, #saneClassName, #saneMethodName
Instance Method Details
#allClassesSorted ⇒ Object
36
37
38
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 36
def allClassesSorted
inheritanceOrderClasses(classesInGenerationOrdering)
end
|
#ancestorPackages ⇒ Object
19
20
21
22
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 19
def ancestorPackages
return [] unless eSuperPackage
[eSuperPackage] + eSuperPackage.ancestorPackages
end
|
#classesInGenerationOrdering ⇒ Object
28
29
30
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 28
def classesInGenerationOrdering
ownClasses + eSubpackages.collect{|s| s.classesInGenerationOrdering}.flatten
end
|
#eAllClasses ⇒ Object
40
41
42
|
# File 'lib/rgen/ecore/ecore_ext.rb', line 40
def eAllClasses
eClasses + eSubpackages.eAllClasses
end
|
#eAllClassifiers ⇒ Object
29
30
31
|
# File 'lib/rgen/ecore/ecore_ext.rb', line 29
def eAllClassifiers
eClassifiers + eSubpackages.eAllClassifiers
end
|
#eAllDataTypes ⇒ Object
48
49
50
|
# File 'lib/rgen/ecore/ecore_ext.rb', line 48
def eAllDataTypes
eDataTypes + eSubpackages.eAllDataTypes
end
|
#eAllSubpackages ⇒ Object
32
33
34
|
# File 'lib/rgen/ecore/ecore_ext.rb', line 32
def eAllSubpackages
eSubpackages + eSubpackages.eAllSubpackages
end
|
#eClasses ⇒ Object
36
37
38
|
# File 'lib/rgen/ecore/ecore_ext.rb', line 36
def eClasses
eClassifiers.select{|c| c.is_a?(ECore::EClass)}
end
|
#eDataTypes ⇒ Object
44
45
46
|
# File 'lib/rgen/ecore/ecore_ext.rb', line 44
def eDataTypes
eClassifiers.select{|c| c.is_a?(ECore::EDataType)}
end
|
#inheritanceOrderClasses(cls) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 40
def inheritanceOrderClasses(cls)
sortArray = cls.dup
i1 = 0
while i1 < sortArray.size-1
again = false
for i2 in i1+1..sortArray.size-1
e2 = sortArray[i2]
if sortArray[i1].eSuperTypes.include?(e2)
sortArray.delete(e2)
sortArray.insert(i1,e2)
again = true
break
end
end
i1 += 1 unless again
end
sortArray
end
|
#moduleName ⇒ Object
10
11
12
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 10
def moduleName
firstToUpper(name)
end
|
#needClassReorder? ⇒ Boolean
32
33
34
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 32
def needClassReorder?
classesInGenerationOrdering != inheritanceOrderClasses(classesInGenerationOrdering)
end
|
#ownClasses ⇒ Object
24
25
26
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 24
def ownClasses
eClassifiers.select{|c| c.is_a?(EClass)}
end
|
#qualifiedModuleName(rootPackage) ⇒ Object
14
15
16
17
|
# File 'lib/mmgen/mm_ext/ecore_mmgen_ext.rb', line 14
def qualifiedModuleName(rootPackage)
return moduleName unless eSuperPackage and self != rootPackage
eSuperPackage.qualifiedModuleName(rootPackage) + "::" + moduleName
end
|
#qualifiedName ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/rgen/ecore/ecore_ext.rb', line 21
def qualifiedName
if eSuperPackage
eSuperPackage.qualifiedName+"::"+name
else
name
end
end
|