Storyboard StudyRightObjectModelNavigationAndQueries

Extend the class model:

Full class model from code:

How to navigate and query an object model.

Start: Example object structure:

Step 1: Simple set based navigation:

            story.addObjectDiagram(university);

      // =====================================================
      story.addStep("Simple set based navigation:");

Results in:

      Sum of assignment points: 23.0. 
      Sum of points of assignments that have been done by at least one students: 15.0.

Check: Assignment points: 23.0 actual 23.0

Check: donePoints: 15.0 actual 15.0

Step 2: Rooms with assignments not yet done by Karli:

          *          "attributes":[
    *             "assignmentPoints : int",
    *             "credits : int",
    *             "id : String",
    *             "motivation : int",

Results in:

      (senate math 17, gymnasium sports 25)

Check: rooms.size(): 2 actual 2

Step 3: Filter for attribute:

          *          "attributes":[
    *             "certified : boolean"
    *          ],
    *          "methods":[

Results in:

      rooms17: (senate math 17)
      roomsGE20: (gymnasium sports 25, 7422 Software Engineering 42)

Step 4: Filter for even values:

          *             "createStudentsTeachingAssistant() TeachingAssistant",
    *             "firePropertyChange(String p0, Object p1, Object p2) boolean"
    *          ]

Results in:

      (7522 arts 16, The End exam 0, 7422 Software Engineering 42)

Step 5: Filter for type:

          *             "removeObject(Object p0)",
    *             "setValue(Object p1, String p2, Object p3, String p4) boolean"
    *          ]
(Karli 4242 0 0 0)

Step 6: Write operations on sets:

          *             "createPointsCondition(int p0, int p1) AssignmentSet",
    *             "filterContent(String p0) AssignmentSet",
    *             "filterContent(String p0, String p1) AssignmentSet",

Step 7: Rooms with two students that are friends (and need supervision):

          *             "getStudents() StudentSet",
    *             "getTypClass() Class<?>",
    *             "with(Object p1) AssignmentSet",
    *             "withContent(String p0) AssignmentSet",
    *             "withPoints(int p0) AssignmentSet",
    *             "withRoom(Room p0) AssignmentSet",
    *             "withStudents(Student p0) AssignmentSet",
    *             "without(Assignment p0) AssignmentSet",
    *             "withoutStudents(Student p0) AssignmentSet"

Results in:

      (gymnasium sports 25)

Step 8: Rooms with two students with low motivation that are friends (and need supervision):

          *             "setValue(Object p1, String p2, Object p3, String p4) boolean"
    *          ]
    *       },
    *       {
    *          "typ":"node",
    *          "id":"PresidentSet",
    *          "methods":[
    *             "createPresidentPO() PresidentPO",
    *             "filterUniversity(Object p0) PresidentSet",
    *             "getEntryType() String",
    *             "getNewList(boolean p1) PresidentSet",

Results in:

      (gymnasium sports 25)

Step 9: Rooms with two students without supervision that are friends and add teaching assistance:

          *          ],
    *          "methods":[
    *             "createIdMap(String p0) IdMap",
    *             "getSendableInstance(boolean p1) Object",
    *             "getValue(Object p1, String p2) Object",
    *             "removeObject(Object p0)",
    *             "setValue(Object p1, String p2, Object p3, String p4) boolean"
    *          ]
    *       },
    *       {
    *          "typ":"node",
    *          "id":"RoomSet",
    *          "methods":[
    *             "createCreditsCondition(int p0) RoomSet",
    *             "createCreditsCondition(int p0, int p1) RoomSet",

Results in:

      (gymnasium sports 25)

Step 10: TAs as students in a room:

          *             "getTas() TeachingAssistantSet",
    *             "getTopic() ObjectSet",
    *             "getTypClass() Class<?>",
    *             "getUniversity() UniversitySet",
    *             "with(Object p1) RoomSet",
    *             "withAssignments(Assignment p0) RoomSet",
    *             "withCredits(int p0) RoomSet",
    *             "withDoors(Room p0) RoomSet",
    *             "withName(String p0) RoomSet",

Step 11: Double motivation of all students:

          *       },
    *       {
    *          "typ":"node",
    *          "id":"StudentCreator",
    *          "attributes":[
    *             "properties : String[]"
    *          ],
    *          "methods":[
    *             "createIdMap(String p0) IdMap",
    *             "getSendableInstance(boolean p1) Object",
    *             "getValue(Object p1, String p2) Object",
    *             "removeObject(Object p0)",
    *             "setValue(Object p1, String p2, Object p3, String p4) boolean"
    *          ]
    *       },
    *       {
    *          "typ":"node",
    *          "id":"StudentSet",
    *          "methods":[
    *             "createAssignmentPointsCondition(int p0) StudentSet",
    *             "createAssignmentPointsCondition(int p0, int p1) StudentSet",
    *             "createCreditsCondition(int p0) StudentSet",
    *             "createCreditsCondition(int p0, int p1) StudentSet",
    *             "createIdCondition(String p0) StudentSet",
    *             "createIdCondition(String p0, String p1) StudentSet",
    *             "createMotivationCondition(int p0) StudentSet",
    *             "createMotivationCondition(int p0, int p1) StudentSet",
    *             "createNameCondition(String p0) StudentSet",
    *             "createNameCondition(String p0, String p1) StudentSet",
    *             "createStudentPO() StudentPO",
    *             "filterAssignmentPoints(int p0) StudentSet",
    *             "filterAssignmentPoints(int p0, int p1) StudentSet",
    *             "filterCredits(int p0) StudentSet",
    *             "filterCredits(int p0, int p1) StudentSet",
    *             "filterDone(Object p0) StudentSet",
    *             "filterFriends(Object p0) StudentSet",
    *             "filterId(String p0) StudentSet",
    *             "filterId(String p0, String p1) StudentSet",
    *             "filterIn(Object p0) StudentSet",
    *             "filterMotivation(int p0) StudentSet",
    *             "filterMotivation(int p0, int p1) StudentSet",
    *             "filterName(String p0) StudentSet",

Step 12: lure students from other rooms into math room:

          *             "getMotivation() NumberList",
    *             "getName() ObjectSet",
    *             "getNewList(boolean p1) StudentSet",
    *             "getTypClass() Class<?>",
    *             "getUniversity() UniversitySet",
    *             "instanceOfTeachingAssistant() TeachingAssistantSet",
    *             "with(Object p1) StudentSet",
    *             "withAssignmentPoints(int p0) StudentSet",
    *             "withCredits(int p0) StudentSet",
    *             "withDone(Assignment p0) StudentSet",
    *             "withFriends(Student p0) StudentSet",

Check: New students in math room: 3 actual 3