diff --git a/tdt4250.spp.html/src/tdt4250/spp/html/source/SampleSpp.xmi b/tdt4250.spp.html/src/tdt4250/spp/html/source/SampleSpp.xmi index 45d408b20a3b232ebcb00a4b760f92296f5284bc..b7203b751a92e4c1d8d1f6ed6405aa55722d8751 100644 --- a/tdt4250.spp.html/src/tdt4250/spp/html/source/SampleSpp.xmi +++ b/tdt4250.spp.html/src/tdt4250/spp/html/source/SampleSpp.xmi @@ -6,30 +6,6 @@ xmlns:spp="platform:/plugin/tdt4250.spp.model/model/spp.ecore" xsi:schemaLocation="platform:/plugin/tdt4250.spp.model/model/spp.ecore spp.ecore" name="NTNU"> - - - - - - - - - - @@ -41,38 +17,59 @@ selectedCourses="//@institutes.0/@courses.4 //@institutes.1/@courses.5 //@institutes.2/@courses.0 //@institutes.2/@courses.1 //@institutes.1/@courses.1"/> + selectedCourses="//@institutes.0/@courses.5 //@institutes.2/@courses.2 //@institutes.2/@courses.3 //@institutes.0/@courses.12 //@institutes.1/@courses.6"/> + selectedCourses="//@institutes.1/@courses.7 //@institutes.0/@courses.8 //@institutes.0/@courses.9 //@institutes.0/@courses.3"/> + selectedCourses="//@institutes.0/@courses.10 //@institutes.2/@courses.4 //@institutes.2/@courses.5 //@institutes.2/@courses.6 //@institutes.1/@courses.8"/> + selectedCourses="//@institutes.0/@courses.7 //@institutes.0/@courses.15 //@institutes.0/@courses.13 //@institutes.0/@courses.14"/> + selectedCourses="//@institutes.3/@courses.0 //@institutes.0/@courses.6 //@institutes.0/@courses.11 //@institutes.0/@courses.2 //@institutes.0/@courses.16 //@institutes.0/@courses.18 //@institutes.0/@courses.19 //@institutes.0/@courses.20 //@institutes.0/@courses.17"/> + selectedCourses="//@institutes.2/@courses.12 //@institutes.2/@courses.7 //@institutes.2/@courses.8 //@institutes.2/@courses.9"/> + selectedCourses="//@institutes.0/@courses.21 //@institutes.2/@courses.10 //@institutes.2/@courses.11"/> - + selectedCourses="//@institutes.0/@courses.22"/> + courses="//@institutes.0/@courses.0 //@institutes.1/@courses.0 //@institutes.1/@courses.1 //@institutes.1/@courses.4 //@institutes.1/@courses.3 //@institutes.1/@courses.5 //@institutes.2/@courses.0 //@institutes.2/@courses.2 //@institutes.2/@courses.7 //@institutes.2/@courses.1 //@institutes.2/@courses.3 //@institutes.2/@courses.4 //@institutes.0/@courses.4 //@institutes.1/@courses.6 //@institutes.0/@courses.5 //@institutes.0/@courses.12 //@institutes.1/@courses.7 //@institutes.2/@courses.5 //@institutes.2/@courses.6 //@institutes.2/@courses.8 //@institutes.2/@courses.9 //@institutes.1/@courses.8 //@institutes.0/@courses.10 //@institutes.3/@courses.0 //@institutes.0/@courses.22 //@institutes.2/@courses.12"/> + courses="//@institutes.0/@courses.21 //@institutes.2/@courses.10 //@institutes.2/@courses.11 //@institutes.0/@courses.1 //@institutes.0/@courses.13 //@institutes.0/@courses.14 //@institutes.0/@courses.18 //@institutes.0/@courses.19 //@institutes.0/@courses.2 //@institutes.0/@courses.16 //@institutes.0/@courses.20 //@institutes.0/@courses.15"/> + + + + + + + + + + @@ -116,10 +113,6 @@ name="Operativssystemer" credits="7.5" level="ThirdYearCourse"/> - - - - + + + + + @@ -292,11 +300,6 @@ name="Pedagogikk" credits="15.0" season="Spring"/> - Choose program: -
-

