Permalink
Browse files

[#89]: Relax input spec grammar by using Xtext options

Properly reworking the scheduling grammar

Task-Url: http://github.com/roberthilbrich/assist-public/issues/89
  • Loading branch information...
RobertHilbrich committed Oct 12, 2018
1 parent 520a559 commit 0180f116c14169ade92b1e0d59f4a498f9b9ac5c
Showing with 919 additions and 321 deletions.
  1. BIN ch.hilbri.assist.model.edit/icons/full/ctool16/CreateAssistModel_properties_AssignedCoreProperty.gif
  2. BIN ...ri.assist.model.edit/icons/full/ctool16/CreateHardwareElement_properties_AssignedCoreProperty.gif
  3. BIN ...ri.assist.model.edit/icons/full/ctool16/CreateSoftwareElement_properties_AssignedCoreProperty.gif
  4. BIN ch.hilbri.assist.model.edit/icons/full/obj16/AssignedCoreProperty.gif
  5. +2 −0 ch.hilbri.assist.model.edit/plugin.properties
  6. +120 −0 ...ilbri.assist.model.edit/src/ch/hilbri/assist/model/provider/AssignedCorePropertyItemProvider.java
  7. +5 −0 ch.hilbri.assist.model.edit/src/ch/hilbri/assist/model/provider/AssistModelItemProvider.java
  8. +5 −0 ch.hilbri.assist.model.edit/src/ch/hilbri/assist/model/provider/HardwareElementItemProvider.java
  9. +24 −0 ch.hilbri.assist.model.edit/src/ch/hilbri/assist/model/provider/ModelItemProviderAdapterFactory.java
  10. +5 −0 ch.hilbri.assist.model.edit/src/ch/hilbri/assist/model/provider/SoftwareElementItemProvider.java
  11. +0 −23 ch.hilbri.assist.model.edit/src/ch/hilbri/assist/model/provider/TaskItemProvider.java
  12. +23 −22 ch.hilbri.assist.model/model/ASSIST-Model.xcore
  13. +49 −0 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/AssignedCoreProperty.java
  14. +9 −0 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/ModelFactory.java
  15. +189 −87 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/ModelPackage.java
  16. +16 −27 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/Task.java
  17. +156 −0 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/impl/AssignedCorePropertyImpl.java
  18. +12 −0 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/impl/ModelFactoryImpl.java
  19. +59 −12 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/impl/ModelPackageImpl.java
  20. +70 −60 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/impl/TaskImpl.java
  21. +19 −0 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/util/ModelAdapterFactory.java
  22. +23 −0 ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/util/ModelSwitch.java
  23. +131 −88 ch.hilbri.assist.scheduling.dsl/src/ch/hilbri/assist/scheduling/dsl/SchedulingDsl.xtext
  24. +2 −2 ch.hilbri.assist.scheduling/src/ch/hilbri/assist/scheduling/ui/multipageeditor/DetailedResults.java
Binary file not shown.
@@ -564,3 +564,5 @@ _UI_SystemNameProperty_type = System Name Property
_UI_MinHypPeriodLengthProperty_type = Min Hyp Period Length Property
_UI_TaskSwitchDelayProperty_type = Task Switch Delay Property
_UI_AssistModel_properties_feature = Properties
_UI_AssignedCoreProperty_type = Assigned Core Property
_UI_AssignedCoreProperty_value_feature = Value
@@ -0,0 +1,120 @@
/**
*/
package ch.hilbri.assist.model.provider;
import ch.hilbri.assist.model.ModelPackage;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
/**
* This is the item provider adapter for a {@link ch.hilbri.assist.model.AssignedCoreProperty} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class AssignedCorePropertyItemProvider extends PropertyItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AssignedCorePropertyItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addValuePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Value feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addValuePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AssignedCoreProperty_value_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_AssignedCoreProperty_value_feature", "_UI_AssignedCoreProperty_type"),
ModelPackage.Literals.ASSIGNED_CORE_PROPERTY__VALUE,
true,
false,
true,
null,
null,
null));
}
/**
* This returns AssignedCoreProperty.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/AssignedCoreProperty"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
return getString("_UI_AssignedCoreProperty_type");
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
}
@@ -320,6 +320,11 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
(ModelPackage.Literals.ASSIST_MODEL__PROPERTIES,
ModelFactory.eINSTANCE.createColorProperty()));
newChildDescriptors.add
(createChildParameter
(ModelPackage.Literals.ASSIST_MODEL__PROPERTIES,
ModelFactory.eINSTANCE.createAssignedCoreProperty()));
newChildDescriptors.add
(createChildParameter
(ModelPackage.Literals.ASSIST_MODEL__PROPERTIES,
@@ -360,6 +360,11 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
(ModelPackage.Literals.HARDWARE_ELEMENT__PROPERTIES,
ModelFactory.eINSTANCE.createColorProperty()));
newChildDescriptors.add
(createChildParameter
(ModelPackage.Literals.HARDWARE_ELEMENT__PROPERTIES,
ModelFactory.eINSTANCE.createAssignedCoreProperty()));
newChildDescriptors.add
(createChildParameter
(ModelPackage.Literals.HARDWARE_ELEMENT__PROPERTIES,
@@ -807,6 +807,29 @@ public Adapter createColorPropertyAdapter() {
return colorPropertyItemProvider;
}
/**
* This keeps track of the one adapter used for all {@link ch.hilbri.assist.model.AssignedCoreProperty} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssignedCorePropertyItemProvider assignedCorePropertyItemProvider;
/**
* This creates an adapter for a {@link ch.hilbri.assist.model.AssignedCoreProperty}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createAssignedCorePropertyAdapter() {
if (assignedCorePropertyItemProvider == null) {
assignedCorePropertyItemProvider = new AssignedCorePropertyItemProvider(this);
}
return assignedCorePropertyItemProvider;
}
/**
* This keeps track of the one adapter used for all {@link ch.hilbri.assist.model.CustomProperty} instances.
* <!-- begin-user-doc -->
@@ -1926,6 +1949,7 @@ public void dispose() {
if (criticalityLevelPropertyItemProvider != null) criticalityLevelPropertyItemProvider.dispose();
if (periodicityPropertyItemProvider != null) periodicityPropertyItemProvider.dispose();
if (colorPropertyItemProvider != null) colorPropertyItemProvider.dispose();
if (assignedCorePropertyItemProvider != null) assignedCorePropertyItemProvider.dispose();
if (customPropertyItemProvider != null) customPropertyItemProvider.dispose();
if (customIntPropertyItemProvider != null) customIntPropertyItemProvider.dispose();
if (customStringPropertyItemProvider != null) customStringPropertyItemProvider.dispose();
@@ -332,6 +332,11 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
(ModelPackage.Literals.SOFTWARE_ELEMENT__PROPERTIES,
ModelFactory.eINSTANCE.createColorProperty()));
newChildDescriptors.add
(createChildParameter
(ModelPackage.Literals.SOFTWARE_ELEMENT__PROPERTIES,
ModelFactory.eINSTANCE.createAssignedCoreProperty()));
newChildDescriptors.add
(createChildParameter
(ModelPackage.Literals.SOFTWARE_ELEMENT__PROPERTIES,
@@ -50,7 +50,6 @@ public TaskItemProvider(AdapterFactory adapterFactory) {
addApplicationPropertyDescriptor(object);
addRestrictMappingToHardwareElementsPropertyDescriptor(object);
addAssignedCorePropertyDescriptor(object);
addFullNamePropertyDescriptor(object);
}
return itemPropertyDescriptors;
@@ -122,28 +121,6 @@ protected void addRestrictMappingToHardwareElementsPropertyDescriptor(Object obj
null));
}
/**
* This adds a property descriptor for the Assigned Core feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addAssignedCorePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Task_assignedCore_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Task_assignedCore_feature", "_UI_Task_type"),
ModelPackage.Literals.TASK__ASSIGNED_CORE,
true,
false,
true,
null,
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
@@ -47,13 +47,14 @@ class MaxEndTimeProperty extends IntProperty {}
class AddInitTimeProperty extends IntProperty {}
class SlicesProperty extends IntProperty {}
class MinSliceDurationProperty extends IntProperty {}
class DesignAssuranceLevelProperty extends Property { DesignAssuranceLevelType value = "None" }
class CriticalityLevelProperty extends Property { DesignAssuranceLevelType value = "None" }
class PeriodicityProperty extends Property { PeriodicityType value = "strict" }
class ColorProperty extends Property { Color value = "none" }
class CustomProperty extends Property { String name = "" }
class CustomIntProperty extends CustomProperty { int value = "0" }
class CustomStringProperty extends CustomProperty { String value = "" }
class DesignAssuranceLevelProperty extends Property { DesignAssuranceLevelType value = "None" }
class CriticalityLevelProperty extends Property { DesignAssuranceLevelType value = "None" }
class PeriodicityProperty extends Property { PeriodicityType value = "strict" }
class ColorProperty extends Property { Color value = "none" }
class AssignedCoreProperty extends Property { refers Core[0..1] value }
class CustomProperty extends Property { String name = "" }
class CustomIntProperty extends CustomProperty { int value = "0" }
class CustomStringProperty extends CustomProperty { String value = "" }
class AssistModel {
contains Property[0..*] properties
@@ -478,24 +479,9 @@ class Application extends SoftwareElement {
}
class Task extends SoftwareElement {
// int duration = "-1"
// int period = "-1"
// int earlyTolerance = "-1"
// int lateTolerance = "-1"
// int maxStartTime = "-1"
// int Slices = "-1"
// int addInitTime = "-1"
// int slices = "-1"
// int minSliceDuration = "-1"
// PeriodicityType periodicity = "strict"
// Color color = "none"
container Application application opposite tasks
contains FeatureRequirement[0..*] featureRequirements
refers HardwareElement[0..*] restrictMappingToHardwareElements
refers Core[0..1] assignedCore
derived String fullName get { application.getName + "." + getName }
@@ -706,6 +692,21 @@ class Task extends SoftwareElement {
else
properties.add(ModelFactory.eINSTANCE.createColorProperty => [value = newValue])
}
// AssignedCore
op Core getAssignedCore() {
if (!properties.filter[it instanceof AssignedCoreProperty].isNullOrEmpty)
(properties.filter[it instanceof AssignedCoreProperty].head as AssignedCoreProperty).value
else
null
}
op void setAssignedCore(Core newValue) {
if (!properties.filter[it instanceof AssignedCoreProperty].isNullOrEmpty)
(properties.filter[it instanceof AssignedCoreProperty].head as AssignedCoreProperty).value = newValue
else
properties.add(ModelFactory.eINSTANCE.createAssignedCoreProperty => [value = newValue])
}
}
class FeatureRequirement {
@@ -0,0 +1,49 @@
/**
*/
package ch.hilbri.assist.model;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Assigned Core Property</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link ch.hilbri.assist.model.AssignedCoreProperty#getValue <em>Value</em>}</li>
* </ul>
*
* @see ch.hilbri.assist.model.ModelPackage#getAssignedCoreProperty()
* @model
* @generated
*/
public interface AssignedCoreProperty extends Property {
/**
* Returns the value of the '<em><b>Value</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Value</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Value</em>' reference.
* @see #setValue(Core)
* @see ch.hilbri.assist.model.ModelPackage#getAssignedCoreProperty_Value()
* @model
* @generated
*/
Core getValue();
/**
* Sets the value of the '{@link ch.hilbri.assist.model.AssignedCoreProperty#getValue <em>Value</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Value</em>' reference.
* @see #getValue()
* @generated
*/
void setValue(Core value);
} // AssignedCoreProperty
@@ -300,6 +300,15 @@
*/
ColorProperty createColorProperty();
/**
* Returns a new object of class '<em>Assigned Core Property</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Assigned Core Property</em>'.
* @generated
*/
AssignedCoreProperty createAssignedCoreProperty();
/**
* Returns a new object of class '<em>Custom Property</em>'.
* <!-- begin-user-doc -->
Oops, something went wrong.

0 comments on commit 0180f11

Please sign in to comment.