Also store generated Java code
diff --git a/tests/org.eclipse.app4mc.multicore.partitioning.tests/.settings/org.eclipse.xtend.core.Xtend.prefs b/tests/org.eclipse.app4mc.multicore.partitioning.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
new file mode 100644
index 0000000..35ec109
--- /dev/null
+++ b/tests/org.eclipse.app4mc.multicore.partitioning.tests/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -0,0 +1,23 @@
+BuilderConfiguration.is_project_specific=true
+autobuilding=true
+eclipse.preferences.version=1
+generateGeneratedAnnotation=false
+generateSuppressWarnings=true
+generatedAnnotationComment=
+includeDateInGenerated=false
+outlet.DEFAULT_OUTPUT.cleanDirectory=false
+outlet.DEFAULT_OUTPUT.cleanupDerived=false
+outlet.DEFAULT_OUTPUT.createDirectory=true
+outlet.DEFAULT_OUTPUT.derived=false
+outlet.DEFAULT_OUTPUT.directory=xtend-gen
+outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
+outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
+outlet.DEFAULT_OUTPUT.keepLocalHistory=false
+outlet.DEFAULT_OUTPUT.override=true
+outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=
+outlet.DEFAULT_OUTPUT.sourceFolder.src.ignore=
+outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=
+outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.ignore=
+outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=
+targetJavaVersion=JAVA5
+useJavaCompilerCompliance=true
diff --git a/tests/org.eclipse.app4mc.multicore.partitioning.tests/xtend-gen/org/eclipse/app4mc/multicore/partitioning/tests/BinPackingTest.java b/tests/org.eclipse.app4mc.multicore.partitioning.tests/xtend-gen/org/eclipse/app4mc/multicore/partitioning/tests/BinPackingTest.java
new file mode 100644
index 0000000..102d4eb
--- /dev/null
+++ b/tests/org.eclipse.app4mc.multicore.partitioning.tests/xtend-gen/org/eclipse/app4mc/multicore/partitioning/tests/BinPackingTest.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright (c) 2020 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ */
+package org.eclipse.app4mc.multicore.partitioning.tests;
+
+import org.eclipse.app4mc.amalthea.model.ActivityGraph;
+import org.eclipse.app4mc.amalthea.model.ActivityGraphItem;
+import org.eclipse.app4mc.amalthea.model.Amalthea;
+import org.eclipse.app4mc.amalthea.model.AmaltheaFactory;
+import org.eclipse.app4mc.amalthea.model.DiscreteValueConstant;
+import org.eclipse.app4mc.amalthea.model.SWModel;
+import org.eclipse.app4mc.amalthea.model.Ticks;
+import org.eclipse.app4mc.amalthea.model.builder.AmaltheaBuilder;
+import org.eclipse.app4mc.multicore.partitioning.binpacking.BinPacking;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.xtext.xbase.lib.ExclusiveRange;
+import org.eclipse.xtext.xbase.lib.Extension;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
+import org.junit.Assert;
+import org.junit.Test;
+
+@SuppressWarnings("all")
+public class BinPackingTest {
+ @Extension
+ private AmaltheaBuilder b1 = new AmaltheaBuilder();
+
+ private final int[] ia = { 2, 5, 3, 4, 12, 9, 1, 0, 5, 6, 2, 4 };
+
+ private final int bins = 3;
+
+ @Test
+ public void binPackingTest() {
+ final Procedure1<Amalthea> _function = (Amalthea it) -> {
+ final Procedure1<SWModel> _function_1 = (SWModel it_1) -> {
+ int _length = this.ia.length;
+ ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _length, true);
+ for (final Integer i : _doubleDotLessThan) {
+ EList<org.eclipse.app4mc.amalthea.model.Runnable> _runnables = it_1.getRunnables();
+ org.eclipse.app4mc.amalthea.model.Runnable _createRunnable = this.createRunnable((i).intValue());
+ _runnables.add(_createRunnable);
+ }
+ };
+ this.b1.softwareModel(it, _function_1);
+ };
+ final Amalthea model = this.b1.amalthea(_function);
+ BinPacking bp = new BinPacking(model);
+ bp.binPacking(this.bins, 10);
+ int _size = bp.getAmaltheaModel().getSwModel().getProcessPrototypes().size();
+ boolean _equals = (_size == this.bins);
+ Assert.assertTrue(_equals);
+ }
+
+ private org.eclipse.app4mc.amalthea.model.Runnable createRunnable(final int id) {
+ org.eclipse.app4mc.amalthea.model.Runnable _xblockexpression = null;
+ {
+ final org.eclipse.app4mc.amalthea.model.Runnable r = AmaltheaFactory.eINSTANCE.createRunnable();
+ r.setName(Integer.toString(id));
+ final ActivityGraph ag = AmaltheaFactory.eINSTANCE.createActivityGraph();
+ final Ticks ticks = AmaltheaFactory.eINSTANCE.createTicks();
+ ticks.setDefault(this.createDVC(this.ia[id]));
+ EList<ActivityGraphItem> _items = ag.getItems();
+ _items.add(ticks);
+ r.setActivityGraph(ag);
+ _xblockexpression = r;
+ }
+ return _xblockexpression;
+ }
+
+ private DiscreteValueConstant createDVC(final int upper) {
+ DiscreteValueConstant _xblockexpression = null;
+ {
+ final DiscreteValueConstant ret = AmaltheaFactory.eINSTANCE.createDiscreteValueConstant();
+ ret.setValue(upper);
+ _xblockexpression = ret;
+ }
+ return _xblockexpression;
+ }
+}
diff --git a/tests/org.eclipse.app4mc.multicore.partitioning.tests/xtend-gen/org/eclipse/app4mc/multicore/partitioning/tests/CPPTest.java b/tests/org.eclipse.app4mc.multicore.partitioning.tests/xtend-gen/org/eclipse/app4mc/multicore/partitioning/tests/CPPTest.java
index 9597695..ec1230b 100644
--- a/tests/org.eclipse.app4mc.multicore.partitioning.tests/xtend-gen/org/eclipse/app4mc/multicore/partitioning/tests/CPPTest.java
+++ b/tests/org.eclipse.app4mc.multicore.partitioning.tests/xtend-gen/org/eclipse/app4mc/multicore/partitioning/tests/CPPTest.java
@@ -44,114 +44,66 @@
@Test
public void CPPTest() {
- final Procedure1<Amalthea> _function = new Procedure1<Amalthea>() {
- @Override
- public void apply(final Amalthea it) {
- final Procedure1<ConstraintsModel> _function = new Procedure1<ConstraintsModel>() {
- @Override
- public void apply(final ConstraintsModel it) {
- }
+ final Procedure1<Amalthea> _function = (Amalthea it) -> {
+ final Procedure1<ConstraintsModel> _function_1 = (ConstraintsModel it_1) -> {
+ };
+ this.b1.constraintsModel(it, _function_1);
+ final Procedure1<SWModel> _function_2 = (SWModel it_1) -> {
+ final Procedure1<Label> _function_3 = (Label it_2) -> {
+ it_2.setName("l1");
+ it_2.setSize(this.createDS(5));
};
- CPPTest.this.b1.constraintsModel(it, _function);
- final Procedure1<SWModel> _function_1 = new Procedure1<SWModel>() {
- @Override
- public void apply(final SWModel it) {
- final Procedure1<Label> _function = new Procedure1<Label>() {
- @Override
- public void apply(final Label it) {
- it.setName("l1");
- it.setSize(CPPTest.this.createDS(5));
- }
+ this.b2.label(it_1, _function_3);
+ final Procedure1<org.eclipse.app4mc.amalthea.model.Runnable> _function_4 = (org.eclipse.app4mc.amalthea.model.Runnable it_2) -> {
+ it_2.setName("r1");
+ final Procedure1<ActivityGraph> _function_5 = (ActivityGraph it_3) -> {
+ final Procedure1<Ticks> _function_6 = (Ticks it_4) -> {
+ it_4.setDefault(this.createDVC(20l));
};
- CPPTest.this.b2.label(it, _function);
- final Procedure1<org.eclipse.app4mc.amalthea.model.Runnable> _function_1 = new Procedure1<org.eclipse.app4mc.amalthea.model.Runnable>() {
- @Override
- public void apply(final org.eclipse.app4mc.amalthea.model.Runnable it) {
- it.setName("r1");
- final Procedure1<ActivityGraph> _function = new Procedure1<ActivityGraph>() {
- @Override
- public void apply(final ActivityGraph it) {
- final Procedure1<Ticks> _function = new Procedure1<Ticks>() {
- @Override
- public void apply(final Ticks it) {
- it.setDefault(CPPTest.this.createDVC(20l));
- }
- };
- CPPTest.this.b2.ticks(it, _function);
- final Procedure1<LabelAccess> _function_1 = new Procedure1<LabelAccess>() {
- @Override
- public void apply(final LabelAccess it) {
- it.setData(CPPTest.this.b1.<Label>_find(it, Label.class, "l1"));
- it.setAccess(LabelAccessEnum.WRITE);
- }
- };
- CPPTest.this.b2.labelAccess(it, _function_1);
- }
- };
- CPPTest.this.b2.activityGraph(it, _function);
- }
+ this.b2.ticks(it_3, _function_6);
+ final Procedure1<LabelAccess> _function_7 = (LabelAccess it_4) -> {
+ it_4.setData(this.b1.<Label>_find(it_4, Label.class, "l1"));
+ it_4.setAccess(LabelAccessEnum.WRITE);
};
- CPPTest.this.b2.runnable(it, _function_1);
- final Procedure1<org.eclipse.app4mc.amalthea.model.Runnable> _function_2 = new Procedure1<org.eclipse.app4mc.amalthea.model.Runnable>() {
- @Override
- public void apply(final org.eclipse.app4mc.amalthea.model.Runnable it) {
- it.setName("r2");
- final Procedure1<ActivityGraph> _function = new Procedure1<ActivityGraph>() {
- @Override
- public void apply(final ActivityGraph it) {
- final Procedure1<Ticks> _function = new Procedure1<Ticks>() {
- @Override
- public void apply(final Ticks it) {
- it.setDefault(CPPTest.this.createDVC(30l));
- }
- };
- CPPTest.this.b2.ticks(it, _function);
- final Procedure1<LabelAccess> _function_1 = new Procedure1<LabelAccess>() {
- @Override
- public void apply(final LabelAccess it) {
- it.setData(CPPTest.this.b1.<Label>_find(it, Label.class, "l1"));
- it.setAccess(LabelAccessEnum.WRITE);
- }
- };
- CPPTest.this.b2.labelAccess(it, _function_1);
- }
- };
- CPPTest.this.b2.activityGraph(it, _function);
- }
- };
- CPPTest.this.b2.runnable(it, _function_2);
- final Procedure1<org.eclipse.app4mc.amalthea.model.Runnable> _function_3 = new Procedure1<org.eclipse.app4mc.amalthea.model.Runnable>() {
- @Override
- public void apply(final org.eclipse.app4mc.amalthea.model.Runnable it) {
- it.setName("r3");
- final Procedure1<ActivityGraph> _function = new Procedure1<ActivityGraph>() {
- @Override
- public void apply(final ActivityGraph it) {
- final Procedure1<Ticks> _function = new Procedure1<Ticks>() {
- @Override
- public void apply(final Ticks it) {
- it.setDefault(CPPTest.this.createDVC(10l));
- }
- };
- CPPTest.this.b2.ticks(it, _function);
- final Procedure1<LabelAccess> _function_1 = new Procedure1<LabelAccess>() {
- @Override
- public void apply(final LabelAccess it) {
- it.setData(CPPTest.this.b1.<Label>_find(it, Label.class, "l1"));
- it.setAccess(LabelAccessEnum.READ);
- }
- };
- CPPTest.this.b2.labelAccess(it, _function_1);
- }
- };
- CPPTest.this.b2.activityGraph(it, _function);
- }
- };
- CPPTest.this.b2.runnable(it, _function_3);
- }
+ this.b2.labelAccess(it_3, _function_7);
+ };
+ this.b2.activityGraph(it_2, _function_5);
};
- CPPTest.this.b1.softwareModel(it, _function_1);
- }
+ this.b2.runnable(it_1, _function_4);
+ final Procedure1<org.eclipse.app4mc.amalthea.model.Runnable> _function_5 = (org.eclipse.app4mc.amalthea.model.Runnable it_2) -> {
+ it_2.setName("r2");
+ final Procedure1<ActivityGraph> _function_6 = (ActivityGraph it_3) -> {
+ final Procedure1<Ticks> _function_7 = (Ticks it_4) -> {
+ it_4.setDefault(this.createDVC(30l));
+ };
+ this.b2.ticks(it_3, _function_7);
+ final Procedure1<LabelAccess> _function_8 = (LabelAccess it_4) -> {
+ it_4.setData(this.b1.<Label>_find(it_4, Label.class, "l1"));
+ it_4.setAccess(LabelAccessEnum.WRITE);
+ };
+ this.b2.labelAccess(it_3, _function_8);
+ };
+ this.b2.activityGraph(it_2, _function_6);
+ };
+ this.b2.runnable(it_1, _function_5);
+ final Procedure1<org.eclipse.app4mc.amalthea.model.Runnable> _function_6 = (org.eclipse.app4mc.amalthea.model.Runnable it_2) -> {
+ it_2.setName("r3");
+ final Procedure1<ActivityGraph> _function_7 = (ActivityGraph it_3) -> {
+ final Procedure1<Ticks> _function_8 = (Ticks it_4) -> {
+ it_4.setDefault(this.createDVC(10l));
+ };
+ this.b2.ticks(it_3, _function_8);
+ final Procedure1<LabelAccess> _function_9 = (LabelAccess it_4) -> {
+ it_4.setData(this.b1.<Label>_find(it_4, Label.class, "l1"));
+ it_4.setAccess(LabelAccessEnum.READ);
+ };
+ this.b2.labelAccess(it_3, _function_9);
+ };
+ this.b2.activityGraph(it_2, _function_7);
+ };
+ this.b2.runnable(it_1, _function_6);
+ };
+ this.b1.softwareModel(it, _function_2);
};
final Amalthea model = this.b1.amalthea(_function);
SWModel _swModel = model.getSwModel();