From 3ab26ccc34c0a4767996b4cd843bd2f981d1e639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Oppeb=C3=B8en?= Date: Thu, 24 Nov 2011 20:50:38 +0100 Subject: [PATCH] Example implementation for the course TDT4165. Updated README with some aims and suggestions. --- README | 19 ++++++++ src/model/Assignment.java | 3 +- src/model/Course.java | 2 +- src/model/Delivery.java | 2 +- src/model/DeliveryGroup.java | 7 +++ src/model/User.java | 30 ++++++++++++ src/model/ntnu/tdt4165/Assignment.java | 17 +++++++ src/model/ntnu/tdt4165/AssignmentGroup.java | 5 ++ src/model/ntnu/tdt4165/Course.java | 53 +++++++++++++++++++++ src/model/ntnu/tdt4165/Delivery.java | 14 ++++++ 10 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 src/model/DeliveryGroup.java create mode 100644 src/model/ntnu/tdt4165/Assignment.java create mode 100644 src/model/ntnu/tdt4165/AssignmentGroup.java create mode 100644 src/model/ntnu/tdt4165/Course.java create mode 100644 src/model/ntnu/tdt4165/Delivery.java diff --git a/README b/README index e69de29..b6d5924 100644 --- a/README +++ b/README @@ -0,0 +1,19 @@ +System for handling assignments. +Mainly developed for use at NTNU. + +Aiming for the following features: +- Users and user login (via innsida at NTNU) +- Publishing assignments, attaching files to publications +- Submitting assignments, attaching files to submissions +- Assessing assignments + +Aiming to replace the following systems (among others): +- it's learning (the delivery part) +- http://www.idi.ntnu.no/emner/tdt4165/?page=deliver +- http://selje.idi.ntnu.no:1234/tdt4120/ +- http://itgk.idi.ntnu.no/oving/ +- http://www.math.ntnu.no/ovsys/?db=MA1101-H2011 + +Suggestions: +- Permissions for files / assignments +- Partitioning students into groups (GUI) diff --git a/src/model/Assignment.java b/src/model/Assignment.java index b229fa2..995faeb 100644 --- a/src/model/Assignment.java +++ b/src/model/Assignment.java @@ -1,12 +1,11 @@ package model; -import java.util.ArrayList; import java.util.Date; public class Assignment { protected String name, description; protected Date publishedDate, dueDate; - protected ArrayList deliveries; + public DeliveryGroup deliveries; public Assignment(String name, String description, Date publishedDate, Date dueDate){ this.name = name; diff --git a/src/model/Course.java b/src/model/Course.java index 81f0638..d82f2da 100644 --- a/src/model/Course.java +++ b/src/model/Course.java @@ -3,7 +3,7 @@ package model; public class Course { protected String name; protected UserGroup owner, students; - protected AssignmentGroup assignments; + public AssignmentGroup assignments; public Course(UserGroup owner, String name){ this.owner = owner; diff --git a/src/model/Delivery.java b/src/model/Delivery.java index dc5e5aa..50e950e 100644 --- a/src/model/Delivery.java +++ b/src/model/Delivery.java @@ -2,7 +2,7 @@ package model; public class Delivery { protected UserGroup userGroup; - protected Assessment assessment; + public Assessment assessment; public Delivery(UserGroup userGroup){ this.userGroup = userGroup; diff --git a/src/model/DeliveryGroup.java b/src/model/DeliveryGroup.java new file mode 100644 index 0000000..865aa6c --- /dev/null +++ b/src/model/DeliveryGroup.java @@ -0,0 +1,7 @@ +package model; + +import java.util.HashSet; + +public class DeliveryGroup extends HashSet { + +} diff --git a/src/model/User.java b/src/model/User.java index 7169973..be582e7 100644 --- a/src/model/User.java +++ b/src/model/User.java @@ -6,4 +6,34 @@ public class User { public User(String username){ this.username = username; } + + + + // Generated by Eclipse + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((username == null) ? 0 : username.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + User other = (User) obj; + if (username == null) { + if (other.username != null) + return false; + } else if (!username.equals(other.username)) + return false; + return true; + } } diff --git a/src/model/ntnu/tdt4165/Assignment.java b/src/model/ntnu/tdt4165/Assignment.java new file mode 100644 index 0000000..c2e6ec4 --- /dev/null +++ b/src/model/ntnu/tdt4165/Assignment.java @@ -0,0 +1,17 @@ +package model.ntnu.tdt4165; + +import java.util.Date; +import model.files.*; + +public class Assignment extends model.Assignment { + PublishedFileGroup problemFiles, solutionFiles; + + public Assignment(String name, String description, Date publishedDate, + Date dueDate, PublishedFileGroup problemFiles, PublishedFileGroup solutionFiles) { + super(name, description, publishedDate, dueDate); + this.problemFiles = problemFiles; + this.solutionFiles = solutionFiles; + } + + +} diff --git a/src/model/ntnu/tdt4165/AssignmentGroup.java b/src/model/ntnu/tdt4165/AssignmentGroup.java new file mode 100644 index 0000000..44140b5 --- /dev/null +++ b/src/model/ntnu/tdt4165/AssignmentGroup.java @@ -0,0 +1,5 @@ +package model.ntnu.tdt4165; + +public class AssignmentGroup extends model.AssignmentGroup { + +} diff --git a/src/model/ntnu/tdt4165/Course.java b/src/model/ntnu/tdt4165/Course.java new file mode 100644 index 0000000..cfb9b8c --- /dev/null +++ b/src/model/ntnu/tdt4165/Course.java @@ -0,0 +1,53 @@ +package model.ntnu.tdt4165; + +import java.util.Date; + +import model.Assessment; +import model.User; +import model.UserGroup; +import model.files.FileGroup; +import model.ntnu.Semester; +import model.files.*; + +public class Course extends model.ntnu.Course { + + public Course(UserGroup owner, String name, String code, Semester semester, + int year) { + super(owner, name, code, semester, year); + name = "progspråk"; + code = "tdt4165"; + + test(); + } + + private void test(){ + // create some users + User andreao = new User("andreao"); + User somaen = new User("somaen"); + students.add(andreao); + studasses.add(somaen); + + // create assignment + Date now = new Date(); + PublishedFileGroup oving1Files = new PublishedFileGroup(now,now); + oving1Files.add(new File("ov1.pdf","ov1.pdf", "Introduksjon til Oz")); + PublishedFileGroup oving1SolutionFiles = new PublishedFileGroup(now,now); + oving1SolutionFiles.add(new File("ov1_lf.pdf","ov1_lf.pdf", "Løsningsforslag")); + oving1SolutionFiles.add(new File("List.oz","List.oz", "")); + Assignment assignment = new Assignment("Øving 1", "Introduksjon til Oz", now,now, oving1Files, oving1SolutionFiles); + assignments.add(assignment); + + // create a delivery + UserGroup gruppe1 = new UserGroup(); + gruppe1.add(andreao); + File fil = new File("oving1.oz","","mitt svar på øving 1"); + FileGroup filer = new FileGroup(); + filer.add(fil); + Delivery levering1 = new Delivery(gruppe1,filer); + assignment.deliveries.add(levering1); + + // create an assessment + Assessment vurdering1 = new Assessment(studasses, "Bra!", now); + levering1.assessment = vurdering1; + } +} diff --git a/src/model/ntnu/tdt4165/Delivery.java b/src/model/ntnu/tdt4165/Delivery.java new file mode 100644 index 0000000..c627be1 --- /dev/null +++ b/src/model/ntnu/tdt4165/Delivery.java @@ -0,0 +1,14 @@ +package model.ntnu.tdt4165; + +import model.UserGroup; +import model.files.FileGroup; + +public class Delivery extends model.Delivery { + FileGroup files; + + public Delivery(UserGroup userGroup, FileGroup files) { + super(userGroup); + this.files = files; + } + +}