Bachelor in IT

Bachelor in IT is taken over 6 semesters.

- -

Semester 1

- - - - - - - - - - - - - - - - - - - -
CodeNameCreditsLevel
TDT4110Informasjonsteknologi, grunnkurs7.5FoundationCourse
IT2805Webteknologi7.5FoundationCourse
- - -

Semester 2

- - - - - - - - - - - - - - - - - - - -
CodeNameCreditsLevel
TDT4100Objektorientert programmering7.5FoundationCourse
MA1103Flerdimensjonal analyse7.5FoundationCourse
- - -

Semester 3

- - - - - - - - - - - - - - - - - - - -
CodeNameCreditsLevel
TDT4120Algoritmer og datastrukturer7.5IntermediateCourse
TMA4135Matematikk 4D7.5ThirdYearCourse
- - -

Semester 4

- - - - - - - -
CodeNameCreditsLevel
- - -

Semester 5

- - - - - - - -
CodeNameCreditsLevel
- - -

Semester 6

- - - - - - - -
CodeNameCreditsLevel
- - -

Lektor i Realfag

Lektor i Realfag is taken over 10 semesters.

@@ -440,12 +333,6 @@ 15.0 FoundationCourse - - PPU4614 - PPU4625 - 0.0 - SecoundDegreeCourse - PPU4625 Fagdidaktikk 2 - informatikk @@ -507,6 +394,55 @@ +
+
+

Master i informatikk

Master i informatikk is taken over 4 semesters.

+ +

Semester 1

+ + + + + + + +
CodeNameCreditsLevel
+ + +

Semester 2

+ + + + + + + +
CodeNameCreditsLevel
+ + +

Semester 3

+ + + + + + + +
CodeNameCreditsLevel
+ + +

Semester 4

