package edu.umn.csci5801.model;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Justin on 12/2/2014.
 */
public class GradRequirements {
    private List<GradReqCheck> reqChecks;
    private List<Requirement> reqList;
    private Degree degree;

    //constructorx
    public GradRequirements() {}
    public GradRequirements(Degree deg, List<GradReqCheck> grc){
        //createReqList(deg);  *****UNCOMMENT AND HANDLE EXCEPTION*****
        testReqList(reqList, grc);
    }
    public GradRequirements(Degree deg, List<GradReqCheck> grc, Degree d){
        //createReqList(deg);  *****UNCOMMENT AND HANDLE EXCEPTION*****
        testReqList(reqList, grc);
        degree = d;
    }

    public void setReqChecks(List<GradReqCheck> list) { reqChecks = list; }
    public void addReqCheck(GradReqCheck grc) { reqChecks.add(grc); }
    public void setReqList(List<Requirement> list) { reqList = list; }
    public void addRequirement(Requirement r) { reqList.add(r); }
    public void setDegree(Degree d) { degree = d; }

    public List<GradReqCheck> getReqChecks() { return reqChecks; }
    public List<Requirement> getReqList() { return reqList; }
    public Degree getDegree() { return degree; }

    public List<Requirement> createReqList(Degree degree) throws Exception {
        List<Requirement> rList = new ArrayList<Requirement>();
        if(degree == Degree.MS_A) {
            MasterA MSA = new MasterA();
            rList = MSA.getReqList();
        }
        else if(degree == Degree.MS_B) {
            MasterB MSB = new MasterB();
            rList = MSB.getReqList();
        }
        else if(degree == Degree.MS_C) {
            MasterC MSC = new MasterC();
            rList = MSC.getReqList();
        }
        else if(degree == Degree.PHD) {
            PHD phd = new PHD();
            rList = phd.getReqList();
        }
        else {
            Exception e = new Exception();
            throw e;
        }
        this.reqList = rList;
        return reqList;
    }

    //TODO:test ReqList against student record contained in partially filled-in grc
    private void testReqList(List<Requirement> requirements, List<GradReqCheck> grc) {
    }
}

@@ -292,17 +292,17 @@
 structor
-x
+s
 %0D%0A    pu
@@ -371,226 +371,69 @@
  deg
-, List%3CGradReqCheck%3E grc)%7B%0D%0A        //createReqList(deg);  *****UNCOMMENT AND HANDLE EXCEPTION*****%0D%0A        testReqList(reqList, grc);%0D%0A    %7D%0D%0A    public GradRequirements(Degree deg, List%3CGradReqCheck%3E grc, Degree d)%7B
+) throws Exception%7B%0D%0A        //TODO:place in try/catch clause
 %0D%0A  
@@ -438,18 +438,16 @@
         
-//
 createRe
@@ -461,107 +461,8 @@
 eg);
-  *****UNCOMMENT AND HANDLE EXCEPTION*****%0D%0A        testReqList(reqList, grc);%0D%0A        degree = d;
 %0D%0A  
@@ -462,26 +462,24 @@
 g);%0D%0A    %7D%0D%0A
-%0D%0A
     public v
@@ -1822,175 +1822,302 @@
     
-//TODO:
+public void 
 test
- 
 ReqList
- against student record contained in partially filled-in grc%0D%0A    private void testReqList(List%3CRequirement%3E requirements, List%3CGradReqCheck%3E grc) %7B
+(List%3CCourseTaken%3E courseTakenList, List%3CCompletedMilestone%3E completedMilestoneList) %7B%0D%0A        for (Requirement r : reqList) %7B%0D%0A            GradReqCheck grc = new GradReqCheck(r.getName());%0D%0A            grc.testReq(r, courseTakenList, completedMilestoneList);%0D%0A        %7D
 %0D%0A  

Revert GradRequirements.java