diff options
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java index 3ed13964..e6840f6f 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java +++ b/Application/hu.bme.mit.inf.dslreasoner.application/xtend-gen/hu/bme/mit/inf/dslreasoner/application/validation/QueryAndMetamodelValidator.java | |||
@@ -1,86 +1,86 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.validation; | 1 | package hu.bme.mit.inf.dslreasoner.application.validation; |
2 | 2 | ||
3 | import com.google.common.collect.Iterables; | 3 | import com.google.common.collect.Iterables; |
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | 4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; |
5 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; | 5 | import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; |
6 | import java.util.Collections; | 6 | import java.util.Collections; |
7 | import java.util.LinkedList; | 7 | import java.util.LinkedList; |
8 | import java.util.List; | 8 | import java.util.List; |
9 | import java.util.Set; | 9 | import java.util.Set; |
10 | import org.eclipse.emf.common.util.EList; | 10 | import org.eclipse.emf.common.util.EList; |
11 | import org.eclipse.emf.ecore.EAttribute; | 11 | import org.eclipse.emf.ecore.EAttribute; |
12 | import org.eclipse.emf.ecore.EClass; | 12 | import org.eclipse.emf.ecore.EClass; |
13 | import org.eclipse.emf.ecore.EClassifier; | 13 | import org.eclipse.emf.ecore.EClassifier; |
14 | import org.eclipse.emf.ecore.EEnum; | 14 | import org.eclipse.emf.ecore.EEnum; |
15 | import org.eclipse.emf.ecore.EEnumLiteral; | 15 | import org.eclipse.emf.ecore.EEnumLiteral; |
16 | import org.eclipse.emf.ecore.ENamedElement; | 16 | import org.eclipse.emf.ecore.ENamedElement; |
17 | import org.eclipse.emf.ecore.EObject; | 17 | import org.eclipse.emf.ecore.EObject; |
18 | import org.eclipse.emf.ecore.EReference; | 18 | import org.eclipse.emf.ecore.EReference; |
19 | import org.eclipse.viatra.query.patternlanguage.emf.vql.Pattern; | 19 | import org.eclipse.viatra.query.patternlanguage.emf.vql.Pattern; |
20 | import org.eclipse.xtend2.lib.StringConcatenation; | 20 | import org.eclipse.xtend2.lib.StringConcatenation; |
21 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | 21 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; |
22 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | 22 | import org.eclipse.xtext.xbase.lib.Functions.Function1; |
23 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | 23 | import org.eclipse.xtext.xbase.lib.IterableExtensions; |
24 | import org.eclipse.xtext.xbase.lib.IteratorExtensions; | 24 | import org.eclipse.xtext.xbase.lib.IteratorExtensions; |
25 | import org.eclipse.xtext.xbase.lib.ListExtensions; | 25 | import org.eclipse.xtext.xbase.lib.ListExtensions; |
26 | import org.eclipse.xtext.xbase.lib.Pair; | 26 | import org.eclipse.xtext.xbase.lib.Pair; |
27 | 27 | ||
28 | @SuppressWarnings("all") | 28 | @SuppressWarnings("all") |
29 | public class QueryAndMetamodelValidator { | 29 | public class QueryAndMetamodelValidator { |
30 | public LinkedList<String> validateQueryAndMetamodel(final EcoreMetamodelDescriptor metamodel, final Pair<ViatraQuerySetDescriptor, Set<Pattern>> viatra) { | 30 | public LinkedList<String> validateQueryAndMetamodel(final EcoreMetamodelDescriptor metamodel, final Pair<ViatraQuerySetDescriptor, Set<Pattern>> viatra) { |
31 | final Set<Pattern> patterns = viatra.getValue(); | 31 | final Set<Pattern> patterns = viatra.getValue(); |
32 | List<EClass> _classes = metamodel.getClasses(); | 32 | List<EClass> _classes = metamodel.getClasses(); |
33 | List<EEnum> _enums = metamodel.getEnums(); | 33 | List<EEnum> _enums = metamodel.getEnums(); |
34 | Iterable<EClassifier> _plus = Iterables.<EClassifier>concat(_classes, _enums); | 34 | Iterable<EClassifier> _plus = Iterables.<EClassifier>concat(_classes, _enums); |
35 | List<EEnumLiteral> _literals = metamodel.getLiterals(); | 35 | List<EEnumLiteral> _literals = metamodel.getLiterals(); |
36 | Iterable<ENamedElement> _plus_1 = Iterables.<ENamedElement>concat(_plus, _literals); | 36 | Iterable<ENamedElement> _plus_1 = Iterables.<ENamedElement>concat(_plus, _literals); |
37 | List<EAttribute> _attributes = metamodel.getAttributes(); | 37 | List<EAttribute> _attributes = metamodel.getAttributes(); |
38 | Iterable<ENamedElement> _plus_2 = Iterables.<ENamedElement>concat(_plus_1, _attributes); | 38 | Iterable<ENamedElement> _plus_2 = Iterables.<ENamedElement>concat(_plus_1, _attributes); |
39 | List<EReference> _references = metamodel.getReferences(); | 39 | List<EReference> _references = metamodel.getReferences(); |
40 | final Set<ENamedElement> elementsInMetamodel = IterableExtensions.<ENamedElement>toSet(Iterables.<ENamedElement>concat(_plus_2, _references)); | 40 | final Set<ENamedElement> elementsInMetamodel = IterableExtensions.<ENamedElement>toSet(Iterables.<ENamedElement>concat(_plus_2, _references)); |
41 | final LinkedList<String> errors = new LinkedList<String>(); | 41 | final LinkedList<String> errors = new LinkedList<String>(); |
42 | for (final Pattern pattern : patterns) { | 42 | for (final Pattern pattern : patterns) { |
43 | { | 43 | { |
44 | final Iterable<ENamedElement> elements = this.getReferredNamedElements(pattern); | 44 | final Iterable<ENamedElement> elements = this.getReferredNamedElements(pattern); |
45 | for (final ENamedElement element : elements) { | 45 | for (final ENamedElement element : elements) { |
46 | boolean _contains = elementsInMetamodel.contains(element); | 46 | boolean _contains = elementsInMetamodel.contains(element); |
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("Pattern \""); | 50 | _builder.append("Pattern \""); |
51 | String _name = pattern.getName(); | 51 | String _name = pattern.getName(); |
52 | _builder.append(_name); | 52 | _builder.append(_name); |
53 | _builder.append("\" refers to an element \""); | 53 | _builder.append("\" refers to an element \""); |
54 | _builder.append(element); | 54 | _builder.append(element); |
55 | _builder.append("\" that is not included to the selected metamodel!"); | 55 | _builder.append("\" that is not included to the selected metamodel!"); |
56 | errors.add(_builder.toString()); | 56 | errors.add(_builder.toString()); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | } | 59 | } |
60 | } | 60 | } |
61 | return errors; | 61 | return errors; |
62 | } | 62 | } |
63 | 63 | ||
64 | public Iterable<ENamedElement> getReferredNamedElements(final Pattern pattern) { | 64 | public Iterable<ENamedElement> getReferredNamedElements(final Pattern pattern) { |
65 | final List<EObject> elements = IteratorExtensions.<EObject>toList(pattern.eAllContents()); | 65 | final List<EObject> elements = IteratorExtensions.<EObject>toList(pattern.eAllContents()); |
66 | final Function1<EObject, Iterable<ENamedElement>> _function = (EObject element) -> { | 66 | final Function1<EObject, Iterable<ENamedElement>> _function = (EObject element) -> { |
67 | final EList<EReference> references = element.eClass().getEAllReferences(); | 67 | final EList<EReference> references = element.eClass().getEAllReferences(); |
68 | final Function1<EReference, Iterable<ENamedElement>> _function_1 = (EReference r) -> { | 68 | final Function1<EReference, Iterable<ENamedElement>> _function_1 = (EReference r) -> { |
69 | boolean _isMany = r.isMany(); | 69 | boolean _isMany = r.isMany(); |
70 | if (_isMany) { | 70 | if (_isMany) { |
71 | Object _eGet = element.eGet(r); | 71 | Object _eGet = element.eGet(r); |
72 | return Iterables.<ENamedElement>filter(((List<?>) _eGet), ENamedElement.class); | 72 | return Iterables.<ENamedElement>filter(((List<?>) _eGet), ENamedElement.class); |
73 | } else { | 73 | } else { |
74 | final Object value = element.eGet(r); | 74 | final Object value = element.eGet(r); |
75 | if ((value instanceof ENamedElement)) { | 75 | if ((value instanceof ENamedElement)) { |
76 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList(((ENamedElement)value))); | 76 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList(((ENamedElement)value))); |
77 | } else { | 77 | } else { |
78 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList()); | 78 | return Collections.<ENamedElement>unmodifiableList(CollectionLiterals.<ENamedElement>newArrayList()); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | }; | 81 | }; |
82 | return Iterables.<ENamedElement>filter(Iterables.<ENamedElement>concat(ListExtensions.<EReference, Iterable<ENamedElement>>map(references, _function_1)), ENamedElement.class); | 82 | return Iterables.<ENamedElement>filter(Iterables.<ENamedElement>concat(ListExtensions.<EReference, Iterable<ENamedElement>>map(references, _function_1)), ENamedElement.class); |
83 | }; | 83 | }; |
84 | return Iterables.<ENamedElement>concat(ListExtensions.<EObject, Iterable<ENamedElement>>map(elements, _function)); | 84 | return Iterables.<ENamedElement>concat(ListExtensions.<EObject, Iterable<ENamedElement>>map(elements, _function)); |
85 | } | 85 | } |
86 | } | 86 | } |