Преглед изворни кода

multiple adaptations can now be combined

Claudio Gomes пре 7 година
родитељ
комит
36debbc18e

+ 25 - 14
HintCO/model/Candidates.xcore

@@ -1,5 +1,7 @@
 package ua.ansymo.hintco
 
+import org.eclipse.emf.common.util.BasicEList
+
 type Int wraps int
 
 abstract class IDed {
@@ -66,18 +68,18 @@ class HierarchicalCosimUnitDeclaration extends CosimUnitDeclaration {
 
 class Adaptable {
 	contains Adaptation adaptation opposite adaptable
-	op Adaptation selectedAdaptation() {
+	op Adaptation[] selectedAdaptations() {
 		if (adaptation === null){
-			return null
+			return new BasicEList(#[])
 		}
 		if (adaptation.selected){
-			if (adaptation instanceof XorAdaptation){
-				return (adaptation as XorAdaptation).selectedAdaptation()
+			if (adaptation instanceof DecompositionAdaptation){
+				return (adaptation as DecompositionAdaptation).selectedAdaptations()
 			}
-			return adaptation
+			return new BasicEList(#[adaptation])
 		}
 		
-		return null
+		return new BasicEList(#[])
 	}
 }
 
@@ -137,21 +139,28 @@ abstract class Adaptation extends Alternative
 
 abstract class DecompositionAdaptation extends Adaptation {
 	contains Adaptation[] children opposite parent
-}
-
-class XorAdaptation extends DecompositionAdaptation {
 	derived String name get {
 		"(w=" + weight + ")"
 	}
-	op Adaptation selectedAdaptation() {
-		val selected = children.findFirst[a | a.selected]
-		if (selected instanceof XorAdaptation){
-			return selected.selectedAdaptation()
+	op Adaptation[] selectedAdaptations() {
+		val res = new BasicEList(children.size)
+		for (c : children.filter[a | a.selected]){
+			if (c instanceof DecompositionAdaptation){
+				res.addAll(c.selectedAdaptations())
+			} else {
+				res.add(c)
+			}
 		}
-		return selected
+		return res
 	}
 }
 
+class XorAdaptation extends DecompositionAdaptation {
+}
+
+class CombineAdaptation extends DecompositionAdaptation {
+}
+
 abstract class ApproximationAdaptation extends Adaptation {
 	int order
 }
@@ -163,6 +172,8 @@ class MultiRateAdaptation extends Adaptation {
 	}
 }
 
+
+
 class ExtrapolationAdaptation extends ApproximationAdaptation {
 	derived String name get {
 		order + "(w=" + weight + ")"

Разлика између датотеке није приказан због своје велике величине
+ 4 - 2
HintCO/src-gen/ua/ansymo/hintco/Adaptable.java


+ 17 - 0
HintCO/src-gen/ua/ansymo/hintco/CombineAdaptation.java

@@ -0,0 +1,17 @@
+/**
+ */
+package ua.ansymo.hintco;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Combine Adaptation</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see ua.ansymo.hintco.HintcoPackage#getCombineAdaptation()
+ * @model
+ * @generated
+ */
+public interface CombineAdaptation extends DecompositionAdaptation {
+} // CombineAdaptation

Разлика између датотеке није приказан због своје велике величине
+ 26 - 0
HintCO/src-gen/ua/ansymo/hintco/DecompositionAdaptation.java


+ 9 - 0
HintCO/src-gen/ua/ansymo/hintco/HintcoFactory.java

@@ -129,6 +129,15 @@ public interface HintcoFactory extends EFactory {
 	 */
 	XorAdaptation createXorAdaptation();
 
+	/**
+	 * Returns a new object of class '<em>Combine Adaptation</em>'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return a new object of class '<em>Combine Adaptation</em>'.
+	 * @generated
+	 */
+	CombineAdaptation createCombineAdaptation();
+
 	/**
 	 * Returns a new object of class '<em>Multi Rate Adaptation</em>'.
 	 * <!-- begin-user-doc -->

+ 196 - 49
HintCO/src-gen/ua/ansymo/hintco/HintcoPackage.java

@@ -563,13 +563,13 @@ public interface HintcoPackage extends EPackage {
 	int ADAPTABLE_FEATURE_COUNT = 1;
 
 	/**
-	 * The operation id for the '<em>Selected Adaptation</em>' operation.
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int ADAPTABLE___SELECTED_ADAPTATION = 0;
+	int ADAPTABLE___SELECTED_ADAPTATIONS = 0;
 
 	/**
 	 * The number of operations of the '<em>Adaptable</em>' class.
@@ -672,13 +672,13 @@ public interface HintcoPackage extends EPackage {
 	int COSIM_UNIT_INSTANCE_FEATURE_COUNT = IDED_FEATURE_COUNT + 7;
 
 	/**
-	 * The operation id for the '<em>Selected Adaptation</em>' operation.
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int COSIM_UNIT_INSTANCE___SELECTED_ADAPTATION = IDED_OPERATION_COUNT + 0;
+	int COSIM_UNIT_INSTANCE___SELECTED_ADAPTATIONS = IDED_OPERATION_COUNT + 0;
 
 	/**
 	 * The number of operations of the '<em>Cosim Unit Instance</em>' class.
@@ -883,13 +883,13 @@ public interface HintcoPackage extends EPackage {
 	int PORT_INSTANCE_FEATURE_COUNT = PRECENDENCE_NODE_FEATURE_COUNT + 3;
 
 	/**
-	 * The operation id for the '<em>Selected Adaptation</em>' operation.
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int PORT_INSTANCE___SELECTED_ADAPTATION = PRECENDENCE_NODE_OPERATION_COUNT + 0;
+	int PORT_INSTANCE___SELECTED_ADAPTATIONS = PRECENDENCE_NODE_OPERATION_COUNT + 0;
 
 	/**
 	 * The number of operations of the '<em>Port Instance</em>' class.
@@ -1001,13 +1001,13 @@ public interface HintcoPackage extends EPackage {
 	int INPUT_PORT_INSTANCE_FEATURE_COUNT = PORT_INSTANCE_FEATURE_COUNT + 2;
 
 	/**
-	 * The operation id for the '<em>Selected Adaptation</em>' operation.
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int INPUT_PORT_INSTANCE___SELECTED_ADAPTATION = PORT_INSTANCE___SELECTED_ADAPTATION;
+	int INPUT_PORT_INSTANCE___SELECTED_ADAPTATIONS = PORT_INSTANCE___SELECTED_ADAPTATIONS;
 
 	/**
 	 * The number of operations of the '<em>Input Port Instance</em>' class.
@@ -1119,13 +1119,13 @@ public interface HintcoPackage extends EPackage {
 	int OUTPUT_PORT_INSTANCE_FEATURE_COUNT = PORT_INSTANCE_FEATURE_COUNT + 2;
 
 	/**
-	 * The operation id for the '<em>Selected Adaptation</em>' operation.
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int OUTPUT_PORT_INSTANCE___SELECTED_ADAPTATION = PORT_INSTANCE___SELECTED_ADAPTATION;
+	int OUTPUT_PORT_INSTANCE___SELECTED_ADAPTATIONS = PORT_INSTANCE___SELECTED_ADAPTATIONS;
 
 	/**
 	 * The number of operations of the '<em>Output Port Instance</em>' class.
@@ -1337,6 +1337,15 @@ public interface HintcoPackage extends EPackage {
 	 */
 	int DECOMPOSITION_ADAPTATION__CHILDREN = ADAPTATION_FEATURE_COUNT + 0;
 
+	/**
+	 * The feature id for the '<em><b>Name</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int DECOMPOSITION_ADAPTATION__NAME = ADAPTATION_FEATURE_COUNT + 1;
+
 	/**
 	 * The number of structural features of the '<em>Decomposition Adaptation</em>' class.
 	 * <!-- begin-user-doc -->
@@ -1344,7 +1353,7 @@ public interface HintcoPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int DECOMPOSITION_ADAPTATION_FEATURE_COUNT = ADAPTATION_FEATURE_COUNT + 1;
+	int DECOMPOSITION_ADAPTATION_FEATURE_COUNT = ADAPTATION_FEATURE_COUNT + 2;
 
 	/**
 	 * The operation id for the '<em>Adapted</em>' operation.
@@ -1355,6 +1364,15 @@ public interface HintcoPackage extends EPackage {
 	 */
 	int DECOMPOSITION_ADAPTATION___ADAPTED = ADAPTATION___ADAPTED;
 
+	/**
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int DECOMPOSITION_ADAPTATION___SELECTED_ADAPTATIONS = ADAPTATION_OPERATION_COUNT + 0;
+
 	/**
 	 * The number of operations of the '<em>Decomposition Adaptation</em>' class.
 	 * <!-- begin-user-doc -->
@@ -1362,7 +1380,7 @@ public interface HintcoPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int DECOMPOSITION_ADAPTATION_OPERATION_COUNT = ADAPTATION_OPERATION_COUNT + 0;
+	int DECOMPOSITION_ADAPTATION_OPERATION_COUNT = ADAPTATION_OPERATION_COUNT + 1;
 
 	/**
 	 * The meta object id for the '{@link ua.ansymo.hintco.impl.XorAdaptationImpl <em>Xor Adaptation</em>}' class.
@@ -1435,7 +1453,7 @@ public interface HintcoPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int XOR_ADAPTATION__NAME = DECOMPOSITION_ADAPTATION_FEATURE_COUNT + 0;
+	int XOR_ADAPTATION__NAME = DECOMPOSITION_ADAPTATION__NAME;
 
 	/**
 	 * The number of structural features of the '<em>Xor Adaptation</em>' class.
@@ -1444,7 +1462,7 @@ public interface HintcoPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int XOR_ADAPTATION_FEATURE_COUNT = DECOMPOSITION_ADAPTATION_FEATURE_COUNT + 1;
+	int XOR_ADAPTATION_FEATURE_COUNT = DECOMPOSITION_ADAPTATION_FEATURE_COUNT + 0;
 
 	/**
 	 * The operation id for the '<em>Adapted</em>' operation.
@@ -1456,13 +1474,13 @@ public interface HintcoPackage extends EPackage {
 	int XOR_ADAPTATION___ADAPTED = DECOMPOSITION_ADAPTATION___ADAPTED;
 
 	/**
-	 * The operation id for the '<em>Selected Adaptation</em>' operation.
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int XOR_ADAPTATION___SELECTED_ADAPTATION = DECOMPOSITION_ADAPTATION_OPERATION_COUNT + 0;
+	int XOR_ADAPTATION___SELECTED_ADAPTATIONS = DECOMPOSITION_ADAPTATION___SELECTED_ADAPTATIONS;
 
 	/**
 	 * The number of operations of the '<em>Xor Adaptation</em>' class.
@@ -1471,7 +1489,116 @@ public interface HintcoPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int XOR_ADAPTATION_OPERATION_COUNT = DECOMPOSITION_ADAPTATION_OPERATION_COUNT + 1;
+	int XOR_ADAPTATION_OPERATION_COUNT = DECOMPOSITION_ADAPTATION_OPERATION_COUNT + 0;
+
+	/**
+	 * The meta object id for the '{@link ua.ansymo.hintco.impl.CombineAdaptationImpl <em>Combine Adaptation</em>}' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see ua.ansymo.hintco.impl.CombineAdaptationImpl
+	 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getCombineAdaptation()
+	 * @generated
+	 */
+	int COMBINE_ADAPTATION = 19;
+
+	/**
+	 * The feature id for the '<em><b>Weight</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION__WEIGHT = DECOMPOSITION_ADAPTATION__WEIGHT;
+
+	/**
+	 * The feature id for the '<em><b>Selected</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION__SELECTED = DECOMPOSITION_ADAPTATION__SELECTED;
+
+	/**
+	 * The feature id for the '<em><b>Implies</b></em>' reference list.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION__IMPLIES = DECOMPOSITION_ADAPTATION__IMPLIES;
+
+	/**
+	 * The feature id for the '<em><b>Parent</b></em>' container reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION__PARENT = DECOMPOSITION_ADAPTATION__PARENT;
+
+	/**
+	 * The feature id for the '<em><b>Adaptable</b></em>' container reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION__ADAPTABLE = DECOMPOSITION_ADAPTATION__ADAPTABLE;
+
+	/**
+	 * The feature id for the '<em><b>Children</b></em>' containment reference list.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION__CHILDREN = DECOMPOSITION_ADAPTATION__CHILDREN;
+
+	/**
+	 * The feature id for the '<em><b>Name</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION__NAME = DECOMPOSITION_ADAPTATION__NAME;
+
+	/**
+	 * The number of structural features of the '<em>Combine Adaptation</em>' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION_FEATURE_COUNT = DECOMPOSITION_ADAPTATION_FEATURE_COUNT + 0;
+
+	/**
+	 * The operation id for the '<em>Adapted</em>' operation.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION___ADAPTED = DECOMPOSITION_ADAPTATION___ADAPTED;
+
+	/**
+	 * The operation id for the '<em>Selected Adaptations</em>' operation.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION___SELECTED_ADAPTATIONS = DECOMPOSITION_ADAPTATION___SELECTED_ADAPTATIONS;
+
+	/**
+	 * The number of operations of the '<em>Combine Adaptation</em>' class.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int COMBINE_ADAPTATION_OPERATION_COUNT = DECOMPOSITION_ADAPTATION_OPERATION_COUNT + 0;
 
 	/**
 	 * The meta object id for the '{@link ua.ansymo.hintco.impl.ApproximationAdaptationImpl <em>Approximation Adaptation</em>}' class.
@@ -1481,7 +1608,7 @@ public interface HintcoPackage extends EPackage {
 	 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getApproximationAdaptation()
 	 * @generated
 	 */
-	int APPROXIMATION_ADAPTATION = 19;
+	int APPROXIMATION_ADAPTATION = 20;
 
 	/**
 	 * The feature id for the '<em><b>Weight</b></em>' attribute.
@@ -1572,7 +1699,7 @@ public interface HintcoPackage extends EPackage {
 	 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getMultiRateAdaptation()
 	 * @generated
 	 */
-	int MULTI_RATE_ADAPTATION = 20;
+	int MULTI_RATE_ADAPTATION = 21;
 
 	/**
 	 * The feature id for the '<em><b>Weight</b></em>' attribute.
@@ -1672,7 +1799,7 @@ public interface HintcoPackage extends EPackage {
 	 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getExtrapolationAdaptation()
 	 * @generated
 	 */
-	int EXTRAPOLATION_ADAPTATION = 21;
+	int EXTRAPOLATION_ADAPTATION = 22;
 
 	/**
 	 * The feature id for the '<em><b>Weight</b></em>' attribute.
@@ -1772,7 +1899,7 @@ public interface HintcoPackage extends EPackage {
 	 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getInterpolationAdaptation()
 	 * @generated
 	 */
-	int INTERPOLATION_ADAPTATION = 22;
+	int INTERPOLATION_ADAPTATION = 23;
 
 	/**
 	 * The feature id for the '<em><b>Weight</b></em>' attribute.
@@ -1871,7 +1998,7 @@ public interface HintcoPackage extends EPackage {
 	 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getInt()
 	 * @generated
 	 */
-	int INT = 23;
+	int INT = 24;
 
 
 	/**
@@ -2197,14 +2324,14 @@ public interface HintcoPackage extends EPackage {
 	EReference getAdaptable_Adaptation();
 
 	/**
-	 * Returns the meta object for the '{@link ua.ansymo.hintco.Adaptable#selectedAdaptation() <em>Selected Adaptation</em>}' operation.
+	 * Returns the meta object for the '{@link ua.ansymo.hintco.Adaptable#selectedAdaptations() <em>Selected Adaptations</em>}' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @return the meta object for the '<em>Selected Adaptation</em>' operation.
-	 * @see ua.ansymo.hintco.Adaptable#selectedAdaptation()
+	 * @return the meta object for the '<em>Selected Adaptations</em>' operation.
+	 * @see ua.ansymo.hintco.Adaptable#selectedAdaptations()
 	 * @generated
 	 */
-	EOperation getAdaptable__SelectedAdaptation();
+	EOperation getAdaptable__SelectedAdaptations();
 
 	/**
 	 * Returns the meta object for class '{@link ua.ansymo.hintco.CosimUnitInstance <em>Cosim Unit Instance</em>}'.
@@ -2460,35 +2587,45 @@ public interface HintcoPackage extends EPackage {
 	EReference getDecompositionAdaptation_Children();
 
 	/**
-	 * Returns the meta object for class '{@link ua.ansymo.hintco.XorAdaptation <em>Xor Adaptation</em>}'.
+	 * Returns the meta object for the attribute '{@link ua.ansymo.hintco.DecompositionAdaptation#getName <em>Name</em>}'.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @return the meta object for class '<em>Xor Adaptation</em>'.
-	 * @see ua.ansymo.hintco.XorAdaptation
+	 * @return the meta object for the attribute '<em>Name</em>'.
+	 * @see ua.ansymo.hintco.DecompositionAdaptation#getName()
+	 * @see #getDecompositionAdaptation()
 	 * @generated
 	 */
-	EClass getXorAdaptation();
+	EAttribute getDecompositionAdaptation_Name();
 
 	/**
-	 * Returns the meta object for the attribute '{@link ua.ansymo.hintco.XorAdaptation#getName <em>Name</em>}'.
+	 * Returns the meta object for the '{@link ua.ansymo.hintco.DecompositionAdaptation#selectedAdaptations() <em>Selected Adaptations</em>}' operation.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @return the meta object for the attribute '<em>Name</em>'.
-	 * @see ua.ansymo.hintco.XorAdaptation#getName()
-	 * @see #getXorAdaptation()
+	 * @return the meta object for the '<em>Selected Adaptations</em>' operation.
+	 * @see ua.ansymo.hintco.DecompositionAdaptation#selectedAdaptations()
+	 * @generated
+	 */
+	EOperation getDecompositionAdaptation__SelectedAdaptations();
+
+	/**
+	 * Returns the meta object for class '{@link ua.ansymo.hintco.XorAdaptation <em>Xor Adaptation</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for class '<em>Xor Adaptation</em>'.
+	 * @see ua.ansymo.hintco.XorAdaptation
 	 * @generated
 	 */
-	EAttribute getXorAdaptation_Name();
+	EClass getXorAdaptation();
 
 	/**
-	 * Returns the meta object for the '{@link ua.ansymo.hintco.XorAdaptation#selectedAdaptation() <em>Selected Adaptation</em>}' operation.
+	 * Returns the meta object for class '{@link ua.ansymo.hintco.CombineAdaptation <em>Combine Adaptation</em>}'.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @return the meta object for the '<em>Selected Adaptation</em>' operation.
-	 * @see ua.ansymo.hintco.XorAdaptation#selectedAdaptation()
+	 * @return the meta object for class '<em>Combine Adaptation</em>'.
+	 * @see ua.ansymo.hintco.CombineAdaptation
 	 * @generated
 	 */
-	EOperation getXorAdaptation__SelectedAdaptation();
+	EClass getCombineAdaptation();
 
 	/**
 	 * Returns the meta object for class '{@link ua.ansymo.hintco.ApproximationAdaptation <em>Approximation Adaptation</em>}'.
@@ -2875,12 +3012,12 @@ public interface HintcoPackage extends EPackage {
 		EReference ADAPTABLE__ADAPTATION = eINSTANCE.getAdaptable_Adaptation();
 
 		/**
-		 * The meta object literal for the '<em><b>Selected Adaptation</b></em>' operation.
+		 * The meta object literal for the '<em><b>Selected Adaptations</b></em>' operation.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
 		 * @generated
 		 */
-		EOperation ADAPTABLE___SELECTED_ADAPTATION = eINSTANCE.getAdaptable__SelectedAdaptation();
+		EOperation ADAPTABLE___SELECTED_ADAPTATIONS = eINSTANCE.getAdaptable__SelectedAdaptations();
 
 		/**
 		 * The meta object literal for the '{@link ua.ansymo.hintco.impl.CosimUnitInstanceImpl <em>Cosim Unit Instance</em>}' class.
@@ -3095,30 +3232,40 @@ public interface HintcoPackage extends EPackage {
 		EReference DECOMPOSITION_ADAPTATION__CHILDREN = eINSTANCE.getDecompositionAdaptation_Children();
 
 		/**
-		 * The meta object literal for the '{@link ua.ansymo.hintco.impl.XorAdaptationImpl <em>Xor Adaptation</em>}' class.
+		 * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
-		 * @see ua.ansymo.hintco.impl.XorAdaptationImpl
-		 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getXorAdaptation()
 		 * @generated
 		 */
-		EClass XOR_ADAPTATION = eINSTANCE.getXorAdaptation();
+		EAttribute DECOMPOSITION_ADAPTATION__NAME = eINSTANCE.getDecompositionAdaptation_Name();
 
 		/**
-		 * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+		 * The meta object literal for the '<em><b>Selected Adaptations</b></em>' operation.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
 		 * @generated
 		 */
-		EAttribute XOR_ADAPTATION__NAME = eINSTANCE.getXorAdaptation_Name();
+		EOperation DECOMPOSITION_ADAPTATION___SELECTED_ADAPTATIONS = eINSTANCE.getDecompositionAdaptation__SelectedAdaptations();
+
+		/**
+		 * The meta object literal for the '{@link ua.ansymo.hintco.impl.XorAdaptationImpl <em>Xor Adaptation</em>}' class.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @see ua.ansymo.hintco.impl.XorAdaptationImpl
+		 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getXorAdaptation()
+		 * @generated
+		 */
+		EClass XOR_ADAPTATION = eINSTANCE.getXorAdaptation();
 
 		/**
-		 * The meta object literal for the '<em><b>Selected Adaptation</b></em>' operation.
+		 * The meta object literal for the '{@link ua.ansymo.hintco.impl.CombineAdaptationImpl <em>Combine Adaptation</em>}' class.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
+		 * @see ua.ansymo.hintco.impl.CombineAdaptationImpl
+		 * @see ua.ansymo.hintco.impl.HintcoPackageImpl#getCombineAdaptation()
 		 * @generated
 		 */
-		EOperation XOR_ADAPTATION___SELECTED_ADAPTATION = eINSTANCE.getXorAdaptation__SelectedAdaptation();
+		EClass COMBINE_ADAPTATION = eINSTANCE.getCombineAdaptation();
 
 		/**
 		 * The meta object literal for the '{@link ua.ansymo.hintco.impl.ApproximationAdaptationImpl <em>Approximation Adaptation</em>}' class.

Разлика између датотеке није приказан због своје велике величине
+ 0 - 31
HintCO/src-gen/ua/ansymo/hintco/XorAdaptation.java


+ 11 - 9
HintCO/src-gen/ua/ansymo/hintco/impl/AdaptableImpl.java

@@ -7,6 +7,7 @@ import java.lang.reflect.InvocationTargetException;
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.NotificationChain;
 
+import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 
 import org.eclipse.emf.ecore.EClass;
@@ -17,8 +18,8 @@ import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
 
 import ua.ansymo.hintco.Adaptable;
 import ua.ansymo.hintco.Adaptation;
+import ua.ansymo.hintco.DecompositionAdaptation;
 import ua.ansymo.hintco.HintcoPackage;
-import ua.ansymo.hintco.XorAdaptation;
 
 /**
  * <!-- begin-user-doc -->
@@ -111,22 +112,23 @@ public class AdaptableImpl extends MinimalEObjectImpl.Container implements Adapt
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public Adaptation selectedAdaptation() {
+	public EList<Adaptation> selectedAdaptations() {
 		Adaptation _adaptation = this.getAdaptation();
 		boolean _tripleEquals = (_adaptation == null);
 		if (_tripleEquals) {
-			return null;
+			return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList()));
 		}
 		boolean _isSelected = this.getAdaptation().isSelected();
 		if (_isSelected) {
 			Adaptation _adaptation_1 = this.getAdaptation();
-			if ((_adaptation_1 instanceof XorAdaptation)) {
+			if ((_adaptation_1 instanceof DecompositionAdaptation)) {
 				Adaptation _adaptation_2 = this.getAdaptation();
-				return ((XorAdaptation) _adaptation_2).selectedAdaptation();
+				return ((DecompositionAdaptation) _adaptation_2).selectedAdaptations();
 			}
-			return this.getAdaptation();
+			Adaptation _adaptation_3 = this.getAdaptation();
+			return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList(_adaptation_3)));
 		}
-		return null;
+		return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList()));
 	}
 
 	/**
@@ -225,8 +227,8 @@ public class AdaptableImpl extends MinimalEObjectImpl.Container implements Adapt
 	@Override
 	public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
 		switch (operationID) {
-			case HintcoPackage.ADAPTABLE___SELECTED_ADAPTATION:
-				return selectedAdaptation();
+			case HintcoPackage.ADAPTABLE___SELECTED_ADAPTATIONS:
+				return selectedAdaptations();
 		}
 		return super.eInvoke(operationID, arguments);
 	}

+ 37 - 0
HintCO/src-gen/ua/ansymo/hintco/impl/CombineAdaptationImpl.java

@@ -0,0 +1,37 @@
+/**
+ */
+package ua.ansymo.hintco.impl;
+
+import org.eclipse.emf.ecore.EClass;
+
+import ua.ansymo.hintco.CombineAdaptation;
+import ua.ansymo.hintco.HintcoPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Combine Adaptation</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class CombineAdaptationImpl extends DecompositionAdaptationImpl implements CombineAdaptation {
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected CombineAdaptationImpl() {
+		super();
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EClass eStaticClass() {
+		return HintcoPackage.Literals.COMBINE_ADAPTATION;
+	}
+
+} //CombineAdaptationImpl

+ 12 - 10
HintCO/src-gen/ua/ansymo/hintco/impl/CosimUnitInstanceImpl.java

@@ -9,6 +9,7 @@ import java.util.Collection;
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.NotificationChain;
 
+import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 
 import org.eclipse.emf.ecore.EClass;
@@ -24,10 +25,10 @@ import ua.ansymo.hintco.Adaptable;
 import ua.ansymo.hintco.Adaptation;
 import ua.ansymo.hintco.CosimUnitDeclaration;
 import ua.ansymo.hintco.CosimUnitInstance;
+import ua.ansymo.hintco.DecompositionAdaptation;
 import ua.ansymo.hintco.HintcoPackage;
 import ua.ansymo.hintco.PortInstance;
 import ua.ansymo.hintco.PrecendenceNode;
-import ua.ansymo.hintco.XorAdaptation;
 
 /**
  * <!-- begin-user-doc -->
@@ -380,22 +381,23 @@ public class CosimUnitInstanceImpl extends IDedImpl implements CosimUnitInstance
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public Adaptation selectedAdaptation() {
+	public EList<Adaptation> selectedAdaptations() {
 		Adaptation _adaptation = this.getAdaptation();
 		boolean _tripleEquals = (_adaptation == null);
 		if (_tripleEquals) {
-			return null;
+			return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList()));
 		}
 		boolean _isSelected = this.getAdaptation().isSelected();
 		if (_isSelected) {
 			Adaptation _adaptation_1 = this.getAdaptation();
-			if ((_adaptation_1 instanceof XorAdaptation)) {
+			if ((_adaptation_1 instanceof DecompositionAdaptation)) {
 				Adaptation _adaptation_2 = this.getAdaptation();
-				return ((XorAdaptation) _adaptation_2).selectedAdaptation();
+				return ((DecompositionAdaptation) _adaptation_2).selectedAdaptations();
 			}
-			return this.getAdaptation();
+			Adaptation _adaptation_3 = this.getAdaptation();
+			return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList(_adaptation_3)));
 		}
-		return null;
+		return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList()));
 	}
 
 	/**
@@ -642,7 +644,7 @@ public class CosimUnitInstanceImpl extends IDedImpl implements CosimUnitInstance
 		}
 		if (baseClass == Adaptable.class) {
 			switch (baseOperationID) {
-				case HintcoPackage.ADAPTABLE___SELECTED_ADAPTATION: return HintcoPackage.COSIM_UNIT_INSTANCE___SELECTED_ADAPTATION;
+				case HintcoPackage.ADAPTABLE___SELECTED_ADAPTATIONS: return HintcoPackage.COSIM_UNIT_INSTANCE___SELECTED_ADAPTATIONS;
 				default: return -1;
 			}
 		}
@@ -657,8 +659,8 @@ public class CosimUnitInstanceImpl extends IDedImpl implements CosimUnitInstance
 	@Override
 	public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
 		switch (operationID) {
-			case HintcoPackage.COSIM_UNIT_INSTANCE___SELECTED_ADAPTATION:
-				return selectedAdaptation();
+			case HintcoPackage.COSIM_UNIT_INSTANCE___SELECTED_ADAPTATIONS:
+				return selectedAdaptations();
 		}
 		return super.eInvoke(operationID, arguments);
 	}

+ 72 - 0
HintCO/src-gen/ua/ansymo/hintco/impl/DecompositionAdaptationImpl.java

@@ -2,10 +2,13 @@
  */
 package ua.ansymo.hintco.impl;
 
+import java.lang.reflect.InvocationTargetException;
+
 import java.util.Collection;
 
 import org.eclipse.emf.common.notify.NotificationChain;
 
+import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 
 import org.eclipse.emf.ecore.EClass;
@@ -14,6 +17,10 @@ import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
 import org.eclipse.emf.ecore.util.InternalEList;
 
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+
 import ua.ansymo.hintco.Adaptation;
 import ua.ansymo.hintco.DecompositionAdaptation;
 import ua.ansymo.hintco.HintcoPackage;
@@ -27,6 +34,7 @@ import ua.ansymo.hintco.HintcoPackage;
  * </p>
  * <ul>
  *   <li>{@link ua.ansymo.hintco.impl.DecompositionAdaptationImpl#getChildren <em>Children</em>}</li>
+ *   <li>{@link ua.ansymo.hintco.impl.DecompositionAdaptationImpl#getName <em>Name</em>}</li>
  * </ul>
  *
  * @generated
@@ -42,6 +50,16 @@ public abstract class DecompositionAdaptationImpl extends AdaptationImpl impleme
 	 */
 	protected EList<Adaptation> children;
 
+	/**
+	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getName()
+	 * @generated
+	 * @ordered
+	 */
+	protected static final String NAME_EDEFAULT = null;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -73,6 +91,42 @@ public abstract class DecompositionAdaptationImpl extends AdaptationImpl impleme
 		return children;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public String getName() {
+		int _weight = this.getWeight();
+		String _plus = ("(w=" + Integer.valueOf(_weight));
+		return (_plus + ")");
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EList<Adaptation> selectedAdaptations() {
+		int _size = this.getChildren().size();
+		final BasicEList<Adaptation> res = new BasicEList<Adaptation>(_size);
+		final Function1<Adaptation, Boolean> _function = new Function1<Adaptation, Boolean>() {
+			public Boolean apply(final Adaptation a) {
+				return Boolean.valueOf(a.isSelected());
+			}
+		};
+		Iterable<Adaptation> _filter = IterableExtensions.<Adaptation>filter(this.getChildren(), _function);
+		for (final Adaptation c : _filter) {
+			if ((c instanceof DecompositionAdaptation)) {
+				res.addAll(((DecompositionAdaptation)c).selectedAdaptations());
+			}
+			else {
+				res.add(c);
+			}
+		}
+		return res;
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -112,6 +166,8 @@ public abstract class DecompositionAdaptationImpl extends AdaptationImpl impleme
 		switch (featureID) {
 			case HintcoPackage.DECOMPOSITION_ADAPTATION__CHILDREN:
 				return getChildren();
+			case HintcoPackage.DECOMPOSITION_ADAPTATION__NAME:
+				return getName();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
@@ -158,8 +214,24 @@ public abstract class DecompositionAdaptationImpl extends AdaptationImpl impleme
 		switch (featureID) {
 			case HintcoPackage.DECOMPOSITION_ADAPTATION__CHILDREN:
 				return children != null && !children.isEmpty();
+			case HintcoPackage.DECOMPOSITION_ADAPTATION__NAME:
+				return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
 		}
 		return super.eIsSet(featureID);
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
+		switch (operationID) {
+			case HintcoPackage.DECOMPOSITION_ADAPTATION___SELECTED_ADAPTATIONS:
+				return selectedAdaptations();
+		}
+		return super.eInvoke(operationID, arguments);
+	}
+
 } //DecompositionAdaptationImpl

+ 11 - 0
HintCO/src-gen/ua/ansymo/hintco/impl/HintcoFactoryImpl.java

@@ -69,6 +69,7 @@ public class HintcoFactoryImpl extends EFactoryImpl implements HintcoFactory {
 			case HintcoPackage.INPUT_PORT_INSTANCE: return createInputPortInstance();
 			case HintcoPackage.OUTPUT_PORT_INSTANCE: return createOutputPortInstance();
 			case HintcoPackage.XOR_ADAPTATION: return createXorAdaptation();
+			case HintcoPackage.COMBINE_ADAPTATION: return createCombineAdaptation();
 			case HintcoPackage.MULTI_RATE_ADAPTATION: return createMultiRateAdaptation();
 			case HintcoPackage.EXTRAPOLATION_ADAPTATION: return createExtrapolationAdaptation();
 			case HintcoPackage.INTERPOLATION_ADAPTATION: return createInterpolationAdaptation();
@@ -227,6 +228,16 @@ public class HintcoFactoryImpl extends EFactoryImpl implements HintcoFactory {
 		return xorAdaptation;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public CombineAdaptation createCombineAdaptation() {
+		CombineAdaptationImpl combineAdaptation = new CombineAdaptationImpl();
+		return combineAdaptation;
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->

+ 35 - 13
HintCO/src-gen/ua/ansymo/hintco/impl/HintcoPackageImpl.java

@@ -18,6 +18,7 @@ import ua.ansymo.hintco.Alternative;
 import ua.ansymo.hintco.ApproximationAdaptation;
 import ua.ansymo.hintco.CandidateScenario;
 import ua.ansymo.hintco.Candidates;
+import ua.ansymo.hintco.CombineAdaptation;
 import ua.ansymo.hintco.CosimUnitDeclaration;
 import ua.ansymo.hintco.CosimUnitInstance;
 import ua.ansymo.hintco.DecompositionAdaptation;
@@ -178,6 +179,13 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 	 */
 	private EClass xorAdaptationEClass = null;
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	private EClass combineAdaptationEClass = null;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -552,7 +560,7 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public EOperation getAdaptable__SelectedAdaptation() {
+	public EOperation getAdaptable__SelectedAdaptations() {
 		return adaptableEClass.getEOperations().get(0);
 	}
 
@@ -777,8 +785,8 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public EClass getXorAdaptation() {
-		return xorAdaptationEClass;
+	public EAttribute getDecompositionAdaptation_Name() {
+		return (EAttribute)decompositionAdaptationEClass.getEStructuralFeatures().get(1);
 	}
 
 	/**
@@ -786,8 +794,8 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public EAttribute getXorAdaptation_Name() {
-		return (EAttribute)xorAdaptationEClass.getEStructuralFeatures().get(0);
+	public EOperation getDecompositionAdaptation__SelectedAdaptations() {
+		return decompositionAdaptationEClass.getEOperations().get(0);
 	}
 
 	/**
@@ -795,8 +803,17 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public EOperation getXorAdaptation__SelectedAdaptation() {
-		return xorAdaptationEClass.getEOperations().get(0);
+	public EClass getXorAdaptation() {
+		return xorAdaptationEClass;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EClass getCombineAdaptation() {
+		return combineAdaptationEClass;
 	}
 
 	/**
@@ -954,7 +971,7 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 
 		adaptableEClass = createEClass(ADAPTABLE);
 		createEReference(adaptableEClass, ADAPTABLE__ADAPTATION);
-		createEOperation(adaptableEClass, ADAPTABLE___SELECTED_ADAPTATION);
+		createEOperation(adaptableEClass, ADAPTABLE___SELECTED_ADAPTATIONS);
 
 		cosimUnitInstanceEClass = createEClass(COSIM_UNIT_INSTANCE);
 		createEReference(cosimUnitInstanceEClass, COSIM_UNIT_INSTANCE__DECLARATION);
@@ -989,10 +1006,12 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 
 		decompositionAdaptationEClass = createEClass(DECOMPOSITION_ADAPTATION);
 		createEReference(decompositionAdaptationEClass, DECOMPOSITION_ADAPTATION__CHILDREN);
+		createEAttribute(decompositionAdaptationEClass, DECOMPOSITION_ADAPTATION__NAME);
+		createEOperation(decompositionAdaptationEClass, DECOMPOSITION_ADAPTATION___SELECTED_ADAPTATIONS);
 
 		xorAdaptationEClass = createEClass(XOR_ADAPTATION);
-		createEAttribute(xorAdaptationEClass, XOR_ADAPTATION__NAME);
-		createEOperation(xorAdaptationEClass, XOR_ADAPTATION___SELECTED_ADAPTATION);
+
+		combineAdaptationEClass = createEClass(COMBINE_ADAPTATION);
 
 		approximationAdaptationEClass = createEClass(APPROXIMATION_ADAPTATION);
 		createEAttribute(approximationAdaptationEClass, APPROXIMATION_ADAPTATION__ORDER);
@@ -1061,6 +1080,7 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 		adaptationEClass.getESuperTypes().add(this.getAlternative());
 		decompositionAdaptationEClass.getESuperTypes().add(this.getAdaptation());
 		xorAdaptationEClass.getESuperTypes().add(this.getDecompositionAdaptation());
+		combineAdaptationEClass.getESuperTypes().add(this.getDecompositionAdaptation());
 		approximationAdaptationEClass.getESuperTypes().add(this.getAdaptation());
 		multiRateAdaptationEClass.getESuperTypes().add(this.getAdaptation());
 		extrapolationAdaptationEClass.getESuperTypes().add(this.getApproximationAdaptation());
@@ -1105,7 +1125,7 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 		initEClass(adaptableEClass, Adaptable.class, "Adaptable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getAdaptable_Adaptation(), this.getAdaptation(), this.getAdaptation_Adaptable(), "adaptation", null, 0, 1, Adaptable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
-		initEOperation(getAdaptable__SelectedAdaptation(), this.getAdaptation(), "selectedAdaptation", 0, 1, !IS_UNIQUE, IS_ORDERED);
+		initEOperation(getAdaptable__SelectedAdaptations(), this.getAdaptation(), "selectedAdaptations", 0, -1, !IS_UNIQUE, IS_ORDERED);
 
 		initEClass(cosimUnitInstanceEClass, CosimUnitInstance.class, "CosimUnitInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getCosimUnitInstance_Declaration(), this.getCosimUnitDeclaration(), null, "declaration", null, 1, 1, CosimUnitInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -1141,11 +1161,13 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 
 		initEClass(decompositionAdaptationEClass, DecompositionAdaptation.class, "DecompositionAdaptation", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getDecompositionAdaptation_Children(), this.getAdaptation(), this.getAdaptation_Parent(), "children", null, 0, -1, DecompositionAdaptation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEAttribute(getDecompositionAdaptation_Name(), theEcorePackage.getEString(), "name", null, 0, 1, DecompositionAdaptation.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+
+		initEOperation(getDecompositionAdaptation__SelectedAdaptations(), this.getAdaptation(), "selectedAdaptations", 0, -1, !IS_UNIQUE, IS_ORDERED);
 
 		initEClass(xorAdaptationEClass, XorAdaptation.class, "XorAdaptation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
-		initEAttribute(getXorAdaptation_Name(), theEcorePackage.getEString(), "name", null, 0, 1, XorAdaptation.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED);
 
-		initEOperation(getXorAdaptation__SelectedAdaptation(), this.getAdaptation(), "selectedAdaptation", 0, 1, !IS_UNIQUE, IS_ORDERED);
+		initEClass(combineAdaptationEClass, CombineAdaptation.class, "CombineAdaptation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 
 		initEClass(approximationAdaptationEClass, ApproximationAdaptation.class, "ApproximationAdaptation", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEAttribute(getApproximationAdaptation_Order(), theEcorePackage.getEInt(), "order", null, 0, 1, ApproximationAdaptation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

+ 12 - 10
HintCO/src-gen/ua/ansymo/hintco/impl/PortInstanceImpl.java

@@ -7,6 +7,7 @@ import java.lang.reflect.InvocationTargetException;
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.NotificationChain;
 
+import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 
 import org.eclipse.emf.ecore.EClass;
@@ -19,10 +20,10 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
 import ua.ansymo.hintco.Adaptable;
 import ua.ansymo.hintco.Adaptation;
 import ua.ansymo.hintco.CosimUnitInstance;
+import ua.ansymo.hintco.DecompositionAdaptation;
 import ua.ansymo.hintco.HintcoPackage;
 import ua.ansymo.hintco.IDed;
 import ua.ansymo.hintco.PortInstance;
-import ua.ansymo.hintco.XorAdaptation;
 
 /**
  * <!-- begin-user-doc -->
@@ -209,22 +210,23 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public Adaptation selectedAdaptation() {
+	public EList<Adaptation> selectedAdaptations() {
 		Adaptation _adaptation = this.getAdaptation();
 		boolean _tripleEquals = (_adaptation == null);
 		if (_tripleEquals) {
-			return null;
+			return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList()));
 		}
 		boolean _isSelected = this.getAdaptation().isSelected();
 		if (_isSelected) {
 			Adaptation _adaptation_1 = this.getAdaptation();
-			if ((_adaptation_1 instanceof XorAdaptation)) {
+			if ((_adaptation_1 instanceof DecompositionAdaptation)) {
 				Adaptation _adaptation_2 = this.getAdaptation();
-				return ((XorAdaptation) _adaptation_2).selectedAdaptation();
+				return ((DecompositionAdaptation) _adaptation_2).selectedAdaptations();
 			}
-			return this.getAdaptation();
+			Adaptation _adaptation_3 = this.getAdaptation();
+			return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList(_adaptation_3)));
 		}
-		return null;
+		return new BasicEList<Adaptation>(java.util.Collections.<Adaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<Adaptation>newArrayList()));
 	}
 
 	/**
@@ -414,7 +416,7 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 		}
 		if (baseClass == Adaptable.class) {
 			switch (baseOperationID) {
-				case HintcoPackage.ADAPTABLE___SELECTED_ADAPTATION: return HintcoPackage.PORT_INSTANCE___SELECTED_ADAPTATION;
+				case HintcoPackage.ADAPTABLE___SELECTED_ADAPTATIONS: return HintcoPackage.PORT_INSTANCE___SELECTED_ADAPTATIONS;
 				default: return -1;
 			}
 		}
@@ -429,8 +431,8 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 	@Override
 	public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
 		switch (operationID) {
-			case HintcoPackage.PORT_INSTANCE___SELECTED_ADAPTATION:
-				return selectedAdaptation();
+			case HintcoPackage.PORT_INSTANCE___SELECTED_ADAPTATIONS:
+				return selectedAdaptations();
 		}
 		return super.eInvoke(operationID, arguments);
 	}

+ 0 - 96
HintCO/src-gen/ua/ansymo/hintco/impl/XorAdaptationImpl.java

@@ -2,17 +2,8 @@
  */
 package ua.ansymo.hintco.impl;
 
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.emf.common.util.EList;
-
 import org.eclipse.emf.ecore.EClass;
 
-import org.eclipse.xtext.xbase.lib.Functions.Function1;
-
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-
-import ua.ansymo.hintco.Adaptation;
 import ua.ansymo.hintco.HintcoPackage;
 import ua.ansymo.hintco.XorAdaptation;
 
@@ -20,26 +11,10 @@ import ua.ansymo.hintco.XorAdaptation;
  * <!-- begin-user-doc -->
  * An implementation of the model object '<em><b>Xor Adaptation</b></em>'.
  * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * </p>
- * <ul>
- *   <li>{@link ua.ansymo.hintco.impl.XorAdaptationImpl#getName <em>Name</em>}</li>
- * </ul>
  *
  * @generated
  */
 public class XorAdaptationImpl extends DecompositionAdaptationImpl implements XorAdaptation {
-	/**
-	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @see #getName()
-	 * @generated
-	 * @ordered
-	 */
-	protected static final String NAME_EDEFAULT = null;
-
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -59,75 +34,4 @@ public class XorAdaptationImpl extends DecompositionAdaptationImpl implements Xo
 		return HintcoPackage.Literals.XOR_ADAPTATION;
 	}
 
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public String getName() {
-		int _weight = this.getWeight();
-		String _plus = ("(w=" + Integer.valueOf(_weight));
-		return (_plus + ")");
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public Adaptation selectedAdaptation() {
-		final Function1<Adaptation, Boolean> _function = new Function1<Adaptation, Boolean>() {
-			public Boolean apply(final Adaptation a) {
-				return Boolean.valueOf(a.isSelected());
-			}
-		};
-		final Adaptation selected = IterableExtensions.<Adaptation>findFirst(this.getChildren(), _function);
-		if ((selected instanceof XorAdaptation)) {
-			return ((XorAdaptation)selected).selectedAdaptation();
-		}
-		return selected;
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public Object eGet(int featureID, boolean resolve, boolean coreType) {
-		switch (featureID) {
-			case HintcoPackage.XOR_ADAPTATION__NAME:
-				return getName();
-		}
-		return super.eGet(featureID, resolve, coreType);
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public boolean eIsSet(int featureID) {
-		switch (featureID) {
-			case HintcoPackage.XOR_ADAPTATION__NAME:
-				return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
-		}
-		return super.eIsSet(featureID);
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
-		switch (operationID) {
-			case HintcoPackage.XOR_ADAPTATION___SELECTED_ADAPTATION:
-				return selectedAdaptation();
-		}
-		return super.eInvoke(operationID, arguments);
-	}
-
 } //XorAdaptationImpl

+ 18 - 0
HintCO/src-gen/ua/ansymo/hintco/util/HintcoAdapterFactory.java

@@ -144,6 +144,10 @@ public class HintcoAdapterFactory extends AdapterFactoryImpl {
 				return createXorAdaptationAdapter();
 			}
 			@Override
+			public Adapter caseCombineAdaptation(CombineAdaptation object) {
+				return createCombineAdaptationAdapter();
+			}
+			@Override
 			public Adapter caseApproximationAdaptation(ApproximationAdaptation object) {
 				return createApproximationAdaptationAdapter();
 			}
@@ -445,6 +449,20 @@ public class HintcoAdapterFactory extends AdapterFactoryImpl {
 		return null;
 	}
 
+	/**
+	 * Creates a new adapter for an object of class '{@link ua.ansymo.hintco.CombineAdaptation <em>Combine Adaptation</em>}'.
+	 * <!-- begin-user-doc -->
+	 * This default implementation returns null so that we can easily ignore cases;
+	 * it's useful to ignore a case when inheritance will catch all the cases anyway.
+	 * <!-- end-user-doc -->
+	 * @return the new adapter.
+	 * @see ua.ansymo.hintco.CombineAdaptation
+	 * @generated
+	 */
+	public Adapter createCombineAdaptationAdapter() {
+		return null;
+	}
+
 	/**
 	 * Creates a new adapter for an object of class '{@link ua.ansymo.hintco.ApproximationAdaptation <em>Approximation Adaptation</em>}'.
 	 * <!-- begin-user-doc -->

+ 24 - 0
HintCO/src-gen/ua/ansymo/hintco/util/HintcoSwitch.java

@@ -211,6 +211,15 @@ public class HintcoSwitch<T> extends Switch<T> {
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
+			case HintcoPackage.COMBINE_ADAPTATION: {
+				CombineAdaptation combineAdaptation = (CombineAdaptation)theEObject;
+				T result = caseCombineAdaptation(combineAdaptation);
+				if (result == null) result = caseDecompositionAdaptation(combineAdaptation);
+				if (result == null) result = caseAdaptation(combineAdaptation);
+				if (result == null) result = caseAlternative(combineAdaptation);
+				if (result == null) result = defaultCase(theEObject);
+				return result;
+			}
 			case HintcoPackage.APPROXIMATION_ADAPTATION: {
 				ApproximationAdaptation approximationAdaptation = (ApproximationAdaptation)theEObject;
 				T result = caseApproximationAdaptation(approximationAdaptation);
@@ -534,6 +543,21 @@ public class HintcoSwitch<T> extends Switch<T> {
 		return null;
 	}
 
+	/**
+	 * Returns the result of interpreting the object as an instance of '<em>Combine Adaptation</em>'.
+	 * <!-- begin-user-doc -->
+	 * This implementation returns null;
+	 * returning a non-null result will terminate the switch.
+	 * <!-- end-user-doc -->
+	 * @param object the target of the switch.
+	 * @return the result of interpreting the object as an instance of '<em>Combine Adaptation</em>'.
+	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+	 * @generated
+	 */
+	public T caseCombineAdaptation(CombineAdaptation object) {
+		return null;
+	}
+
 	/**
 	 * Returns the result of interpreting the object as an instance of '<em>Approximation Adaptation</em>'.
 	 * <!-- begin-user-doc -->

+ 15 - 11
HintCO/src/ua/ansymo/hintco/AdaptedFMUInstance.xtend

@@ -1,6 +1,7 @@
 package ua.ansymo.hintco
 
 import java.util.Map
+import org.eclipse.core.runtime.Assert
 import org.intocps.fmi.Fmi2Status
 import org.intocps.fmi.FmuInvocationException
 import org.intocps.fmi.IFmiComponent
@@ -17,22 +18,25 @@ class AdaptedFMUInstance extends FmuInstance {
 	
 	def instantiateAdaptations(CosimUnitInstance unit) {
 		// Check if unit has a multi-rate adaptation
-		val unitAdaptation = unit.selectedAdaptation
-		if (unitAdaptation !== null && unitAdaptation instanceof MultiRateAdaptation){
-			innerRate = (unitAdaptation as MultiRateAdaptation).rate
+		val unitAdaptations = unit.selectedAdaptations
+		if (!unitAdaptations.empty && unitAdaptations.head instanceof MultiRateAdaptation){
+			innerRate = (unitAdaptations.head as MultiRateAdaptation).rate
 		}
 		
 		// Instantiate each adaptation input port of the unit.
 		for (p : unit.ports.filter(InputPortInstance)){
 			// Check which adaptation is selected for the input port, and instantiate the appropriate class.
-			val portAdaptation = p.selectedAdaptation
-			switch (portAdaptation) {
-				InterpolationAdaptation case portAdaptation.order == 1: {
-					adaptedInPorts.put(p.identifier, new InterpolationAdaptedPort(p, portAdaptation))
-				}
-				ExtrapolationAdaptation case portAdaptation.order == 1: {
-					adaptedInPorts.put(p.identifier, new ExtrapolationAdaptedPort(p, portAdaptation))
-				}
+			val portAdaptations = p.selectedAdaptations
+			if (!portAdaptations.empty){
+				val portAdaptation = portAdaptations.head
+				switch (portAdaptation) {
+					InterpolationAdaptation case portAdaptation.order == 1: {
+						adaptedInPorts.put(p.identifier, new InterpolationAdaptedPort(p, portAdaptation))
+					}
+					ExtrapolationAdaptation case portAdaptation.order == 1: {
+						adaptedInPorts.put(p.identifier, new ExtrapolationAdaptedPort(p, portAdaptation))
+					}
+				}				
 			}
 		}
 		

+ 0 - 2
HintCO/test/ua/ansymo/hintco/test/CandidateSpaceGeneratorTest.xtend

@@ -15,7 +15,6 @@ import ua.ansymo.hintco.OutputPortInstance
 import ua.ansymo.hintco.OutputProcessor
 import ua.ansymo.hintco.VariantProcessor
 import ua.ansymo.hintco.VariantValidator
-import ua.ansymo.hintco.XorAdaptation
 
 import static org.junit.Assert.*
 
@@ -87,7 +86,6 @@ class CandidateSpaceGeneratorTest {
 	@Test
 	@Ignore // Only works on windows
 	def void endToEndBoeingTest(){
-		val resultsDirPath = "results-gen/boeingTest"
 		val candidates = loader.loadCandidates("instances/case_study_double_loop.xmi")
 		val contractSet = loader.loadContractSet("instances/case_study_contract.xmi")
 		generator.createCandidateSpace(contractSet, candidates)

+ 3 - 3
HintCO/test/ua/ansymo/hintco/test/ModelTest.xtend

@@ -18,11 +18,11 @@ class ModelTest {
 		val src = loader.loadCandidates("instances/model_test.xmi")
 		
 		val plant = src.eAllContents.filter(CosimUnitInstance).findFirst[u | u.identifier == "EMAPlantNoLoad_FixedEuler_1Em6"]
-		assertTrue(plant.selectedAdaptation() instanceof MultiRateAdaptation)
-		assertTrue((plant.selectedAdaptation() as MultiRateAdaptation).rate == 5)
+		assertTrue(plant.selectedAdaptations().head instanceof MultiRateAdaptation)
+		assertTrue((plant.selectedAdaptations().head as MultiRateAdaptation).rate == 5)
 		
 		val torque = src.eAllContents.filter(InputPortInstance).findFirst[p | p.identifier == "torque_input@expseu_"]
-		assertTrue(torque.selectedAdaptation instanceof InterpolationAdaptation)
+		assertTrue(torque.selectedAdaptations().head instanceof InterpolationAdaptation)
 	}
 	
 }