diff options
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.java')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.java | 157 |
1 files changed, 0 insertions, 157 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.java b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.java deleted file mode 100644 index 872814b8..00000000 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/MetamodelValidator.java +++ /dev/null | |||
@@ -1,157 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.validation; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | ||
4 | import java.util.Collections; | ||
5 | import java.util.LinkedList; | ||
6 | import java.util.List; | ||
7 | import org.eclipse.emf.common.util.EList; | ||
8 | import org.eclipse.emf.ecore.EAttribute; | ||
9 | import org.eclipse.emf.ecore.EClass; | ||
10 | import org.eclipse.emf.ecore.EDataType; | ||
11 | import org.eclipse.emf.ecore.EEnum; | ||
12 | import org.eclipse.emf.ecore.EEnumLiteral; | ||
13 | import org.eclipse.emf.ecore.EReference; | ||
14 | import org.eclipse.emf.ecore.EcorePackage; | ||
15 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
16 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
17 | import org.eclipse.xtext.xbase.lib.Extension; | ||
18 | |||
19 | @SuppressWarnings("all") | ||
20 | public class MetamodelValidator { | ||
21 | public LinkedList<String> validateMetamodel(final EcoreMetamodelDescriptor descriptor) { | ||
22 | final LinkedList<String> errors = new LinkedList<String>(); | ||
23 | this.allSupertypesAreIncluded(descriptor.getClasses(), errors); | ||
24 | this.allEnumTypesareIncluded(descriptor.getEnums(), descriptor.getLiterals(), errors); | ||
25 | this.referenceEndpointsAreIncluded(descriptor.getClasses(), descriptor.getReferences(), errors); | ||
26 | this.attributeSourcePontIsIncluded(descriptor.getClasses(), descriptor.getAttributes(), errors); | ||
27 | this.attributeTargetIsSupported(descriptor.getAttributes(), errors); | ||
28 | return errors; | ||
29 | } | ||
30 | |||
31 | private boolean supportedEDataType(final EDataType dataType) { | ||
32 | @Extension | ||
33 | final EcorePackage l = EcorePackage.eINSTANCE; | ||
34 | EDataType _eInt = l.getEInt(); | ||
35 | EDataType _eBoolean = l.getEBoolean(); | ||
36 | EDataType _eString = l.getEString(); | ||
37 | EDataType _eDouble = l.getEDouble(); | ||
38 | EDataType _eFloat = l.getEFloat(); | ||
39 | return Collections.<EDataType>unmodifiableList(CollectionLiterals.<EDataType>newArrayList(_eInt, _eBoolean, _eString, _eDouble, _eFloat)).contains(dataType); | ||
40 | } | ||
41 | |||
42 | public void allSupertypesAreIncluded(final List<EClass> classes, final List<String> errors) { | ||
43 | for (final EClass c : classes) { | ||
44 | EList<EClass> _eSuperTypes = c.getESuperTypes(); | ||
45 | for (final EClass s : _eSuperTypes) { | ||
46 | boolean _contains = classes.contains(s); | ||
47 | boolean _not = (!_contains); | ||
48 | if (_not) { | ||
49 | StringConcatenation _builder = new StringConcatenation(); | ||
50 | _builder.append("Metamodel contains \""); | ||
51 | String _name = c.getName(); | ||
52 | _builder.append(_name); | ||
53 | _builder.append("\" but not contains its supertype \""); | ||
54 | String _name_1 = s.getName(); | ||
55 | _builder.append(_name_1); | ||
56 | _builder.append("\"!"); | ||
57 | errors.add(_builder.toString()); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public void allEnumTypesareIncluded(final List<EEnum> enums, final List<EEnumLiteral> literals, final List<String> errors) { | ||
64 | for (final EEnumLiteral l : literals) { | ||
65 | boolean _contains = enums.contains(l.getEEnum()); | ||
66 | boolean _not = (!_contains); | ||
67 | if (_not) { | ||
68 | StringConcatenation _builder = new StringConcatenation(); | ||
69 | _builder.append("Metamodel contains literal \""); | ||
70 | String _name = l.getName(); | ||
71 | _builder.append(_name); | ||
72 | _builder.append("\" but does not contains enum \""); | ||
73 | String _name_1 = l.getEEnum().getName(); | ||
74 | _builder.append(_name_1); | ||
75 | _builder.append("\"!"); | ||
76 | errors.add(_builder.toString()); | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
81 | public void referenceEndpointsAreIncluded(final List<EClass> classes, final List<EReference> references, final List<String> errors) { | ||
82 | for (final EReference reference : references) { | ||
83 | { | ||
84 | final EClass src = reference.getEContainingClass(); | ||
85 | boolean _contains = classes.contains(src); | ||
86 | boolean _not = (!_contains); | ||
87 | if (_not) { | ||
88 | StringConcatenation _builder = new StringConcatenation(); | ||
89 | _builder.append("Metamodel contains reference \""); | ||
90 | String _name = reference.getName(); | ||
91 | _builder.append(_name); | ||
92 | _builder.append("\" but does not contains its source type \""); | ||
93 | String _name_1 = src.getName(); | ||
94 | _builder.append(_name_1); | ||
95 | _builder.append("\"!"); | ||
96 | errors.add(_builder.toString()); | ||
97 | } | ||
98 | final EClass trg = reference.getEReferenceType(); | ||
99 | boolean _contains_1 = classes.contains(trg); | ||
100 | boolean _not_1 = (!_contains_1); | ||
101 | if (_not_1) { | ||
102 | StringConcatenation _builder_1 = new StringConcatenation(); | ||
103 | _builder_1.append("Metamodel contains reference \""); | ||
104 | String _name_2 = reference.getName(); | ||
105 | _builder_1.append(_name_2); | ||
106 | _builder_1.append("\" but does not contains its target type \""); | ||
107 | String _name_3 = trg.getName(); | ||
108 | _builder_1.append(_name_3); | ||
109 | _builder_1.append("\"!"); | ||
110 | errors.add(_builder_1.toString()); | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public void attributeSourcePontIsIncluded(final List<EClass> classes, final List<EAttribute> attributes, final List<String> errors) { | ||
117 | for (final EAttribute attribute : attributes) { | ||
118 | { | ||
119 | final Class<?> src = attribute.getContainerClass(); | ||
120 | boolean _contains = classes.contains(src); | ||
121 | boolean _not = (!_contains); | ||
122 | if (_not) { | ||
123 | StringConcatenation _builder = new StringConcatenation(); | ||
124 | _builder.append("Metamodel contains attribute \""); | ||
125 | String _name = attribute.getName(); | ||
126 | _builder.append(_name); | ||
127 | _builder.append("\" but does not contains its source type \""); | ||
128 | String _name_1 = src.getName(); | ||
129 | _builder.append(_name_1); | ||
130 | _builder.append("\"!"); | ||
131 | errors.add(_builder.toString()); | ||
132 | } | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | public void attributeTargetIsSupported(final List<EAttribute> attributes, final List<String> errors) { | ||
138 | for (final EAttribute attribute : attributes) { | ||
139 | { | ||
140 | final EDataType trg = attribute.getEAttributeType(); | ||
141 | boolean _supportedEDataType = this.supportedEDataType(trg); | ||
142 | boolean _not = (!_supportedEDataType); | ||
143 | if (_not) { | ||
144 | StringConcatenation _builder = new StringConcatenation(); | ||
145 | _builder.append("Metamodels contains attribute \""); | ||
146 | String _name = attribute.getName(); | ||
147 | _builder.append(_name); | ||
148 | _builder.append("\" with unsupported type \""); | ||
149 | String _name_1 = trg.getName(); | ||
150 | _builder.append(_name_1); | ||
151 | _builder.append("\"!"); | ||
152 | errors.add(_builder.toString()); | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | } | ||