Browse Source

added new attribute to ports in order to get their weight

Claudio Gomes 5 years ago
parent
commit
9e311eb8eb

+ 1 - 0
HintConfiguration.edit/plugin.properties

@@ -99,3 +99,4 @@ _UI_RootCandidateScenario_maxInitIterations_feature = Max Init Iterations
 _UI_InputPortInstance_internalValueTo_feature = Internal Value To
 _UI_OutputPortInstance_internalValueFrom_feature = Internal Value From
 _UI_RollbackInterpolationAdaptation_type = Rollback Interpolation Adaptation
+_UI_PortInstance_extrapolationCost_feature = Extrapolation Cost

+ 24 - 0
HintConfiguration.edit/src/ua/ansymo/hintco/provider/PortInstanceItemProvider.java

@@ -50,6 +50,7 @@ public class PortInstanceItemProvider extends PrecendenceNodeItemProvider {
 
 			addIdentifierPropertyDescriptor(object);
 			addUnitPropertyDescriptor(object);
+			addExtrapolationCostPropertyDescriptor(object);
 		}
 		return itemPropertyDescriptors;
 	}
@@ -98,6 +99,28 @@ public class PortInstanceItemProvider extends PrecendenceNodeItemProvider {
 				 null));
 	}
 
+	/**
+	 * This adds a property descriptor for the Extrapolation Cost feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected void addExtrapolationCostPropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add
+			(createItemPropertyDescriptor
+				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+				 getResourceLocator(),
+				 getString("_UI_PortInstance_extrapolationCost_feature"),
+				 getString("_UI_PropertyDescriptor_description", "_UI_PortInstance_extrapolationCost_feature", "_UI_PortInstance_type"),
+				 HintcoPackage.Literals.PORT_INSTANCE__EXTRAPOLATION_COST,
+				 true,
+				 false,
+				 false,
+				 ItemPropertyDescriptor.REAL_VALUE_IMAGE,
+				 null,
+				 null));
+	}
+
 	/**
 	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
 	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
@@ -156,6 +179,7 @@ public class PortInstanceItemProvider extends PrecendenceNodeItemProvider {
 
 		switch (notification.getFeatureID(PortInstance.class)) {
 			case HintcoPackage.PORT_INSTANCE__IDENTIFIER:
+			case HintcoPackage.PORT_INSTANCE__EXTRAPOLATION_COST:
 				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
 				return;
 			case HintcoPackage.PORT_INSTANCE__ADAPTATION:

File diff suppressed because it is too large
+ 1 - 0
HintConfiguration/model/HintConfiguration.genmodel


+ 1 - 0
HintConfiguration/model/HintConfiguration.xcore

@@ -110,6 +110,7 @@ class CosimUnitInstance extends UnitInstance {
 
 abstract class PortInstance extends PrecendenceNode,IDed {
 	refers UnitInstance unit opposite ports
+	float extrapolationCost = "1.0"
 	contains PortAdaptation adaptation opposite port
 	
 	op PortAdaptation[] selectedAdaptations() {

+ 3 - 0
HintConfiguration/model/hintco.ecore

@@ -127,6 +127,9 @@
     </eOperations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="unit" eType="#//UnitInstance"
         eOpposite="#//UnitInstance/ports"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="extrapolationCost" unique="false"
+        eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EFloat"
+        defaultValueLiteral="1.0"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="adaptation" eType="#//PortAdaptation"
         containment="true" resolveProxies="false" eOpposite="#//PortAdaptation/port"/>
   </eClassifiers>

+ 57 - 2
HintConfiguration/src-gen/ua/ansymo/hintco/HintcoPackage.java

@@ -1006,6 +1006,15 @@ public interface HintcoPackage extends EPackage {
 	 */
 	int PORT_INSTANCE__UNIT = PRECENDENCE_NODE_FEATURE_COUNT + 1;
 
+	/**
+	 * The feature id for the '<em><b>Extrapolation Cost</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int PORT_INSTANCE__EXTRAPOLATION_COST = PRECENDENCE_NODE_FEATURE_COUNT + 2;
+
 	/**
 	 * The feature id for the '<em><b>Adaptation</b></em>' containment reference.
 	 * <!-- begin-user-doc -->
@@ -1013,7 +1022,7 @@ public interface HintcoPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int PORT_INSTANCE__ADAPTATION = PRECENDENCE_NODE_FEATURE_COUNT + 2;
+	int PORT_INSTANCE__ADAPTATION = PRECENDENCE_NODE_FEATURE_COUNT + 3;
 
 	/**
 	 * The number of structural features of the '<em>Port Instance</em>' class.
@@ -1022,7 +1031,7 @@ public interface HintcoPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int PORT_INSTANCE_FEATURE_COUNT = PRECENDENCE_NODE_FEATURE_COUNT + 3;
+	int PORT_INSTANCE_FEATURE_COUNT = PRECENDENCE_NODE_FEATURE_COUNT + 4;
 
 	/**
 	 * The operation id for the '<em>Selected Adaptations</em>' operation.
@@ -1133,6 +1142,15 @@ public interface HintcoPackage extends EPackage {
 	 */
 	int INPUT_PORT_INSTANCE__UNIT = PORT_INSTANCE__UNIT;
 
+	/**
+	 * The feature id for the '<em><b>Extrapolation Cost</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int INPUT_PORT_INSTANCE__EXTRAPOLATION_COST = PORT_INSTANCE__EXTRAPOLATION_COST;
+
 	/**
 	 * The feature id for the '<em><b>Adaptation</b></em>' containment reference.
 	 * <!-- begin-user-doc -->
@@ -1287,6 +1305,15 @@ public interface HintcoPackage extends EPackage {
 	 */
 	int HIERARCHICAL_UNIT_PORT__UNIT = INPUT_PORT_INSTANCE__UNIT;
 
+	/**
+	 * The feature id for the '<em><b>Extrapolation Cost</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int HIERARCHICAL_UNIT_PORT__EXTRAPOLATION_COST = INPUT_PORT_INSTANCE__EXTRAPOLATION_COST;
+
 	/**
 	 * The feature id for the '<em><b>Adaptation</b></em>' containment reference.
 	 * <!-- begin-user-doc -->
@@ -1468,6 +1495,15 @@ public interface HintcoPackage extends EPackage {
 	 */
 	int OUTPUT_PORT_INSTANCE__UNIT = PORT_INSTANCE__UNIT;
 
+	/**
+	 * The feature id for the '<em><b>Extrapolation Cost</b></em>' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int OUTPUT_PORT_INSTANCE__EXTRAPOLATION_COST = PORT_INSTANCE__EXTRAPOLATION_COST;
+
 	/**
 	 * The feature id for the '<em><b>Adaptation</b></em>' containment reference.
 	 * <!-- begin-user-doc -->
@@ -3331,6 +3367,17 @@ public interface HintcoPackage extends EPackage {
 	 */
 	EReference getPortInstance_Unit();
 
+	/**
+	 * Returns the meta object for the attribute '{@link ua.ansymo.hintco.PortInstance#getExtrapolationCost <em>Extrapolation Cost</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the attribute '<em>Extrapolation Cost</em>'.
+	 * @see ua.ansymo.hintco.PortInstance#getExtrapolationCost()
+	 * @see #getPortInstance()
+	 * @generated
+	 */
+	EAttribute getPortInstance_ExtrapolationCost();
+
 	/**
 	 * Returns the meta object for the containment reference '{@link ua.ansymo.hintco.PortInstance#getAdaptation <em>Adaptation</em>}'.
 	 * <!-- begin-user-doc -->
@@ -4320,6 +4367,14 @@ public interface HintcoPackage extends EPackage {
 		 */
 		EReference PORT_INSTANCE__UNIT = eINSTANCE.getPortInstance_Unit();
 
+		/**
+		 * The meta object literal for the '<em><b>Extrapolation Cost</b></em>' attribute feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EAttribute PORT_INSTANCE__EXTRAPOLATION_COST = eINSTANCE.getPortInstance_ExtrapolationCost();
+
 		/**
 		 * The meta object literal for the '<em><b>Adaptation</b></em>' containment reference feature.
 		 * <!-- begin-user-doc -->

+ 28 - 0
HintConfiguration/src-gen/ua/ansymo/hintco/PortInstance.java

@@ -14,6 +14,7 @@ import org.eclipse.emf.common.util.EList;
  * </p>
  * <ul>
  *   <li>{@link ua.ansymo.hintco.PortInstance#getUnit <em>Unit</em>}</li>
+ *   <li>{@link ua.ansymo.hintco.PortInstance#getExtrapolationCost <em>Extrapolation Cost</em>}</li>
  *   <li>{@link ua.ansymo.hintco.PortInstance#getAdaptation <em>Adaptation</em>}</li>
  * </ul>
  *
@@ -50,6 +51,33 @@ public interface PortInstance extends PrecendenceNode, IDed {
 	 */
 	void setUnit(UnitInstance value);
 
+	/**
+	 * Returns the value of the '<em><b>Extrapolation Cost</b></em>' attribute.
+	 * The default value is <code>"1.0"</code>.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>Extrapolation Cost</em>' attribute isn't clear,
+	 * there really should be more of a description here...
+	 * </p>
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>Extrapolation Cost</em>' attribute.
+	 * @see #setExtrapolationCost(float)
+	 * @see ua.ansymo.hintco.HintcoPackage#getPortInstance_ExtrapolationCost()
+	 * @model default="1.0" unique="false"
+	 * @generated
+	 */
+	float getExtrapolationCost();
+
+	/**
+	 * Sets the value of the '{@link ua.ansymo.hintco.PortInstance#getExtrapolationCost <em>Extrapolation Cost</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>Extrapolation Cost</em>' attribute.
+	 * @see #getExtrapolationCost()
+	 * @generated
+	 */
+	void setExtrapolationCost(float value);
+
 	/**
 	 * Returns the value of the '<em><b>Adaptation</b></em>' containment reference.
 	 * It is bidirectional and its opposite is '{@link ua.ansymo.hintco.PortAdaptation#getPort <em>Port</em>}'.

+ 12 - 1
HintConfiguration/src-gen/ua/ansymo/hintco/impl/HintcoPackageImpl.java

@@ -686,13 +686,22 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 		return (EReference)portInstanceEClass.getEStructuralFeatures().get(0);
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EAttribute getPortInstance_ExtrapolationCost() {
+		return (EAttribute)portInstanceEClass.getEStructuralFeatures().get(1);
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
 	public EReference getPortInstance_Adaptation() {
-		return (EReference)portInstanceEClass.getEStructuralFeatures().get(1);
+		return (EReference)portInstanceEClass.getEStructuralFeatures().get(2);
 	}
 
 	/**
@@ -1296,6 +1305,7 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 
 		portInstanceEClass = createEClass(PORT_INSTANCE);
 		createEReference(portInstanceEClass, PORT_INSTANCE__UNIT);
+		createEAttribute(portInstanceEClass, PORT_INSTANCE__EXTRAPOLATION_COST);
 		createEReference(portInstanceEClass, PORT_INSTANCE__ADAPTATION);
 		createEOperation(portInstanceEClass, PORT_INSTANCE___SELECTED_ADAPTATIONS);
 		createEOperation(portInstanceEClass, PORT_INSTANCE___IS_INPUT);
@@ -1495,6 +1505,7 @@ public class HintcoPackageImpl extends EPackageImpl implements HintcoPackage {
 
 		initEClass(portInstanceEClass, PortInstance.class, "PortInstance", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 		initEReference(getPortInstance_Unit(), this.getUnitInstance(), this.getUnitInstance_Ports(), "unit", null, 0, 1, PortInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEAttribute(getPortInstance_ExtrapolationCost(), theEcorePackage.getEFloat(), "extrapolationCost", "1.0", 0, 1, PortInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 		initEReference(getPortInstance_Adaptation(), this.getPortAdaptation(), this.getPortAdaptation_Port(), "adaptation", null, 0, 1, PortInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEOperation(getPortInstance__SelectedAdaptations(), this.getPortAdaptation(), "selectedAdaptations", 0, -1, !IS_UNIQUE, IS_ORDERED);

+ 52 - 0
HintConfiguration/src-gen/ua/ansymo/hintco/impl/PortInstanceImpl.java

@@ -34,6 +34,7 @@ import ua.ansymo.hintco.UnitInstance;
  * <ul>
  *   <li>{@link ua.ansymo.hintco.impl.PortInstanceImpl#getIdentifier <em>Identifier</em>}</li>
  *   <li>{@link ua.ansymo.hintco.impl.PortInstanceImpl#getUnit <em>Unit</em>}</li>
+ *   <li>{@link ua.ansymo.hintco.impl.PortInstanceImpl#getExtrapolationCost <em>Extrapolation Cost</em>}</li>
  *   <li>{@link ua.ansymo.hintco.impl.PortInstanceImpl#getAdaptation <em>Adaptation</em>}</li>
  * </ul>
  *
@@ -60,6 +61,26 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 	 */
 	protected String identifier = IDENTIFIER_EDEFAULT;
 
+	/**
+	 * The default value of the '{@link #getExtrapolationCost() <em>Extrapolation Cost</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getExtrapolationCost()
+	 * @generated
+	 * @ordered
+	 */
+	protected static final float EXTRAPOLATION_COST_EDEFAULT = 1.0F;
+
+	/**
+	 * The cached value of the '{@link #getExtrapolationCost() <em>Extrapolation Cost</em>}' attribute.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getExtrapolationCost()
+	 * @generated
+	 * @ordered
+	 */
+	protected float extrapolationCost = EXTRAPOLATION_COST_EDEFAULT;
+
 	/**
 	 * The cached value of the '{@link #getAdaptation() <em>Adaptation</em>}' containment reference.
 	 * <!-- begin-user-doc -->
@@ -161,6 +182,27 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 			eNotify(new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_INSTANCE__UNIT, newUnit, newUnit));
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public float getExtrapolationCost() {
+		return extrapolationCost;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setExtrapolationCost(float newExtrapolationCost) {
+		float oldExtrapolationCost = extrapolationCost;
+		extrapolationCost = newExtrapolationCost;
+		if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_INSTANCE__EXTRAPOLATION_COST, oldExtrapolationCost, extrapolationCost));
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -321,6 +363,8 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 			case HintcoPackage.PORT_INSTANCE__UNIT:
 				if (resolve) return getUnit();
 				return basicGetUnit();
+			case HintcoPackage.PORT_INSTANCE__EXTRAPOLATION_COST:
+				return getExtrapolationCost();
 			case HintcoPackage.PORT_INSTANCE__ADAPTATION:
 				return getAdaptation();
 		}
@@ -341,6 +385,9 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 			case HintcoPackage.PORT_INSTANCE__UNIT:
 				setUnit((UnitInstance)newValue);
 				return;
+			case HintcoPackage.PORT_INSTANCE__EXTRAPOLATION_COST:
+				setExtrapolationCost((Float)newValue);
+				return;
 			case HintcoPackage.PORT_INSTANCE__ADAPTATION:
 				setAdaptation((PortAdaptation)newValue);
 				return;
@@ -362,6 +409,9 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 			case HintcoPackage.PORT_INSTANCE__UNIT:
 				setUnit((UnitInstance)null);
 				return;
+			case HintcoPackage.PORT_INSTANCE__EXTRAPOLATION_COST:
+				setExtrapolationCost(EXTRAPOLATION_COST_EDEFAULT);
+				return;
 			case HintcoPackage.PORT_INSTANCE__ADAPTATION:
 				setAdaptation((PortAdaptation)null);
 				return;
@@ -381,6 +431,8 @@ public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements Po
 				return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier);
 			case HintcoPackage.PORT_INSTANCE__UNIT:
 				return basicGetUnit() != null;
+			case HintcoPackage.PORT_INSTANCE__EXTRAPOLATION_COST:
+				return extrapolationCost != EXTRAPOLATION_COST_EDEFAULT;
 			case HintcoPackage.PORT_INSTANCE__ADAPTATION:
 				return adaptation != null;
 		}