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