From 1b5b6cfe53b627ce997c8d37577d3e4f77af7eaf Mon Sep 17 00:00:00 2001 From: "Bernhard J. Berger" <bernhard.berger@uni-bremen.de> Date: Fri, 30 Sep 2022 08:48:13 +0200 Subject: [PATCH] fixed find attribute. --- .../de.evoal.languages.model.instance/model/model.ecore | 2 +- .../de.evoal.languages.model.instance/model/model.genmodel | 2 +- .../evoal/languages/model/instance/impl/InstanceImpl.java | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/languages/de.evoal.languages.model.instance/model/model.ecore b/src/languages/de.evoal.languages.model.instance/model/model.ecore index 1dbd80a3..75c469d3 100644 --- a/src/languages/de.evoal.languages.model.instance/model/model.ecore +++ b/src/languages/de.evoal.languages.model.instance/model/model.ecore @@ -10,7 +10,7 @@ <eClassifiers xsi:type="ecore:EClass" name="Instance" eSuperTypes="#//Value"> <eOperations name="findAttribute" eType="#//Attribute"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="body" value="return getAttributes().stream().filter(n -> n.getName().equals(name)).findFirst().orElse(null);"/> + <details key="body" value="return this.getAttributes()
 .stream()
 .filter(n -> name.equals(((%de.evoal.languages.model.instance.Name%)n.getName()).getName().getName()))
 .findFirst()
 .orElse(null);"/> </eAnnotations> <eParameters name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eOperations> diff --git a/src/languages/de.evoal.languages.model.instance/model/model.genmodel b/src/languages/de.evoal.languages.model.instance/model/model.genmodel index 9cba6c10..039e514b 100644 --- a/src/languages/de.evoal.languages.model.instance/model/model.genmodel +++ b/src/languages/de.evoal.languages.model.instance/model/model.genmodel @@ -11,7 +11,7 @@ <genClasses ecoreClass="model.ecore#//Instance"> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference model.ecore#//Instance/name"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference model.ecore#//Instance/attributes"/> - <genOperations ecoreOperation="model.ecore#//Instance/findAttribute" body="return getAttributes().stream().filter(n -> n.getName().equals(name)).findFirst().orElse(null);"> + <genOperations ecoreOperation="model.ecore#//Instance/findAttribute" body="return this.getAttributes()
 .stream()
 .filter(n -> name.equals(((%de.evoal.languages.model.instance.Name%)n.getName()).getName().getName()))
 .findFirst()
 .orElse(null);"> <genParameters ecoreParameter="model.ecore#//Instance/findAttribute/name"/> </genOperations> </genClasses> diff --git a/src/languages/de.evoal.languages.model.instance/src-gen/de/evoal/languages/model/instance/impl/InstanceImpl.java b/src/languages/de.evoal.languages.model.instance/src-gen/de/evoal/languages/model/instance/impl/InstanceImpl.java index 6ef572dd..fd7bc71c 100644 --- a/src/languages/de.evoal.languages.model.instance/src-gen/de/evoal/languages/model/instance/impl/InstanceImpl.java +++ b/src/languages/de.evoal.languages.model.instance/src-gen/de/evoal/languages/model/instance/impl/InstanceImpl.java @@ -8,6 +8,7 @@ import de.evoal.languages.model.dl.TypeDefinition; import de.evoal.languages.model.instance.Attribute; import de.evoal.languages.model.instance.Instance; import de.evoal.languages.model.instance.InstancePackage; +import de.evoal.languages.model.instance.Name; import java.util.Collection; @@ -138,7 +139,11 @@ public class InstanceImpl extends ValueImpl implements Instance { */ @Override public Attribute findAttribute(final String name) { - return getAttributes().stream().filter(n -> n.getName().equals(name)).findFirst().orElse(null); + return this.getAttributes() + .stream() + .filter(n -> name.equals(((Name)n.getName()).getName().getName())) + .findFirst() + .orElse(null); } /** -- GitLab