Skip to content

Commit

Permalink
use => in example personlist
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Dec 7, 2019
1 parent cc22965 commit 51e18e3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@SuppressWarnings("all")
public class ExampleSyntax2 extends AbstractEdelta {
Expand All @@ -26,15 +28,18 @@ public ExampleSyntax2(final AbstractEdelta other) {
}

public void improvePerson(final EPackage it) {
final EClass personClass = getEClass("PersonList", "Person");
this.refactorings.introduceSubclasses(
getEAttribute("PersonList", "Person", "gender"),
getEEnum("PersonList", "Gender"), personClass);
EList<EStructuralFeature> _eStructuralFeatures = personClass.getEStructuralFeatures();
EAttribute _mergeAttributes = this.refactorings.mergeAttributes("name",
getEAttribute("PersonList", "Person", "firstname").getEType(),
Collections.<EAttribute>unmodifiableList(CollectionLiterals.<EAttribute>newArrayList(getEAttribute("PersonList", "Person", "firstname"), getEAttribute("PersonList", "Person", "lastname"))));
_eStructuralFeatures.add(_mergeAttributes);
final Procedure1<EClass> _function = (EClass it_1) -> {
this.refactorings.introduceSubclasses(
getEAttribute("PersonList", "Person", "gender"),
getEEnum("PersonList", "Gender"), it_1);
EList<EStructuralFeature> _eStructuralFeatures = it_1.getEStructuralFeatures();
EAttribute _mergeAttributes = this.refactorings.mergeAttributes("name",
getEAttribute("PersonList", "Person", "firstname").getEType(),
Collections.<EAttribute>unmodifiableList(CollectionLiterals.<EAttribute>newArrayList(getEAttribute("PersonList", "Person", "firstname"), getEAttribute("PersonList", "Person", "lastname"))));
_eStructuralFeatures.add(_mergeAttributes);
};
ObjectExtensions.<EClass>operator_doubleArrow(
getEClass("PersonList", "Person"), _function);
}

public void introducePlace(final EPackage it) {
Expand Down
25 changes: 13 additions & 12 deletions edelta.parent/edelta.personlist.example/src/ExampleSyntax2.edelta
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ metamodel "ecore"
use MMrefactorings as refactorings

modifyEcore improvePerson epackage PersonList {
val personClass = ecoreref(PersonList.Person)
refactorings.
introduceSubclasses(
ecoreref(Person.gender),
ecoreref(Gender),
personClass
);
personClass.EStructuralFeatures+=
refactorings.mergeAttributes("name",
ecoreref(Person.firstname).EType,
#[ecoreref(Person.firstname), ecoreref(Person.lastname)]
);
ecoreref(PersonList.Person) => [
refactorings.
introduceSubclasses(
ecoreref(Person.gender),
ecoreref(Gender),
it
)
EStructuralFeatures+=
refactorings.mergeAttributes("name",
ecoreref(Person.firstname).EType,
#[ecoreref(Person.firstname), ecoreref(Person.lastname)]
)
]
}

modifyEcore introducePlace epackage PersonList {
Expand Down

0 comments on commit 51e18e3

Please sign in to comment.