+ + + + + + + +
CodeNameCreditsLevel
+ +
diff --git a/tdt4250.spp.model.edit/plugin.properties b/tdt4250.spp.model.edit/plugin.properties index d43a2f56fc6b738a8555730632a6577ea22d3a2b..2978e9d7084525853acee73fefdee6994db77d0b 100644 --- a/tdt4250.spp.model.edit/plugin.properties +++ b/tdt4250.spp.model.edit/plugin.properties @@ -66,3 +66,5 @@ _UI_CourseLevelType_IntermediateCourse_literal = IntermediateCourse _UI_CourseLevelType_ThirdYearCourse_literal = ThirdYearCourse _UI_CourseLevelType_SecoundDegreeCourse_literal = SecoundDegreeCourse _UI_Semester_semester_feature = Semester +_UI_Specialisation_mandatoryCourses_feature = Mandatory Courses +_UI_Specialisation_electiveCourses_feature = Elective Courses diff --git a/tdt4250.spp.model.edit/src/tdt4250/spp/provider/SpecialisationItemProvider.java b/tdt4250.spp.model.edit/src/tdt4250/spp/provider/SpecialisationItemProvider.java index 2f949115ec0149ff9cfbcd4b5260fed7d755211b..f202d793e8e378fa6c85fefb326788c379cc44eb 100644 --- a/tdt4250.spp.model.edit/src/tdt4250/spp/provider/SpecialisationItemProvider.java +++ b/tdt4250.spp.model.edit/src/tdt4250/spp/provider/SpecialisationItemProvider.java @@ -61,6 +61,8 @@ public class SpecialisationItemProvider super.getPropertyDescriptors(object); addNamePropertyDescriptor(object); + addMandatoryCoursesPropertyDescriptor(object); + addElectiveCoursesPropertyDescriptor(object); } return itemPropertyDescriptors; } @@ -87,6 +89,50 @@ public class SpecialisationItemProvider null)); } + /** + * This adds a property descriptor for the Mandatory Courses feature. + * + * + * @generated + */ + protected void addMandatoryCoursesPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Specialisation_mandatoryCourses_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Specialisation_mandatoryCourses_feature", "_UI_Specialisation_type"), + SppPackage.Literals.SPECIALISATION__MANDATORY_COURSES, + true, + false, + true, + null, + null, + null)); + } + + /** + * This adds a property descriptor for the Elective Courses feature. + * + * + * @generated + */ + protected void addElectiveCoursesPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Specialisation_electiveCourses_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Specialisation_electiveCourses_feature", "_UI_Specialisation_type"), + SppPackage.Literals.SPECIALISATION__ELECTIVE_COURSES, + true, + false, + true, + null, + null, + null)); + } + /** * This returns Specialisation.gif. * diff --git a/tdt4250.spp.model/src/tdt4250/spp/Course.java b/tdt4250.spp.model/src/tdt4250/spp/Course.java index 5afb4b1907967aaafd37c509f34f62f91e3b296f..b5880b7f8d69176e950d82264cdfc27032c723f6 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/Course.java +++ b/tdt4250.spp.model/src/tdt4250/spp/Course.java @@ -22,7 +22,8 @@ import org.eclipse.emf.ecore.EObject; * * * @see tdt4250.spp.SppPackage#getCourse() - * @model + * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='courseCodeNeedsToBeUnique'" + * annotation="http://www.eclipse.org/acceleo/query/1.0 courseCodeNeedsToBeUnique='self.eContainer().eContainer().institutes.courses.code -> select(i: String | i = self.code) -> size() < 2'" * @generated */ public interface Course extends EObject { diff --git a/tdt4250.spp.model/src/tdt4250/spp/Program.java b/tdt4250.spp.model/src/tdt4250/spp/Program.java index 827fac4ce9fd2cd6d6bdea2cc82e39e511c7397a..8a675f344237184ec147b56268eb01a050562c31 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/Program.java +++ b/tdt4250.spp.model/src/tdt4250/spp/Program.java @@ -91,28 +91,18 @@ public interface Program extends EObject { EList getSemesters(); /** - * Returns the value of the 'Specialisation' containment reference. + * Returns the value of the 'Specialisation' containment reference list. + * The list contents are of type {@link tdt4250.spp.Specialisation}. * It is bidirectional and its opposite is '{@link tdt4250.spp.Specialisation#getProgram Program}'. * * - * @return the value of the 'Specialisation' containment reference. - * @see #setSpecialisation(Specialisation) + * @return the value of the 'Specialisation' containment reference list. * @see tdt4250.spp.SppPackage#getProgram_Specialisation() * @see tdt4250.spp.Specialisation#getProgram - * @model opposite="program" containment="true" - * @generated - */ - Specialisation getSpecialisation(); - - /** - * Sets the value of the '{@link tdt4250.spp.Program#getSpecialisation Specialisation}' containment reference. - * - * - * @param value the new value of the 'Specialisation' containment reference. - * @see #getSpecialisation() + * @model opposite="program" containment="true" upper="20" * @generated */ - void setSpecialisation(Specialisation value); + EList getSpecialisation(); /** * Returns the value of the 'Mandatory Courses' containment reference list. diff --git a/tdt4250.spp.model/src/tdt4250/spp/Specialisation.java b/tdt4250.spp.model/src/tdt4250/spp/Specialisation.java index 0c76de0155882bd495a3730ca988393fe9fc9f88..651266f7ee29502fb653890da7c3b23fbaea1bfc 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/Specialisation.java +++ b/tdt4250.spp.model/src/tdt4250/spp/Specialisation.java @@ -2,6 +2,7 @@ */ package tdt4250.spp; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; /** @@ -15,6 +16,8 @@ import org.eclipse.emf.ecore.EObject; *
    *
  • {@link tdt4250.spp.Specialisation#getName Name}
  • *
  • {@link tdt4250.spp.Specialisation#getProgram Program}
  • + *
  • {@link tdt4250.spp.Specialisation#getMandatoryCourses Mandatory Courses}
  • + *
  • {@link tdt4250.spp.Specialisation#getElectiveCourses Elective Courses}
  • *
* * @see tdt4250.spp.SppPackage#getSpecialisation() @@ -68,4 +71,28 @@ public interface Specialisation extends EObject { */ void setProgram(Program value); + /** + * Returns the value of the 'Mandatory Courses' reference list. + * The list contents are of type {@link tdt4250.spp.Course}. + * + * + * @return the value of the 'Mandatory Courses' reference list. + * @see tdt4250.spp.SppPackage#getSpecialisation_MandatoryCourses() + * @model + * @generated + */ + EList getMandatoryCourses(); + + /** + * Returns the value of the 'Elective Courses' reference list. + * The list contents are of type {@link tdt4250.spp.Course}. + * + * + * @return the value of the 'Elective Courses' reference list. + * @see tdt4250.spp.SppPackage#getSpecialisation_ElectiveCourses() + * @model + * @generated + */ + EList getElectiveCourses(); + } // Specialisation diff --git a/tdt4250.spp.model/src/tdt4250/spp/SppPackage.java b/tdt4250.spp.model/src/tdt4250/spp/SppPackage.java index a2a819f2ac4dceb426b3888437528a76e681e570..233366381a4a71ef6aee274e628f7ea56b3bf0cd 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/SppPackage.java +++ b/tdt4250.spp.model/src/tdt4250/spp/SppPackage.java @@ -208,7 +208,7 @@ public interface SppPackage extends EPackage { int PROGRAM__SEMESTERS = 2; /** - * The feature id for the 'Specialisation' containment reference. + * The feature id for the 'Specialisation' containment reference list. * * * @generated @@ -453,6 +453,24 @@ public interface SppPackage extends EPackage { */ int SPECIALISATION__PROGRAM = 1; + /** + * The feature id for the 'Mandatory Courses' reference list. + * + * + * @generated + * @ordered + */ + int SPECIALISATION__MANDATORY_COURSES = 2; + + /** + * The feature id for the 'Elective Courses' reference list. + * + * + * @generated + * @ordered + */ + int SPECIALISATION__ELECTIVE_COURSES = 3; + /** * The number of structural features of the 'Specialisation' class. * @@ -460,7 +478,7 @@ public interface SppPackage extends EPackage { * @generated * @ordered */ - int SPECIALISATION_FEATURE_COUNT = 2; + int SPECIALISATION_FEATURE_COUNT = 4; /** * The number of operations of the 'Specialisation' class. @@ -735,10 +753,10 @@ public interface SppPackage extends EPackage { EReference getProgram_Semesters(); /** - * Returns the meta object for the containment reference '{@link tdt4250.spp.Program#getSpecialisation Specialisation}'. + * Returns the meta object for the containment reference list '{@link tdt4250.spp.Program#getSpecialisation Specialisation}'. * * - * @return the meta object for the containment reference 'Specialisation'. + * @return the meta object for the containment reference list 'Specialisation'. * @see tdt4250.spp.Program#getSpecialisation() * @see #getProgram() * @generated @@ -960,6 +978,28 @@ public interface SppPackage extends EPackage { */ EReference getSpecialisation_Program(); + /** + * Returns the meta object for the reference list '{@link tdt4250.spp.Specialisation#getMandatoryCourses Mandatory Courses}'. + * + * + * @return the meta object for the reference list 'Mandatory Courses'. + * @see tdt4250.spp.Specialisation#getMandatoryCourses() + * @see #getSpecialisation() + * @generated + */ + EReference getSpecialisation_MandatoryCourses(); + + /** + * Returns the meta object for the reference list '{@link tdt4250.spp.Specialisation#getElectiveCourses Elective Courses}'. + * + * + * @return the meta object for the reference list 'Elective Courses'. + * @see tdt4250.spp.Specialisation#getElectiveCourses() + * @see #getSpecialisation() + * @generated + */ + EReference getSpecialisation_ElectiveCourses(); + /** * Returns the meta object for class '{@link tdt4250.spp.MandatoryCourses Mandatory Courses}'. * @@ -1191,7 +1231,7 @@ public interface SppPackage extends EPackage { EReference PROGRAM__SEMESTERS = eINSTANCE.getProgram_Semesters(); /** - * The meta object literal for the 'Specialisation' containment reference feature. + * The meta object literal for the 'Specialisation' containment reference list feature. * * * @generated @@ -1364,6 +1404,22 @@ public interface SppPackage extends EPackage { */ EReference SPECIALISATION__PROGRAM = eINSTANCE.getSpecialisation_Program(); + /** + * The meta object literal for the 'Mandatory Courses' reference list feature. + * + * + * @generated + */ + EReference SPECIALISATION__MANDATORY_COURSES = eINSTANCE.getSpecialisation_MandatoryCourses(); + + /** + * The meta object literal for the 'Elective Courses' reference list feature. + * + * + * @generated + */ + EReference SPECIALISATION__ELECTIVE_COURSES = eINSTANCE.getSpecialisation_ElectiveCourses(); + /** * The meta object literal for the '{@link tdt4250.spp.impl.MandatoryCoursesImpl Mandatory Courses}' class. * diff --git a/tdt4250.spp.model/src/tdt4250/spp/impl/ProgramImpl.java b/tdt4250.spp.model/src/tdt4250/spp/impl/ProgramImpl.java index 62d2b4225514266b2c4c7fda390557f2460177ec..735e7c655b1c0ad9df3d3a97bf5f632df27dae03 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/impl/ProgramImpl.java +++ b/tdt4250.spp.model/src/tdt4250/spp/impl/ProgramImpl.java @@ -98,14 +98,14 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program protected EList semesters; /** - * The cached value of the '{@link #getSpecialisation() Specialisation}' containment reference. + * The cached value of the '{@link #getSpecialisation() Specialisation}' containment reference list. * * * @see #getSpecialisation() * @generated * @ordered */ - protected Specialisation specialisation; + protected EList specialisation; /** * The cached value of the '{@link #getMandatoryCourses() Mandatory Courses}' containment reference list. @@ -221,43 +221,11 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program * @generated */ @Override - public Specialisation getSpecialisation() { - return specialisation; - } - - /** - * - * - * @generated - */ - public NotificationChain basicSetSpecialisation(Specialisation newSpecialisation, NotificationChain msgs) { - Specialisation oldSpecialisation = specialisation; - specialisation = newSpecialisation; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SppPackage.PROGRAM__SPECIALISATION, oldSpecialisation, newSpecialisation); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * - * - * @generated - */ - @Override - public void setSpecialisation(Specialisation newSpecialisation) { - if (newSpecialisation != specialisation) { - NotificationChain msgs = null; - if (specialisation != null) - msgs = ((InternalEObject)specialisation).eInverseRemove(this, SppPackage.SPECIALISATION__PROGRAM, Specialisation.class, msgs); - if (newSpecialisation != null) - msgs = ((InternalEObject)newSpecialisation).eInverseAdd(this, SppPackage.SPECIALISATION__PROGRAM, Specialisation.class, msgs); - msgs = basicSetSpecialisation(newSpecialisation, msgs); - if (msgs != null) msgs.dispatch(); + public EList getSpecialisation() { + if (specialisation == null) { + specialisation = new EObjectContainmentWithInverseEList(Specialisation.class, this, SppPackage.PROGRAM__SPECIALISATION, SppPackage.SPECIALISATION__PROGRAM); } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SppPackage.PROGRAM__SPECIALISATION, newSpecialisation, newSpecialisation)); + return specialisation; } /** @@ -324,9 +292,7 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program case SppPackage.PROGRAM__SEMESTERS: return ((InternalEList)(InternalEList)getSemesters()).basicAdd(otherEnd, msgs); case SppPackage.PROGRAM__SPECIALISATION: - if (specialisation != null) - msgs = ((InternalEObject)specialisation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SppPackage.PROGRAM__SPECIALISATION, null, msgs); - return basicSetSpecialisation((Specialisation)otherEnd, msgs); + return ((InternalEList)(InternalEList)getSpecialisation()).basicAdd(otherEnd, msgs); case SppPackage.PROGRAM__MANDATORY_COURSES: return ((InternalEList)(InternalEList)getMandatoryCourses()).basicAdd(otherEnd, msgs); case SppPackage.PROGRAM__ELECTIVE_COURSES: @@ -346,7 +312,7 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program case SppPackage.PROGRAM__SEMESTERS: return ((InternalEList)getSemesters()).basicRemove(otherEnd, msgs); case SppPackage.PROGRAM__SPECIALISATION: - return basicSetSpecialisation(null, msgs); + return ((InternalEList)getSpecialisation()).basicRemove(otherEnd, msgs); case SppPackage.PROGRAM__MANDATORY_COURSES: return ((InternalEList)getMandatoryCourses()).basicRemove(otherEnd, msgs); case SppPackage.PROGRAM__ELECTIVE_COURSES: @@ -401,7 +367,8 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program getSemesters().addAll((Collection)newValue); return; case SppPackage.PROGRAM__SPECIALISATION: - setSpecialisation((Specialisation)newValue); + getSpecialisation().clear(); + getSpecialisation().addAll((Collection)newValue); return; case SppPackage.PROGRAM__MANDATORY_COURSES: getMandatoryCourses().clear(); @@ -433,7 +400,7 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program getSemesters().clear(); return; case SppPackage.PROGRAM__SPECIALISATION: - setSpecialisation((Specialisation)null); + getSpecialisation().clear(); return; case SppPackage.PROGRAM__MANDATORY_COURSES: getMandatoryCourses().clear(); @@ -460,7 +427,7 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program case SppPackage.PROGRAM__SEMESTERS: return semesters != null && !semesters.isEmpty(); case SppPackage.PROGRAM__SPECIALISATION: - return specialisation != null; + return specialisation != null && !specialisation.isEmpty(); case SppPackage.PROGRAM__MANDATORY_COURSES: return mandatoryCourses != null && !mandatoryCourses.isEmpty(); case SppPackage.PROGRAM__ELECTIVE_COURSES: diff --git a/tdt4250.spp.model/src/tdt4250/spp/impl/SpecialisationImpl.java b/tdt4250.spp.model/src/tdt4250/spp/impl/SpecialisationImpl.java index 44e5fb36aa5cb26324a782ab85b4f14a388e40ed..8fa31170d69678af6d2242c70a9b22852de0882f 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/impl/SpecialisationImpl.java +++ b/tdt4250.spp.model/src/tdt4250/spp/impl/SpecialisationImpl.java @@ -2,17 +2,21 @@ */ package tdt4250.spp.impl; +import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.eclipse.emf.ecore.util.EcoreUtil; +import tdt4250.spp.Course; import tdt4250.spp.Program; import tdt4250.spp.Specialisation; import tdt4250.spp.SppPackage; @@ -27,6 +31,8 @@ import tdt4250.spp.SppPackage; *
    *
  • {@link tdt4250.spp.impl.SpecialisationImpl#getName Name}
  • *
  • {@link tdt4250.spp.impl.SpecialisationImpl#getProgram Program}
  • + *
  • {@link tdt4250.spp.impl.SpecialisationImpl#getMandatoryCourses Mandatory Courses}
  • + *
  • {@link tdt4250.spp.impl.SpecialisationImpl#getElectiveCourses Elective Courses}
  • *
* * @generated @@ -52,6 +58,26 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements */ protected String name = NAME_EDEFAULT; + /** + * The cached value of the '{@link #getMandatoryCourses() Mandatory Courses}' reference list. + * + * + * @see #getMandatoryCourses() + * @generated + * @ordered + */ + protected EList mandatoryCourses; + + /** + * The cached value of the '{@link #getElectiveCourses() Elective Courses}' reference list. + * + * + * @see #getElectiveCourses() + * @generated + * @ordered + */ + protected EList electiveCourses; + /** * * @@ -137,6 +163,32 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements eNotify(new ENotificationImpl(this, Notification.SET, SppPackage.SPECIALISATION__PROGRAM, newProgram, newProgram)); } + /** + * + * + * @generated + */ + @Override + public EList getMandatoryCourses() { + if (mandatoryCourses == null) { + mandatoryCourses = new EObjectResolvingEList(Course.class, this, SppPackage.SPECIALISATION__MANDATORY_COURSES); + } + return mandatoryCourses; + } + + /** + * + * + * @generated + */ + @Override + public EList getElectiveCourses() { + if (electiveCourses == null) { + electiveCourses = new EObjectResolvingEList(Course.class, this, SppPackage.SPECIALISATION__ELECTIVE_COURSES); + } + return electiveCourses; + } + /** * * @@ -193,6 +245,10 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements return getName(); case SppPackage.SPECIALISATION__PROGRAM: return getProgram(); + case SppPackage.SPECIALISATION__MANDATORY_COURSES: + return getMandatoryCourses(); + case SppPackage.SPECIALISATION__ELECTIVE_COURSES: + return getElectiveCourses(); } return super.eGet(featureID, resolve, coreType); } @@ -202,6 +258,7 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -211,6 +268,14 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements case SppPackage.SPECIALISATION__PROGRAM: setProgram((Program)newValue); return; + case SppPackage.SPECIALISATION__MANDATORY_COURSES: + getMandatoryCourses().clear(); + getMandatoryCourses().addAll((Collection)newValue); + return; + case SppPackage.SPECIALISATION__ELECTIVE_COURSES: + getElectiveCourses().clear(); + getElectiveCourses().addAll((Collection)newValue); + return; } super.eSet(featureID, newValue); } @@ -229,6 +294,12 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements case SppPackage.SPECIALISATION__PROGRAM: setProgram((Program)null); return; + case SppPackage.SPECIALISATION__MANDATORY_COURSES: + getMandatoryCourses().clear(); + return; + case SppPackage.SPECIALISATION__ELECTIVE_COURSES: + getElectiveCourses().clear(); + return; } super.eUnset(featureID); } @@ -245,6 +316,10 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case SppPackage.SPECIALISATION__PROGRAM: return getProgram() != null; + case SppPackage.SPECIALISATION__MANDATORY_COURSES: + return mandatoryCourses != null && !mandatoryCourses.isEmpty(); + case SppPackage.SPECIALISATION__ELECTIVE_COURSES: + return electiveCourses != null && !electiveCourses.isEmpty(); } return super.eIsSet(featureID); } diff --git a/tdt4250.spp.model/src/tdt4250/spp/impl/SppPackageImpl.java b/tdt4250.spp.model/src/tdt4250/spp/impl/SppPackageImpl.java index 96ea896bda55de617787338fc5f65a76713e181f..a66b0955f1cac42c2a1a2032355f6cf77458213d 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/impl/SppPackageImpl.java +++ b/tdt4250.spp.model/src/tdt4250/spp/impl/SppPackageImpl.java @@ -520,6 +520,26 @@ public class SppPackageImpl extends EPackageImpl implements SppPackage { return (EReference)specialisationEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EReference getSpecialisation_MandatoryCourses() { + return (EReference)specialisationEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EReference getSpecialisation_ElectiveCourses() { + return (EReference)specialisationEClass.getEStructuralFeatures().get(3); + } + /** * * @@ -687,6 +707,8 @@ public class SppPackageImpl extends EPackageImpl implements SppPackage { specialisationEClass = createEClass(SPECIALISATION); createEAttribute(specialisationEClass, SPECIALISATION__NAME); createEReference(specialisationEClass, SPECIALISATION__PROGRAM); + createEReference(specialisationEClass, SPECIALISATION__MANDATORY_COURSES); + createEReference(specialisationEClass, SPECIALISATION__ELECTIVE_COURSES); mandatoryCoursesEClass = createEClass(MANDATORY_COURSES); createEReference(mandatoryCoursesEClass, MANDATORY_COURSES__PROGRAM); @@ -749,7 +771,7 @@ public class SppPackageImpl extends EPackageImpl implements SppPackage { initEAttribute(getProgram_Name(), ecorePackage.getEString(), "name", null, 0, 1, Program.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getProgram_Duration(), this.getLevelType(), "duration", null, 0, 1, Program.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getProgram_Semesters(), this.getSemester(), this.getSemester_Program(), "semesters", null, 0, -1, Program.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getProgram_Specialisation(), this.getSpecialisation(), this.getSpecialisation_Program(), "specialisation", null, 0, 1, Program.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getProgram_Specialisation(), this.getSpecialisation(), this.getSpecialisation_Program(), "specialisation", null, 0, 20, Program.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getProgram_MandatoryCourses(), this.getMandatoryCourses(), this.getMandatoryCourses_Program(), "mandatoryCourses", null, 0, -1, Program.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getProgram_ElectiveCourses(), this.getElectiveCourses(), this.getElectiveCourses_Program(), "electiveCourses", null, 0, -1, Program.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getProgram_NumberOfSemesters(), ecorePackage.getEInt(), "numberOfSemesters", null, 0, 1, Program.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); @@ -775,6 +797,8 @@ public class SppPackageImpl extends EPackageImpl implements SppPackage { initEClass(specialisationEClass, Specialisation.class, "Specialisation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getSpecialisation_Name(), ecorePackage.getEString(), "name", null, 0, 1, Specialisation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getSpecialisation_Program(), this.getProgram(), this.getProgram_Specialisation(), "program", null, 0, 1, Specialisation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSpecialisation_MandatoryCourses(), this.getCourse(), null, "mandatoryCourses", null, 0, -1, Specialisation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSpecialisation_ElectiveCourses(), this.getCourse(), null, "electiveCourses", null, 0, -1, Specialisation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(mandatoryCoursesEClass, MandatoryCourses.class, "MandatoryCourses", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getMandatoryCourses_Program(), this.getProgram(), this.getProgram_MandatoryCourses(), "program", null, 0, 1, MandatoryCourses.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -840,6 +864,12 @@ public class SppPackageImpl extends EPackageImpl implements SppPackage { new String[] { "constraints", "needsEnoughCredits coursesNeedsToBeMandatoryOrElectiveCourses" }); + addAnnotation + (courseEClass, + source, + new String[] { + "constraints", "courseCodeNeedsToBeUnique" + }); addAnnotation (mandatoryCoursesEClass, source, @@ -862,6 +892,12 @@ public class SppPackageImpl extends EPackageImpl implements SppPackage { new String[] { "coursesNeedsToBeMandatoryOrElectiveCourses", "((self.selectedCourses->intersection(self.eContainer().mandatoryCourses.courses))->notEmpty() or (self.selectedCourses->intersection(self.eContainer().electiveCourses.courses))->notEmpty()) or self.selectedCourses -> isEmpty()" }); + addAnnotation + (courseEClass, + source, + new String[] { + "courseCodeNeedsToBeUnique", "self.eContainer().eContainer().institutes.courses.code -> select(i: String | i = self.code) -> size() < 2" + }); addAnnotation (mandatoryCoursesEClass, source, diff --git a/tdt4250.spp.model/src/tdt4250/spp/util/SppValidator.java b/tdt4250.spp.model/src/tdt4250/spp/util/SppValidator.java index 866bd046a09ba95bce2d233f89a13f94761f4dac..60105d9e2ff7da6dea1ed990a5dd41d4f2e113b3 100644 --- a/tdt4250.spp.model/src/tdt4250/spp/util/SppValidator.java +++ b/tdt4250.spp.model/src/tdt4250/spp/util/SppValidator.java @@ -294,7 +294,46 @@ public class SppValidator extends EObjectValidator { * @generated */ public boolean validateCourse(Course course, DiagnosticChain diagnostics, Map context) { - return validate_EveryDefaultConstraint(course, diagnostics, context); + if (!validate_NoCircularContainment(course, diagnostics, context)) return false; + boolean result = validate_EveryMultiplicityConforms(course, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryDataValueConforms(course, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(course, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(course, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryProxyResolves(course, diagnostics, context); + if (result || diagnostics != null) result &= validate_UniqueID(course, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryKeyUnique(course, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(course, diagnostics, context); + if (result || diagnostics != null) result &= validateCourse_courseCodeNeedsToBeUnique(course, diagnostics, context); + return result; + } + + /** + * The cached validation expression for the courseCodeNeedsToBeUnique constraint of 'Course'. + * + * + * @generated + */ + protected static final String COURSE__COURSE_CODE_NEEDS_TO_BE_UNIQUE__EEXPRESSION = "self.eContainer().eContainer().institutes.courses.code -> select(i: String | i = self.code) -> size() < 2"; + + /** + * Validates the courseCodeNeedsToBeUnique constraint of 'Course'. + * + * + * @generated + */ + public boolean validateCourse_courseCodeNeedsToBeUnique(Course course, DiagnosticChain diagnostics, Map context) { + return + validate + (SppPackage.Literals.COURSE, + course, + diagnostics, + context, + "http://www.eclipse.org/acceleo/query/1.0", + "courseCodeNeedsToBeUnique", + COURSE__COURSE_CODE_NEEDS_TO_BE_UNIQUE__EEXPRESSION, + Diagnostic.ERROR, + DIAGNOSTIC_SOURCE, + 0); } /**