From d94f6fac2f589d38b8c7957a2de69e46ab158bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85dne=20Karstad?= <aadneka@stud.ntnu.no> Date: Fri, 9 Oct 2020 13:59:59 +0200 Subject: [PATCH] refactor(sample.xmi): change sample to newer examples --- .../src/tdt4250/spp/html/source/SampleSpp.xmi | 121 ++++++------- .../src/tdt4250/spp/html/target/NTNU.html | 164 ++++++------------ tdt4250.spp.model.edit/plugin.properties | 2 + .../provider/SpecialisationItemProvider.java | 46 +++++ tdt4250.spp.model/src/tdt4250/spp/Course.java | 3 +- .../src/tdt4250/spp/Program.java | 20 +-- .../src/tdt4250/spp/Specialisation.java | 27 +++ .../src/tdt4250/spp/SppPackage.java | 66 ++++++- .../src/tdt4250/spp/impl/ProgramImpl.java | 57 ++---- .../tdt4250/spp/impl/SpecialisationImpl.java | 75 ++++++++ .../src/tdt4250/spp/impl/SppPackageImpl.java | 38 +++- .../src/tdt4250/spp/util/SppValidator.java | 41 ++++- 12 files changed, 419 insertions(+), 241 deletions(-) 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 45d408b..b7203b7 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"> - <programs - name="Bachelor in IT"> - <semesters - selectedCourses="//@institutes.0/@courses.0 //@institutes.0/@courses.12"/> - <semesters - semester="2" - season="Spring" - selectedCourses="//@institutes.0/@courses.4 //@institutes.1/@courses.5"/> - <semesters - semester="3" - selectedCourses="//@institutes.0/@courses.5 //@institutes.1/@courses.2"/> - <semesters - semester="4" - season="Spring"/> - <semesters - semester="5"/> - <semesters - semester="6" - season="Spring"/> - <mandatoryCourses - courses="//@institutes.0/@courses.0 //@institutes.0/@courses.3 //@institutes.0/@courses.4 //@institutes.0/@courses.5 //@institutes.0/@courses.12"/> - <electiveCourses - courses="//@institutes.0/@courses.1 //@institutes.0/@courses.2 //@institutes.0/@courses.6 //@institutes.1/@courses.3 //@institutes.1/@courses.4 //@institutes.1/@courses.5"/> - </programs> <programs name="Lektor i Realfag" duration="IntegratedMasters"> @@ -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"/> <semesters semester="3" - selectedCourses="//@institutes.0/@courses.5 //@institutes.2/@courses.2 //@institutes.2/@courses.3 //@institutes.0/@courses.13 //@institutes.1/@courses.6"/> + selectedCourses="//@institutes.0/@courses.5 //@institutes.2/@courses.2 //@institutes.2/@courses.3 //@institutes.0/@courses.12 //@institutes.1/@courses.6"/> <semesters semester="4" season="Spring" - selectedCourses="//@institutes.1/@courses.7 //@institutes.0/@courses.9 //@institutes.0/@courses.10 //@institutes.0/@courses.3"/> + selectedCourses="//@institutes.1/@courses.7 //@institutes.0/@courses.8 //@institutes.0/@courses.9 //@institutes.0/@courses.3"/> <semesters semester="5" - selectedCourses="//@institutes.0/@courses.11 //@institutes.2/@courses.4 //@institutes.2/@courses.5 //@institutes.2/@courses.6 //@institutes.1/@courses.8"/> + selectedCourses="//@institutes.0/@courses.10 //@institutes.2/@courses.4 //@institutes.2/@courses.5 //@institutes.2/@courses.6 //@institutes.1/@courses.8"/> <semesters semester="6" season="Spring" - selectedCourses="//@institutes.0/@courses.7 //@institutes.0/@courses.16 //@institutes.0/@courses.14 //@institutes.0/@courses.15"/> + selectedCourses="//@institutes.0/@courses.7 //@institutes.0/@courses.15 //@institutes.0/@courses.13 //@institutes.0/@courses.14"/> <semesters semester="7" - selectedCourses="//@institutes.3/@courses.0 //@institutes.0/@courses.6 //@institutes.0/@courses.12 //@institutes.0/@courses.2 //@institutes.0/@courses.19 //@institutes.0/@courses.21 //@institutes.0/@courses.23 //@institutes.0/@courses.24 //@institutes.0/@courses.20"/> + 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"/> <semesters semester="8" season="Spring" - selectedCourses="//@institutes.2/@courses.13 //@institutes.2/@courses.7 //@institutes.2/@courses.8 //@institutes.2/@courses.9 //@institutes.2/@courses.10"/> + selectedCourses="//@institutes.2/@courses.12 //@institutes.2/@courses.7 //@institutes.2/@courses.8 //@institutes.2/@courses.9"/> <semesters semester="9" - selectedCourses="//@institutes.0/@courses.25 //@institutes.2/@courses.11 //@institutes.2/@courses.12"/> + selectedCourses="//@institutes.0/@courses.21 //@institutes.2/@courses.10 //@institutes.2/@courses.11"/> <semesters semester="10" season="Spring" - selectedCourses="//@institutes.0/@courses.26"/> - <specialisation - name="Matematikk og Informatikk"/> + selectedCourses="//@institutes.0/@courses.22"/> <mandatoryCourses - 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.13 //@institutes.1/@courses.7 //@institutes.2/@courses.5 //@institutes.2/@courses.6 //@institutes.2/@courses.9 //@institutes.2/@courses.10 //@institutes.1/@courses.8 //@institutes.0/@courses.11 //@institutes.3/@courses.0 //@institutes.0/@courses.26 //@institutes.2/@courses.13"/> + 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"/> <electiveCourses - courses="//@institutes.0/@courses.25 //@institutes.2/@courses.11 //@institutes.2/@courses.12 //@institutes.0/@courses.17 //@institutes.0/@courses.18 //@institutes.0/@courses.1 //@institutes.0/@courses.14 //@institutes.0/@courses.15 //@institutes.0/@courses.21 //@institutes.0/@courses.23 //@institutes.0/@courses.2 //@institutes.0/@courses.19 //@institutes.0/@courses.24 //@institutes.0/@courses.16"/> + 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"/> + </programs> + <programs + name="Master i informatikk" + duration="Master"> + <semesters/> + <semesters + semester="2" + season="Spring"/> + <semesters + semester="3"/> + <semesters + semester="4" + season="Spring"/> + <specialisation + name="Software" + mandatoryCourses="//@institutes.0/@courses.2 //@institutes.0/@courses.23 //@institutes.0/@courses.13 //@institutes.0/@courses.24"/> + <specialisation + name="Interaction Design, Game and Learning Technology" + mandatoryCourses="//@institutes.0/@courses.27 //@institutes.0/@courses.23 //@institutes.0/@courses.20 //@institutes.0/@courses.25"/> + <specialisation + name="Databases and Search"/> + <specialisation + name="Artificial Intelligence"/> </programs> <institutes name="Institutt for datateknologi og informatikk"> @@ -116,10 +113,6 @@ name="Operativssystemer" credits="7.5" level="ThirdYearCourse"/> - <courses - code="TDT4140" - name="Programvareutvikling" - credits="7.5"/> <courses code="TDT4145" name="Datamodellering og databasesystemer" @@ -158,15 +151,6 @@ name="Informatikk prosjektarbeid II" credits="7.5" level="ThirdYearCourse"/> - <courses - code="IT2805" - name="Webteknologi" - credits="7.5"/> - <courses - code="IT2810" - name="Webutvikling" - credits="7.5" - level="ThirdYearCourse"/> <courses code="TDT4117" name="Informasjonsgjenfinning" @@ -182,11 +166,6 @@ name="Programmeringsspråk" credits="7.5" level="ThirdYearCourse"/> - <courses - code="TDT4175" - name="Informasjonssystemer" - credits="7.5" - level="ThirdYearCourse"/> <courses code="TDT4237" name="Programvaresikkerhet og personvern" @@ -210,6 +189,35 @@ credits="30.0" level="SecoundDegreeCourse" season="Both"/> + <courses + code="IT3010" + name="Metoder for forskningsbasert innovasjon i IT" + credits="7.5" + level="SecoundDegreeCourse" + season="Spring"/> + <courses + code="IT3901" + name="Masteroppgave i informatikk: Programvaresystemer" + credits="60.0" + level="SecoundDegreeCourse" + season="Both"/> + <courses + code="IT3402 " + name="Design av grafiske brukergrensesnitt" + credits="7.5" + level="SecoundDegreeCourse"/> + <courses + code="TDT4245 " + name="Samhandlingsteknologi og sosiale medier" + credits="7.5" + level="SecoundDegreeCourse" + season="Spring"/> + <courses + code="IT3906 " + name="Masteroppgave i informatikk: Interaksjonsdesign, spill- og læringsteknologi" + credits="60.0" + level="SecoundDegreeCourse" + season="Both"/> </institutes> <institutes name="Institutt for matematiske fag"> @@ -292,11 +300,6 @@ name="Pedagogikk" credits="15.0" season="Spring"/> - <courses - code="PPU4614" - name="PPU4625" - level="SecoundDegreeCourse" - season="Spring"/> <courses code="PPU4625" name="Fagdidaktikk 2 - informatikk" diff --git a/tdt4250.spp.html/src/tdt4250/spp/html/target/NTNU.html b/tdt4250.spp.html/src/tdt4250/spp/html/target/NTNU.html index f9c077e..4d17d24 100644 --- a/tdt4250.spp.html/src/tdt4250/spp/html/target/NTNU.html +++ b/tdt4250.spp.html/src/tdt4250/spp/html/target/NTNU.html @@ -11,118 +11,11 @@ <label for="programs">Choose program:</label> <select name="programs" id="programs"> -<option value="bachelor-in-it">Bachelor in IT</option> <option value="lektor-i-realfag">Lektor i Realfag</option> +<option value="master-i-informatikk">Master i informatikk</option> </select> -<div id="bachelor-in-it" class="spp-table"> -<h2>Bachelor in IT</h2 -<p>Bachelor in IT is taken over 6 semesters.</p> - -<h3>Semester 1</h3> -<table style="width=80%"> -<tr> - <th>Code</th> - <th>Name</th> - <th>Credits</th> - <th>Level</th> -</tr> -<tr> - <td>TDT4110</td> - <td>Informasjonsteknologi, grunnkurs</td> - <td>7.5</td> - <td>FoundationCourse</td> -</tr> -<tr> - <td>IT2805</td> - <td>Webteknologi</td> - <td>7.5</td> - <td>FoundationCourse</td> -</tr> -</table> - - -<h3>Semester 2</h3> -<table style="width=80%"> -<tr> - <th>Code</th> - <th>Name</th> - <th>Credits</th> - <th>Level</th> -</tr> -<tr> - <td>TDT4100</td> - <td>Objektorientert programmering</td> - <td>7.5</td> - <td>FoundationCourse</td> -</tr> -<tr> - <td>MA1103</td> - <td>Flerdimensjonal analyse</td> - <td>7.5</td> - <td>FoundationCourse</td> -</tr> -</table> - - -<h3>Semester 3</h3> -<table style="width=80%"> -<tr> - <th>Code</th> - <th>Name</th> - <th>Credits</th> - <th>Level</th> -</tr> -<tr> - <td>TDT4120</td> - <td>Algoritmer og datastrukturer</td> - <td>7.5</td> - <td>IntermediateCourse</td> -</tr> -<tr> - <td>TMA4135</td> - <td>Matematikk 4D</td> - <td>7.5</td> - <td>ThirdYearCourse</td> -</tr> -</table> - - -<h3>Semester 4</h3> -<table style="width=80%"> -<tr> - <th>Code</th> - <th>Name</th> - <th>Credits</th> - <th>Level</th> -</tr> -</table> - - -<h3>Semester 5</h3> -<table style="width=80%"> -<tr> - <th>Code</th> - <th>Name</th> - <th>Credits</th> - <th>Level</th> -</tr> -</table> - - -<h3>Semester 6</h3> -<table style="width=80%"> -<tr> - <th>Code</th> - <th>Name</th> - <th>Credits</th> - <th>Level</th> -</tr> -</table> - - -</div> <div id="lektor-i-realfag" class="spp-table"> <h2>Lektor i Realfag</h2 <p>Lektor i Realfag is taken over 10 semesters.</p> @@ -440,12 +333,6 @@ <td>15.0</td> <td>FoundationCourse</td> </tr> -<tr> - <td>PPU4614</td> - <td>PPU4625</td> - <td>0.0</td> - <td>SecoundDegreeCourse</td> -</tr> <tr> <td>PPU4625</td> <td>Fagdidaktikk 2 - informatikk</td> @@ -507,6 +394,55 @@ </table> +</div> +<div id="master-i-informatikk" class="spp-table"> +<h2>Master i informatikk</h2 +<p>Master i informatikk is taken over 4 semesters.</p> + +<h3>Semester 1</h3> +<table style="width=80%"> +<tr> + <th>Code</th> + <th>Name</th> + <th>Credits</th> + <th>Level</th> +</tr> +</table> + + +<h3>Semester 2</h3> +<table style="width=80%"> +<tr> + <th>Code</th> + <th>Name</th> + <th>Credits</th> + <th>Level</th> +</tr> +</table> + + +<h3>Semester 3</h3> +<table style="width=80%"> +<tr> + <th>Code</th> + <th>Name</th> + <th>Credits</th> + <th>Level</th> +</tr> +</table> + + +<h3>Semester 4</h3> +<table style="width=80%"> +<tr> + <th>Code</th> + <th>Name</th> + <th>Credits</th> + <th>Level</th> +</tr> +</table> + + </div> <script src="index.js"></script> diff --git a/tdt4250.spp.model.edit/plugin.properties b/tdt4250.spp.model.edit/plugin.properties index d43a2f5..2978e9d 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 2f94911..f202d79 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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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. * <!-- begin-user-doc --> diff --git a/tdt4250.spp.model/src/tdt4250/spp/Course.java b/tdt4250.spp.model/src/tdt4250/spp/Course.java index 5afb4b1..b5880b7 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; * </ul> * * @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 827fac4..8a675f3 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<Semester> getSemesters(); /** - * Returns the value of the '<em><b>Specialisation</b></em>' containment reference. + * Returns the value of the '<em><b>Specialisation</b></em>' 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 <em>Program</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the value of the '<em>Specialisation</em>' containment reference. - * @see #setSpecialisation(Specialisation) + * @return the value of the '<em>Specialisation</em>' 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 <em>Specialisation</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Specialisation</em>' containment reference. - * @see #getSpecialisation() + * @model opposite="program" containment="true" upper="20" * @generated */ - void setSpecialisation(Specialisation value); + EList<Specialisation> getSpecialisation(); /** * Returns the value of the '<em><b>Mandatory Courses</b></em>' containment reference list. diff --git a/tdt4250.spp.model/src/tdt4250/spp/Specialisation.java b/tdt4250.spp.model/src/tdt4250/spp/Specialisation.java index 0c76de0..651266f 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; * <ul> * <li>{@link tdt4250.spp.Specialisation#getName <em>Name</em>}</li> * <li>{@link tdt4250.spp.Specialisation#getProgram <em>Program</em>}</li> + * <li>{@link tdt4250.spp.Specialisation#getMandatoryCourses <em>Mandatory Courses</em>}</li> + * <li>{@link tdt4250.spp.Specialisation#getElectiveCourses <em>Elective Courses</em>}</li> * </ul> * * @see tdt4250.spp.SppPackage#getSpecialisation() @@ -68,4 +71,28 @@ public interface Specialisation extends EObject { */ void setProgram(Program value); + /** + * Returns the value of the '<em><b>Mandatory Courses</b></em>' reference list. + * The list contents are of type {@link tdt4250.spp.Course}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the value of the '<em>Mandatory Courses</em>' reference list. + * @see tdt4250.spp.SppPackage#getSpecialisation_MandatoryCourses() + * @model + * @generated + */ + EList<Course> getMandatoryCourses(); + + /** + * Returns the value of the '<em><b>Elective Courses</b></em>' reference list. + * The list contents are of type {@link tdt4250.spp.Course}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the value of the '<em>Elective Courses</em>' reference list. + * @see tdt4250.spp.SppPackage#getSpecialisation_ElectiveCourses() + * @model + * @generated + */ + EList<Course> getElectiveCourses(); + } // Specialisation diff --git a/tdt4250.spp.model/src/tdt4250/spp/SppPackage.java b/tdt4250.spp.model/src/tdt4250/spp/SppPackage.java index a2a819f..2333663 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 '<em><b>Specialisation</b></em>' containment reference. + * The feature id for the '<em><b>Specialisation</b></em>' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -453,6 +453,24 @@ public interface SppPackage extends EPackage { */ int SPECIALISATION__PROGRAM = 1; + /** + * The feature id for the '<em><b>Mandatory Courses</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SPECIALISATION__MANDATORY_COURSES = 2; + + /** + * The feature id for the '<em><b>Elective Courses</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SPECIALISATION__ELECTIVE_COURSES = 3; + /** * The number of structural features of the '<em>Specialisation</em>' class. * <!-- begin-user-doc --> @@ -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 '<em>Specialisation</em>' 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 <em>Specialisation</em>}'. + * Returns the meta object for the containment reference list '{@link tdt4250.spp.Program#getSpecialisation <em>Specialisation</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Specialisation</em>'. + * @return the meta object for the containment reference list '<em>Specialisation</em>'. * @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 <em>Mandatory Courses</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Mandatory Courses</em>'. + * @see tdt4250.spp.Specialisation#getMandatoryCourses() + * @see #getSpecialisation() + * @generated + */ + EReference getSpecialisation_MandatoryCourses(); + + /** + * Returns the meta object for the reference list '{@link tdt4250.spp.Specialisation#getElectiveCourses <em>Elective Courses</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Elective Courses</em>'. + * @see tdt4250.spp.Specialisation#getElectiveCourses() + * @see #getSpecialisation() + * @generated + */ + EReference getSpecialisation_ElectiveCourses(); + /** * Returns the meta object for class '{@link tdt4250.spp.MandatoryCourses <em>Mandatory Courses</em>}'. * <!-- begin-user-doc --> @@ -1191,7 +1231,7 @@ public interface SppPackage extends EPackage { EReference PROGRAM__SEMESTERS = eINSTANCE.getProgram_Semesters(); /** - * The meta object literal for the '<em><b>Specialisation</b></em>' containment reference feature. + * The meta object literal for the '<em><b>Specialisation</b></em>' containment reference list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1364,6 +1404,22 @@ public interface SppPackage extends EPackage { */ EReference SPECIALISATION__PROGRAM = eINSTANCE.getSpecialisation_Program(); + /** + * The meta object literal for the '<em><b>Mandatory Courses</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference SPECIALISATION__MANDATORY_COURSES = eINSTANCE.getSpecialisation_MandatoryCourses(); + + /** + * The meta object literal for the '<em><b>Elective Courses</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference SPECIALISATION__ELECTIVE_COURSES = eINSTANCE.getSpecialisation_ElectiveCourses(); + /** * The meta object literal for the '{@link tdt4250.spp.impl.MandatoryCoursesImpl <em>Mandatory Courses</em>}' class. * <!-- begin-user-doc --> diff --git a/tdt4250.spp.model/src/tdt4250/spp/impl/ProgramImpl.java b/tdt4250.spp.model/src/tdt4250/spp/impl/ProgramImpl.java index 62d2b42..735e7c6 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<Semester> semesters; /** - * The cached value of the '{@link #getSpecialisation() <em>Specialisation</em>}' containment reference. + * The cached value of the '{@link #getSpecialisation() <em>Specialisation</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSpecialisation() * @generated * @ordered */ - protected Specialisation specialisation; + protected EList<Specialisation> specialisation; /** * The cached value of the '{@link #getMandatoryCourses() <em>Mandatory Courses</em>}' containment reference list. @@ -221,43 +221,11 @@ public class ProgramImpl extends MinimalEObjectImpl.Container implements Program * @generated */ @Override - public Specialisation getSpecialisation() { - return specialisation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @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; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @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<Specialisation> getSpecialisation() { + if (specialisation == null) { + specialisation = new EObjectContainmentWithInverseEList<Specialisation>(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<InternalEObject>)(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<InternalEObject>)(InternalEList<?>)getSpecialisation()).basicAdd(otherEnd, msgs); case SppPackage.PROGRAM__MANDATORY_COURSES: return ((InternalEList<InternalEObject>)(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<? extends Semester>)newValue); return; case SppPackage.PROGRAM__SPECIALISATION: - setSpecialisation((Specialisation)newValue); + getSpecialisation().clear(); + getSpecialisation().addAll((Collection<? extends Specialisation>)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 44e5fb3..8fa3117 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; * <ul> * <li>{@link tdt4250.spp.impl.SpecialisationImpl#getName <em>Name</em>}</li> * <li>{@link tdt4250.spp.impl.SpecialisationImpl#getProgram <em>Program</em>}</li> + * <li>{@link tdt4250.spp.impl.SpecialisationImpl#getMandatoryCourses <em>Mandatory Courses</em>}</li> + * <li>{@link tdt4250.spp.impl.SpecialisationImpl#getElectiveCourses <em>Elective Courses</em>}</li> * </ul> * * @generated @@ -52,6 +58,26 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements */ protected String name = NAME_EDEFAULT; + /** + * The cached value of the '{@link #getMandatoryCourses() <em>Mandatory Courses</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMandatoryCourses() + * @generated + * @ordered + */ + protected EList<Course> mandatoryCourses; + + /** + * The cached value of the '{@link #getElectiveCourses() <em>Elective Courses</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getElectiveCourses() + * @generated + * @ordered + */ + protected EList<Course> electiveCourses; + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -137,6 +163,32 @@ public class SpecialisationImpl extends MinimalEObjectImpl.Container implements eNotify(new ENotificationImpl(this, Notification.SET, SppPackage.SPECIALISATION__PROGRAM, newProgram, newProgram)); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EList<Course> getMandatoryCourses() { + if (mandatoryCourses == null) { + mandatoryCourses = new EObjectResolvingEList<Course>(Course.class, this, SppPackage.SPECIALISATION__MANDATORY_COURSES); + } + return mandatoryCourses; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EList<Course> getElectiveCourses() { + if (electiveCourses == null) { + electiveCourses = new EObjectResolvingEList<Course>(Course.class, this, SppPackage.SPECIALISATION__ELECTIVE_COURSES); + } + return electiveCourses; + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -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 * <!-- end-user-doc --> * @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<? extends Course>)newValue); + return; + case SppPackage.SPECIALISATION__ELECTIVE_COURSES: + getElectiveCourses().clear(); + getElectiveCourses().addAll((Collection<? extends Course>)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 96ea896..a66b095 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); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EReference getSpecialisation_MandatoryCourses() { + return (EReference)specialisationEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EReference getSpecialisation_ElectiveCourses() { + return (EReference)specialisationEClass.getEStructuralFeatures().get(3); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -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 866bd04..60105d9 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<Object, Object> 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 '<em>Course</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @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 '<em>Course</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateCourse_courseCodeNeedsToBeUnique(Course course, DiagnosticChain diagnostics, Map<Object, Object> 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); } /** -- GitLab