package admin; import java.util.Collection; /** * Derived from Section 2.7.5 of the requirements. */ public abstract class ManageTA { /** * Collection of TAs. */ Collection ta; /** * Creates a new TA. */ /*@ requires // //TA t is not null // (t != null) && //There is not a TA in that has //the same name as the given TA t (!(\exists TA t_other ; ta.contains(t_other) ; t_other.name.equals(t.name))); ensures //A TA is in the collection of TAs iff it is the new //TA to be added, or it is already in the list of TAs (\forall TA t_other ; ta.contains(t_other) <==> t_other.equals(t) || \old(ta).contains(t)); @*/ public abstract void addTA(TA t); /** * Edit TA permissions. */ /*@ requires // //TA t is not null // (t != null) && //The TA is in the collection of TAs ta.contains(t) && //There is not a TA that has //the same name as the given TA t (!(\exists TA t_other ; ta.contains(t_other) ; t_other.name.equals(t.name))); ensures //The TA is still in the list of TAs ta.contains(t) && //The old TA does not exist in the list (!(\exists TA t_other ; ta.contains(t_other) ; t_other.equals(\old(t)))); @*/ public abstract void editTA(TA t); /** * Removes a TA. */ /*@ requires // //TA t is not null // (t != null) && //The TA is in the collection of TAs ta.contains(t); ensures //A TA t has been deleted if it is not the item to //be deleted and it is in the list of TAs (\forall TA t_other ; ta.contains(t_other) <==> !t_other.equals(t) || \old(ta).contains(t)); @*/ public abstract void delete(TA t); } /** * */ abstract class TA { /** * TA's concatonated name. */ String name; /** * Permissions granted to TA. */ Permissions permission; } /** * TA's granted permissions. */ abstract class Permissions { /** * Allows TA to export grades to server. */ boolean export; /** * Allows TA to add assignments to gradebook. */ boolean addAssignments; /** * Allows TA to remove assignments from gradebook. */ boolean removeAssignments; }